问题描述
我正在使用Google Cloud ML Engine通过运行进行本地预测:
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
假设:
MODEL_DIR="gs://<bucket>/model.joblib"
FRAMEWORK="SCIKIT_LEARN"
输入文件 input.json
位于硬键(d:\ predict)
input file input.json
is in hardisk (d:\predict)
如何指定: INPUT_FILE =
?
我已将输入文件手动上传到我的gc存储桶中,但出现错误:
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?
我应将其保留在本地磁盘(例如 d:\ predit \ input.json
)还是存储区中?
shall I keep it as in local disk (e.g. d:\predit\input.json
) or in bucket?
这是什么格式?
推荐答案
您将 MODEL_DIR
设置为错误,无需添加"model.joblib",因为它将被自动检测到. MODEL_DIR
应该包含文件"model.joblib"所在的路径(如有必要,还包括文件夹).作为一个好习惯,通常有一个装有水桶的水桶.该命令(针对您的情况)应如下所示:
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"
,并且您的存储桶中应包含"model.joblib".对于 INPUT_FILE
,它应包含路径"input.json"是运行命令的起始位置,以及".json"本身(即,如果".json"位于其他文件夹下, INPUT_FILE
应该为< folder>/input.json").
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").
以下是测试模型的文档 [1] .
Here is the documentation for testing models [1].
这篇关于Google Cloud Machine Learning引擎进行预测时,在何处放置"input.json文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!