Search code examples
google-cloud-platformgoogle-cloud-mlgcp-ai-platform-notebook

Google Cloud Platform submit training job, how to read USER_ARGS from training code?


I am submitting a training job on google cloud platform using

gcloud ai-platform jobs submit training $JOB_NAME
               --scale-tier basic
               --package-path $TRAINING_PACKAGE_PATH
               --module-name $MAIN_TRAINER_MODULE
               --job-dir $JOB_DIR
               --runtime-version $RUNTIME_VERSION
               --python-version $PYTHON_VERSION
               --region $REGION

My training code looks somehow like the one in the online tutorial cloudml-samples. From Packaging a Training Application guide, I saw you can pass parameters to the training job by adding

-- \
--user_first_arg=first_arg_value \
--user_second_arg=second_arg_value

But anywhere I could find how to read the params from the training code. Any suggestions? thanks


Solution

  • Please take a look at this new repo.

    You have task.py which reads parameters from gcloud command

    which pass the inputs to model.py which exists in this file.