问题
I am using Google Cloud ML Engine to do local prediction by run:
gcloud ml-engine local predict --model-dir=$MODEL_DIR --json-instances $INPUT_FILE --framework $FRAMEWORK
assume:
MODEL_DIR="gs://<bucket>/model.joblib"
FRAMEWORK="SCIKIT_LEARN"
input file input.json
is in hardisk (d:\predict)
How to specify: INPUT_FILE=
?
I have manually upload the input file into my gc bucket, but get error:
ERROR: (gcloud.ml-engine.local.predict) Unable to read file [gs://<bucket>/input.json]: [Errno 2] No such file or directory: 'gs://<bucket>/input.json
Where shall I place the input file?
shall I keep it as in local disk (e.g. d:\predit\input.json
) or in bucket?
And what format is this?
回答1:
You are setting the MODEL_DIR
wrong, there is no need of adding "model.joblib" as it will be detected automatically. MODEL_DIR
should contain the path (including folders if necessary) where the file "model.joblib" is. As good practise, it's common to have a bucket containing it. The command (for your case) should go like this :
MODEL_DIR="gs://<bucket>/"
INPUT_FILE="input.json"
FRAMEWORK="SCIKIT_LEARN"
and your bucket should contain "model.joblib". For INPUT_FILE
, it should contain the path where "input.json" is FROM where you are running the command and the ".json" itself (i.e, if the ".json" it's under other folder, INPUT_FILE
should be "< folder>/input.json").
Here is the documentation for testing models [1].
来源:https://stackoverflow.com/questions/51469894/where-to-place-input-json-file-when-do-google-cloud-machine-learning-engine-pr