简体   繁体   中英

No module named trainer, Cloud ML Engine for TensorFlow Tutorial, Running Locally

Tutorial I am following

Have been attempting to follow the Google tutorial to use ML Engine for TensorFlow. Have gotten stuck where it says "run a local training job" with the error

/usr/bin/python: No module named trainer

Full command is:

gcloud ml-engine local train \
    --module-name trainer.task \
    --package-path trainer/ \
    --job-dir $MODEL_DIR \
    -- \
    --train-files $TRAIN_DATA \
    --eval-files $EVAL_DATA \
    --train-steps 1000 \
    --eval-steps 100

The three variables are all set up correctly to my knowledge though it doesn't even get to them right now. The tutorial doesn't specify downloading a trainer file or how it is referenced, googling for the past hour hasn't turned up any working solutions. Have found this general explanation:

--module-name specifies the name of your application's main module, using your package's namespace dot notation. This is the Python file that you run to start your application. For example, if your main module is .../my_application/trainer/task.py (see the recommended project structure), then the module name is trainer.task

Any info would be appreciated.

Thanks to the information from Dustin in the comments have found the solution.

Was simply downloading the trainer directory on the Cloud Shell and not my local environment.

Now File Structure Looks Like:

estimator
    |-- data
    |   |-- adult_data.csv
    |   |-- adult_test.csv
    |-- output
    |-- trainer
    |   |-- __init__.py
    |   |-- model.py
    |   |-- task.ipynb
    |   |-- task.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM