@yuthw

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

SDKコマンドが反映されていない??

解決したいこと

githubから落としてきたコードを、colaboratoryで動かしてみている最中のエラーです。
https://github.com/GoogleCloudPlatform/ml-design-patterns/blob/master/05_resilience/serving_function.ipynb
Deploy to Cloud AI Platform Predictionsの部分にあるコードを動かした時のエラーなのですが、credentialが上手くいってないと怒られているっぽいです。

発生している問題・エラー

Creating model imdb

Creating version v1 from export/probs/sentiment_20211111_111144
Using endpoint [https://us-central1-ml.googleapis.com/]
ERROR: (gcloud.ai-platform.models.list) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials.

If you have already logged in with a different account:

    $ gcloud config set account ACCOUNT

to select an already authenticated account to use.

該当するソースコード

%%bash 
MODEL_LOCATION=$(find export/probs | head -2 | tail -1)
MODEL_NAME=imdb
MODEL_VERSION=v1

TFVERSION=2.1
REGION=us-central1
BUCKET=ai-analytics-solutions-kfpdemo

# create the model if it doesn't already exist
modelname=$(gcloud ai-platform models list | grep -w "$MODEL_NAME")
echo $modelname
if [ -z "$modelname" ]; then
   echo "Creating model $MODEL_NAME"
   gcloud ai-platform models create ${MODEL_NAME} --regions $REGION
else
   echo "Model $MODEL_NAME already exists"
fi

# delete the model version if it already exists
modelver=$(gcloud ai-platform versions list --model "$MODEL_NAME" | grep -w "$MODEL_VERSION")
echo $modelver
if [ "$modelver" ]; then
   echo "Deleting version $MODEL_VERSION"
   yes | gcloud ai-platform versions delete ${MODEL_VERSION} --model ${MODEL_NAME}
   sleep 10
fi


echo "Creating version $MODEL_VERSION from $MODEL_LOCATION"
gcloud ai-platform versions create ${MODEL_VERSION} \
       --model ${MODEL_NAME} --origin ${MODEL_LOCATION} --staging-bucket gs://${BUCKET} \
       --runtime-version $TFVERSION

自分で試したこと

Google cloud SDK Shellで $ gcloud auth login を実行したのですが、エラーは依然として消えません。ご参考までにgcloud config listを実行した結果を以下に示します

[accessibility]
screen_reader = False
[core]
account = y~~~~~~~@gmail.com ←projectのメアドです
disable_usage_reporting = True
project = my~~~~~~~~ ←project IDです

Your active configuration is: [default]

SDKコマンドを実行しても、colaboratory上に反映していないような気がします。SDKの設定がおかしいのでしょうか?
何卒宜しくお願い致します。

0 likes

No Answers yet.

Your answer might help someone💌