GoogleCloudPlatform / cloudml-samples

Cloud ML Engine repo. Please visit the new Vertex AI samples repo at https://github.com/GoogleCloudPlatform/vertex-ai-samples
https://cloud.google.com/ai-platform/docs/
Apache License 2.0
1.52k stars 857 forks source link

census/estimator/trainer/task.py : 'module' object has no attribute 'logging' #461

Closed t4r4d4ctyl closed 4 years ago

t4r4d4ctyl commented 4 years ago

Description Seeing an issue when running a command in relation to this file: cloudml-samples/census/estimator/trainer/task.py

I think this must have to do with the update on this file six months ago, as I can see that a reference to "logging" was removed, but I don't know for sure.

The reason I'm attempting this is because of a Linux Academy course for the GCP Data Engineer certification. The course attempts to use this repo for interactive demos.

Environment GCP Cloud Shell Environment tensorflow==2.0.0 tensorflow-estimator==2.0.1 Python 2.7.13 (default, Sep 26 2018, 18:42:22)

Command gcloud ai-platform local train --job-dir $MODEL_DIR --module-name trainer.task --package-path train -- --train-files $TRAIN_DATA --eval-files $EVAL_DATA --train-steps 1000 --eval-steps 100

Logs Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main\ "__main__", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/<user>/cloudml-samples/census/estimator/trainer/task.py", line 189, in <module> tf.logging.set_verbosity(ARGUMENTS.verbosity) AttributeError: 'module' object has no attribute 'logging'

gogasca commented 4 years ago

You are using TF 2.x, since those samples are meant to run for Cloud AI platform which supports now 1.15 and only 2.X with custom containers, you need to modify the sample. PTAL at: https://github.com/tensorflow/tensorflow/issues/26662