Can't use google-colab
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 383
- Forks
- 93
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Description
While running the following code, I get an error:
import datetime
import os
import tensorflow as tf
import tensorflow_cloud as tfc
import tensorflow_datasets as tfds
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.models import Model
if not tfc.remote():
from google.colab import files
key_upload = files.upload()
key_path = list(key_upload.keys())[0]
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = key_path
os.system(f"gcloud auth activate-service-account --key-file {key_path}")
Details of the error:
$ python3 dogs_classification.py
2021-06-28 12:17:54.852448: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
/home/t/.virtualenvs/tf_cloud/lib/python3.6/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
<IPython.core.display.HTML object>
Traceback (most recent call last):
File "dogs_classification.py", line 24, in <module>
key_upload = files.upload()
File "/home/t/.virtualenvs/tf_cloud/lib/python3.6/site-packages/google/colab/files.py", line 64, in upload
input_id=input_id, output_id=output_id))
File "/home/t/.virtualenvs/tf_cloud/lib/python3.6/site-packages/google/colab/output/_js.py", line 35, in eval_js
kernel = _ipython.get_kernel()
File "/home/t/.virtualenvs/tf_cloud/lib/python3.6/site-packages/google/colab/_ipython.py", line 28, in get_kernel
return get_ipython().kernel
AttributeError: 'InteractiveShell' object has no attribute 'kernel'
I copied the above code from cloud/src/python/tensorflow_cloud/core/tests/examples/dogs_classification.ipynb, and want to run it from dogs_classification.py on my computer.
google-auth-1.32.0
google-colab==1.0.0
tensorflow==2.5.0
tensorflow-cloud==0.1.16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Compare cloud/src/python/tensorflow_cloud/core/tests/examples/dogs_classification.ipynb with dogs_classification.py and reproduce files.upload() using the listed package versions. First establish whether this example is intended to run outside Google Colab; done should be a documented or working execution path that addresses the reported InteractiveShell/kernel error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp, python, tensorflow
- Domain
- cloud, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100