google-colaboratory

Methods for using Git with Google Colab

五迷三道 提交于 2019-12-31 08:07:06
问题 Are there any recommended methods to integrate git with colab? For example, is it possible to work off code from google source repositories or the likes? Neither google drive nor cloud storage can be used for git functionality. So I was wondering if there is a way to still do it? 回答1: git is installed on the machine, and you can use ! to invoke shell commands. For example, to clone a git repository: !git clone https://github.com/fastai/courses.git Here's a complete example that clones a

Methods for using Git with Google Colab

跟風遠走 提交于 2019-12-31 08:05:13
问题 Are there any recommended methods to integrate git with colab? For example, is it possible to work off code from google source repositories or the likes? Neither google drive nor cloud storage can be used for git functionality. So I was wondering if there is a way to still do it? 回答1: git is installed on the machine, and you can use ! to invoke shell commands. For example, to clone a git repository: !git clone https://github.com/fastai/courses.git Here's a complete example that clones a

ValueError: Operation u'tpu_140462710602256/VarIsInitializedOp' has been marked as not fetchable

萝らか妹 提交于 2019-12-31 02:00:33
问题 The code works fine on GPU and CPU.But when I use keras_to_tpu_model function to make the model able to run on TPU, the error occurred. This is the full output on colab:https://colab.research.google.com/gist/WangHexie/2252beb26f16354cb6e9ba2639970e5b/tpu-error.ipynb Change runtype to TPU,I think this can be reproduced. Code on github:https://github.com/WangHexie/DHNE/blob/master/src/hypergraph_embedding.py#L60 You can test the code on GPU by changing to the gpu branch. Traceback Traceback

Importing .py files in Google Colab

末鹿安然 提交于 2019-12-28 05:15:20
问题 Is there any way to upload my code in .py files and import them in colab code cells? The other way I found is to create a local Jupyter notebook then upload it to Colab, is it the only way? 回答1: You can save it first, then import it. from google.colab import files src = list(files.upload().values())[0] open('mylib.py','wb').write(src) import mylib Update (nov 2018): Now you can upload easily by click at [>] to open the left pane choose file tab click [upload] and choose your [mylib.py] import

How to run a script shell in google Colab?

久未见 提交于 2019-12-25 02:56:08
问题 I want to run a script shell in colab, i used "!" and also i tried "%%shell" 回答1: If you're in a shell, you don't just call a .sh file---you should get the same error in your own terminal. Your shell isn't looking in the current directory for shell commands, so you need to add some path context to your script to let shell know it's an actual runnable program, usually via adding a dot before your script, e.g., use $ . testAllLatin.sh instead of $ testAllLatin.sh Check What's the meaning of a

ImportError: No module named … in Colab google

时光总嘲笑我的痴心妄想 提交于 2019-12-24 21:58:37
问题 I'm following the tutorial here (Object Detection in Google Colab with Custom Dataset). The first line of the notebook is a git clone of the tensorflow models: !git clone --quiet https://github.com/tensorflow/models.git After, they set the PYTHONPATH variable to be sure we can import models. os.environ['PYTHONPATH'] += ':/content/models/research/:/content/models/research/slim/' If I try at this stage to import a model from nets import inception_resnet_v2 I get the error: ImportError: No

Numpy genfromtxt doesn't seem to work when names=True for Python 3

余生长醉 提交于 2019-12-24 21:56:21
问题 I am using the Google Colab enviroment. The file I am using can be found here. It is a csv file https://drive.google.com/open?id=1v7Mm6S8BVtou1iIfobY43LRF8MgGdjfU Warning: it has several million rows. This code runs within a minute in Google Colab Python 3 notebook. I tried this several times with no problem. from numpy import genfromtxt my_data = genfromtxt('DlRefinedRatings.csv', delimiter=',' , dtype=int) print(my_data[0:50]) The code below, on the other hand, runs for several minutes

Submodule import not working on Google Colab

守給你的承諾、 提交于 2019-12-24 20:32:39
问题 I have a package called boo which I install on google colab from a github repository. The installation process looks fine and results in success message Successfully installed boo-0.1 . However import boo fails on first internal import. I replicated the same installation steps in a local virtual environment and package worked, but not on collab. Here are my steps and error trace: !rm -rf sandbox !git clone https://github.com/ru-corporate/sandbox.git !pip install -r sandbox/requirements.txt

wish to use colaboratory. What is simplest way to do a get drive file to python (encapsulated)?

非 Y 不嫁゛ 提交于 2019-12-24 19:53:05
问题 I'm looking for simplification/encapsulation so my existing programs that use (sic) open("my_file.txt") can be ported to colaboratory with the minimum change in the existing logic flow. Happy to have some cut/paste logic before my existing logic. The mental model I understand from google (here) is that I have to do these prerequisites to get my file loaded. upload to google drive download to python (vm, probably in /tmp) And then I can execute my existing code w/o change. Therefore the I

Importing a python module from the python script from drive in colab

浪子不回头ぞ 提交于 2019-12-24 11:34:32
问题 I am currently working on a project on Machine Learning on Google Colab which uses Tensorflow API. I created a folder and uploaded it on google drive to run on google Colab. I successfully mounted the google drive and can run the script, But when I try importing another module from the script present in the same folder, it throws an error from . import inference ImportError: cannot import name 'inference' I tried finding out a solution for this but found results stating how to import a module