谷歌云平台,人工智能和机器学习产品,入门:使用TensorFlow估计器进行培训和预测

2024-05-23 15:52:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我试着用张量流估计器从训练和预测两方面完成测试。 我当前的步骤是“提交批处理预测作业”(https://cloud.google.com/ai-platform/docs/getting-started-tensorflow-estimator#submit_a_batch_prediction_job)。 命令是

gcloud ai-platform jobs submit prediction $JOB_NAME \
--model $MODEL_NAME \
--version v1 \
--data-format text \
--region $REGION \
--input-paths $TEST_JSON \
--output-path $OUTPUT_PATH/predictions

所有变量现在都有值。但是$TEST_JSON没有

JOB_NAME=census_prediction_1
MODEL_NAME=census
REGION=europe-west1
OUTPUT_PATH=gs://$BUCKET_NAME/$JOB_NAME

它是——输入路径。 我试过使用

TEST_JSON=../test.json

但有一个错误: 错误:(gcloud.ai platform.jobs.submit.prediction)失败\u前提条件:字段:输入\u路径错误:无法读取提供的GCS路径[../test.json]。请确保对象存在,并且您对其具有读取权限。 如果我查一下

cat $TEST_JSON

文件../test.json打开正常。 我不明白哪里出了错


Tags: nametest路径jsonmodel错误jobsjob
1条回答
网友
1楼 · 发布于 2024-05-23 15:52:22

输入路径应为GCS存储桶 按以下方式设置变量

TEST_JSON=gs://$BUCKET_NAME/data/TEST.JSON

从您的描述来看,您似乎正在使用test.json,本地存储

它是输入路径。我试过使用

TEST_JSON=../TEST.JSON

From the doc gcloud ai-platform jobs submit prediction;

input-paths=INPUT_PATH,[INPUT_PATH,…] Google Cloud Storage paths to the instances to run prediction on. Wildcards () accepted at the end of a path. More than one path can be specified if multiple file patterns are needed. For example, gs://my-bucket/instances,gs://my-bucket/other-instances1

相关问题 更多 >