0

Executing:

gcloud beta ai-platform versions create $VERSION_NAME \
  --model $MODEL_NAME \
  --runtime-version 2.3 \
  --python-version 3.7 \
  --origin gs://$BUCKET_NAME/dummy/v1/model/ \
  --package-uris gs://$BUCKET_NAME/dummy/v1/dummy_diagnostic_model-0.1.tar.gz \
  --prediction-class predictor.MyPredictor

Results in:

ERROR: (gcloud.beta.ai-platform.versions.create) Create Version failed. Bad model detected with error:  "Failed to load model: Unexpected error when loading the model: No module named 'k' (Error code: 0)"

Running this locally succeeds:

pip install  --upgrade --target=/tmp/custom_lib --no-cache-dir -b /tmp/pip_builds dist/dummy_diagnostic_model-0.1.tar.gz

I guess this issue is about gitlab access token not configured on gcloud machine, how can i resolve this issue?

Ismail
  • 1,068
  • 1
  • 6
  • 11
Tsvi Sabo
  • 575
  • 2
  • 11
  • Can you try the workaround in https://stackoverflow.com/questions/48512588/in-google-cloud-ml-setup-py-error-during-setting-up-pytorch? – Javier Bóbeda Jan 27 '21 at 11:51

1 Answers1

0

This seems to be a dependency issue. Make sure to follow Package your Predictor and its dependencies documentation, as No module named error is usually caused by not creating the preprocess.py, predictor.py, and setup.py files all in the same directory.

For more details, make sure to check this previous thread and this article.

Ismail
  • 1,068
  • 1
  • 6
  • 11
  • They are all packaged together, `but preprocess.py` imports from an external package that is located under a private PyPI url, so this is my `setup.py` file: ` ... setup( name='dummy_diagnostic_model', version='0.1', dependency_links=['PRIVATE_GITLAB_PYPI_URL', ], scripts=['predictor.py', 'preprocess.py', 'postprocess.py']) ` To download a package from the private url a gitlab access token has to be configured somewhere, not sure how though – Tsvi Sabo Jan 27 '21 at 07:57