在内置图像对象检测分类器的官方GCP文档中,"提交培训作业"下的步骤2说:
提交作业:
云ai平台作业提交培训$JOB_ID\
--region=$region\
--config=config.yaml\…
这是本页上第一次引用"config.yaml"。
有人能够实现这个例子吗?
以下是上面文档页面的完整代码,包括第2行的更正(原始文档的JOB_DIR以gs://gs://开头,这引发了一个错误(:
PROJECT_ID="myapp"
# Original:
#BUCKET_NAME="gs://mybucket/"
# Correction:
BUCKET_NAME="mybucket"
REGION="us-central1"
gcloud config set project $PROJECT_ID
gcloud config set compute/region $REGION
# Set paths to the training and validation data.
TRAINING_DATA_PATH="gs://cloud-samples-data/ai-platform/built-in/image/coco/train*"
VALIDATION_DATA_PATH="gs://cloud-samples-data/ai-platform/built-in/image/coco/val*"
# Specify the Docker container for your built-in algorithm selection.
IMAGE_URI="gcr.io/cloud-ml-algos/image_object_detection:latest"
DATASET_NAME="coco"
ALGORITHM="object_detection"
MODEL_NAME="${DATASET_NAME}_${ALGORITHM}_model"
# Give a unique name to your training job.
DATE="$(date '+%Y%m%d_%H%M%S')"
JOB_ID="${MODEL_NAME}_${DATE}"
# Make sure you have access to this Cloud Storage bucket.
JOB_DIR="gs://${BUCKET_NAME}/algorithms_training/${MODEL_NAME}/${DATE}"
gcloud ai-platform jobs submit training $JOB_ID
--region=$REGION
--config=config.yaml
--job-dir=$JOB_DIR
--
--training_data_path=$TRAINING_DATA_PATH
--validation_data_path=$VALIDATION_DATA_PATH
--train_batch_size=64
--num_eval_images=500
--train_steps_per_eval=2000
--max_steps=15000
--num_classes=90
--warmup_steps=500
--initial_learning_rate=0.08
--fpn_type="nasfpn"
--aug_scale_min=0.8
--aug_scale_max=1.2
gcloud ai-platform jobs describe $JOB_ID
gcloud ai-platform jobs stream-logs $JOB_ID
运行以上操作会导致以下错误:
ERROR: (gcloud.ai-platform.jobs.submit.training) Failed to load YAML from [config.yaml]: Unable to read file [config.yaml]: [Errno 2] No such file or directory: u'config.yaml'
创建一个空的config.yaml会产生以下错误:
ERROR: gcloud crashed (AttributeError): 'NoneType' object has no attribute 'get'
来自gcloud文档:
作业配置文件的路径。此文件应为YAML包含中定义的作业资源的文档(也接受JSON(API(所有字段都是可选的(:https://cloud.google.com/ml/reference/rest/v1/projects.jobs
我几周前在这个页面上提交了反馈,但没有收到回复,它仍然被破坏了。
config.yaml中需要什么内容才能实现这一点?
欢迎任何想法/建议!
我通过替换以下命令行参数使其正常工作:
--config=config.yaml
有了这个:
--master-image-uri $IMAGE_URI