使用 ML Engine 和 GCloud 在本地进行训练
Training locally with ML Engine & GCloud
我想使用此命令在本地训练我的模型:
gcloud ml-engine local train
--module-name cloud_runner
--job-dir ./tmp/output
问题是它抱怨 --job-dir: Must be of form gs://bucket/object
。
这是一列本地火车,所以我想知道为什么它希望输出是一个 gs
存储桶而不是本地目录。
The --package-path argument to the gcloud command should point to a directory that is a valid Python package, i.e., a directory that contains an init.py file (often an empty file). Note that it should be a local directory, not one on GCS.
The --module argument will be the fully qualified name of a valid Python module within that package. You can organize your directories however you want, but for the sake of consistency, the samples all have a Python package named trainer with the module to be run named task.py.
--
因此您需要使用有效路径更改此块:
gcloud ml-engine local train
--module-name cloud_runner
--job-dir ./tmp/output
具体来说,您的错误是由于 --job-dir ./tmp/output
造成的,因为它需要您的 gcloud
上的路径
本地培训试图模拟当您 运行 使用云时发生的情况,因为本地培训的重点是在将您的工作提交给服务之前检测问题。
在使用 CMLE 服务时使用本地作业目录是错误的,因为作业完成后输出不会持续存在。
所以使用 gcloud 进行本地训练也需要 job-dir 是 GCS 位置。
如果您想 运行 在本地而不使用 GCS,您可以直接 运行 您的 TensorFlow 程序而不使用 gcloud。
正如其他人所解释的那样 gcloud --job-dir 期望该位置在 GCS 中。要解决这个问题,您可以将其作为文件夹直接传递给您的模块。
gcloud ml-engine local train \
--package-path trainer \
--module-name trainer.task \
-- \
--train-files $TRAIN_FILE \
--eval-files $EVAL_FILE \
--job-dir $JOB_DIR \
--train-steps $TRAIN_STEPS
我想使用此命令在本地训练我的模型:
gcloud ml-engine local train
--module-name cloud_runner
--job-dir ./tmp/output
问题是它抱怨 --job-dir: Must be of form gs://bucket/object
。
这是一列本地火车,所以我想知道为什么它希望输出是一个 gs
存储桶而不是本地目录。
The --package-path argument to the gcloud command should point to a directory that is a valid Python package, i.e., a directory that contains an init.py file (often an empty file). Note that it should be a local directory, not one on GCS.
The --module argument will be the fully qualified name of a valid Python module within that package. You can organize your directories however you want, but for the sake of consistency, the samples all have a Python package named trainer with the module to be run named task.py.
--
因此您需要使用有效路径更改此块:
gcloud ml-engine local train
--module-name cloud_runner
--job-dir ./tmp/output
具体来说,您的错误是由于 --job-dir ./tmp/output
造成的,因为它需要您的 gcloud
本地培训试图模拟当您 运行 使用云时发生的情况,因为本地培训的重点是在将您的工作提交给服务之前检测问题。
在使用 CMLE 服务时使用本地作业目录是错误的,因为作业完成后输出不会持续存在。
所以使用 gcloud 进行本地训练也需要 job-dir 是 GCS 位置。
如果您想 运行 在本地而不使用 GCS,您可以直接 运行 您的 TensorFlow 程序而不使用 gcloud。
正如其他人所解释的那样 gcloud --job-dir 期望该位置在 GCS 中。要解决这个问题,您可以将其作为文件夹直接传递给您的模块。
gcloud ml-engine local train \
--package-path trainer \
--module-name trainer.task \
-- \
--train-files $TRAIN_FILE \
--eval-files $EVAL_FILE \
--job-dir $JOB_DIR \
--train-steps $TRAIN_STEPS