4

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.

Maxim
  • 4,075
  • 1
  • 14
  • 23
hoss24
  • 556
  • 9
  • 22
  • 1
    Are you running this command from the `cloudml-samples-master/census/estimator` directory? – Dustin Ingram Nov 19 '18 at 16:44
  • I am running it on my computer from directory that includes the data and output folders. The tutorial seemed to specify downloading and running from the estimator directory in the cloud shell only, but perhaps I am misunderstanding. – hoss24 Nov 19 '18 at 16:57
  • 1
    You might have missed the "[Download the code for this tutorial](https://cloud.google.com/ml-engine/docs/tensorflow/getting-started-training-prediction#download_the_code_for_this_tutorial)" step. You should have a `trainer` directory that is local to where you are executing the `gcloud` command. – Dustin Ingram Nov 19 '18 at 17:05
  • That is the step I thought was only supposed to happen in the cloud shell but will try it locally as well, thanks. – hoss24 Nov 19 '18 at 17:11
  • 1
    It's not entirely clear, but the tutorial is assuming you're either doing this locally on your machine, or in Cloud Shell, not a mix of the two. – Dustin Ingram Nov 19 '18 at 17:15

1 Answers1

0

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
hoss24
  • 556
  • 9
  • 22