rstudio / cloudml

R interface to Google Cloud Machine Learning Engine
https://tensorflow.rstudio.com/tools/cloudml/
65 stars 24 forks source link

keras example mnist_mlp.R with cloudml #209

Open philipus opened 4 years ago

philipus commented 4 years ago

I have got problems (see below) by applying mnist_mlp.R (https://github.com/rstudio/keras/blob/master/vignettes/examples/mnist_mlp.R) using cloudml_train on google cloud platform.

Any Idea what I can do. On my computer the code (mnist_mlp.R) works fine.

R commands:

library(cloudml) cloudml_train("mnist_mlp.R", config = "config.yml")

config.yml:

trainingInput: scaleTier: BASIC runtimeVersion: "2.1" pythonVersion: "3.7"

error message in logs of the google cloud platform:

"Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/root/.local/lib/python3.7/site-packages/cloudml-model/cloudml/deploy.py", line 40, in sys.stdout.write(line) TypeError: write() argument must be str, not bytes "

pzet commented 4 years ago

This issue is resolved in pull request #207. Briefly, this originates from different coding between the default Python 2.7 and 3.X versions and you need to change decoding to "UTF-8" in the deploy.py file to make it work.

philipus commented 4 years ago

Thank you, that worked out for me!