I'm new to GCP so pardon for prehaps asking/missing something obvious here.
I'm trying to deploy and create a version resource on GCP with a custom pytorch model. Everything have been working fine until now until I try to create the a new version of the model. Then I keep getting: INVALID_ARGUMENT: Machine type is not available on this endpoint.
I've tried switching between different types from their list here without luck. What am I missing?
Here's the script I run to deploy:
MODEL_NAME='test_iris'
MODEL_VERSION='v1'
RUNTIME_VERSION='2.4'
MODEL_CLASS='model.PyTorchIrisClassifier'
PYTORCH_PACKAGE='gs://${BUCKET_NAME}/packages/torch-1.8.1+cpu-cp37-cp37m-linux_x86_64.whl'
DIST_PACKAGE='gs://${BUCKET_NAME}/models/Test_model-0.1.tar.gz'
GCS_MODEL_DIR='models/'
REGION="europe-west1"
# Creating model on AI platform
gcloud alpha ai-platform models create ${MODEL_NAME}\
--region=europe-west1 --enable-logging \
--enable-console-logging
gcloud beta ai-platform versions create ${MODEL_VERSION} --model=${MODEL_NAME} \
--origin=gs://${BUCKET_NAME}/${GCS_MODEL_DIR} \
--python-version=3.7 \
--machine-type=mls1-c4-m2\
--runtime-version=${RUNTIME_VERSION} \
--package-uris=${DIST_PACKAGE},${PYTORCH_PACKAGE} \
--prediction-class=${MODEL_CLASS}
Thanks!
According to the documentation, you can only deploy a Custom prediction routine when using a legacy (MLS1) machine type for your model version. However, you can not use a regional endpoint with this type of machine, as stated here,
- Regional endpoints only support Compute Engine (N1) machine types. You cannot use legacy (MLS1) machine types on regional endpoints.
As I can see, you have specified a regional endpoint with the --region
flag, which does not support the machine type you required for your use case. Thus, you need to change the model and its version to a global endpoint, so you won't face the error anymore.
In addition, when you specify a regional endpoint within gcloud create model --region
, you need to specify the same region when creating the model's version. On the other hand, when creating a model in the global endpoint gcloud create model --regions
, you can omit the region flag in the command gcloud ai-platform versions create
. Note that the --regions
command is used only for the global endpoint
Lastly, I must point out that, as per documentation, when selecting a region for the global endpoint, using the --regions
flag when creating the model, your prediction nodes run in the specified region. Although, the AI Platform Prediction infrastructure managing your resources might not necessarily run in the same region.