GCP deployment of ai model for NLP text classification

161 views Asked by At

I'm trying to deploy a model on the Google Cloud Platform. But I've been running into same issues I created the bucket and as specified on the docs I ran:

gcloud ai-platform local predict --model-dir gs://bucket/ \
  --json-instances input.json \
  --framework SCIKIT_LEARN

But for same reason it doesn't find the input file on the same bucket of the model. So I've followed the instructions on another question . I've tried coping the input.json into the main directory but for some other reason is not categorizing the json as a json file...

In reality the model was created using a library called simpletransformers that I've tried to install to test with no sucess. I wish to know how is the best way to proceed?

input.json:

{ "document":{ "type":"PLAIN_TEXT", "content":"Protection plan costs, half of any delivery fee, and any Extras or young driver fee costs are always refunded."},"encodingType":"UTF8"}
1

There are 1 answers

0
Fcojavmelo On

As specified in the documentation, this command:

gcloud ai-platform local predict --model-dir local-or-cloud-storage-path-to-model-directory/ \
  --json-instances local-path-to-prediction-input.json \
  --framework name-of-framework

Is to test your model with local predictions and it's expecting to find your input.json file in your local machine rather than a GCS bucket. Based on what you've mentioned:

But for same reason it doesn't find the input file on the same bucket of the model

I'm assuming that you're expecting it to read it from GCS bucket. But it should actually be a local directory path; in your case, the command you executed doesn't specify a path so it's expecting to find your input.json file in the same directory where you've executed the command. I've just tried it and it worked fine for me.

I'm not sure what you mean by:

I've tried coping the input.json into the main directory but for some other reason is not categorizing the json as a json file...

But I'm assuming that you're referring to a GCS bucket as well, however, as mentioned before, your input.json file should be a local path rather than a GCS path.