问题
I'm practicing GCP ML engine using Google's public templates and examples located here
After I ran the code in the example "housing-regression" LOCALLY, the model was successfully generated.
However, in prediction, an error was raised
ERROR: (gcloud.ml-engine.local.predict) Input instances are not in JSON format.
See "gcloud ml-engine predict --help" for details.
The codes I ran is in local-train.sh
gcloud ml-engine local predict --model-dir=${MODEL_LOCATION} --json-instances=data/new-data.json
Does anyone have the same problem? Did I make a mistake somewhere or is there some information I may have missed?
NOTES:
- This code is running locally on my Mac using GCP SDK which I have installed
- I checked the file and it is indeed a JSON file.
回答1:
For online prediction, the json needs to be one instance per line. So try removing the pretty formatting ...
来源:https://stackoverflow.com/questions/50653384/input-instances-are-not-in-json-format