google-colaboratory

Colab - automatic authentication of connection to google drive

喜你入骨 提交于 2020-02-12 12:28:35
问题 I'm looking for a way to automate the authentication process when connecting a colab-session to my google drive. I'd prefer to use the built-in tools for this one, instead of PyDrive. In short: have the following cell run without having to manually authenticate by logging in and copying the password from the dialogue from google.colab import drive drive.mount('/content/drive/') 回答1: Automatically mounting to your Drive files is now supported for Colab notebooks which aren't shared by multiple

Huggingface Bert TPU fine-tuning works on Colab but not in GCP

拟墨画扇 提交于 2020-02-06 07:55:10
问题 I'm trying to fine-tune a Huggingface transformers BERT model on TPU. It works in Colab but fails when I switch to a paid TPU on GCP. Jupyter notebook code is as follows: [1] model = transformers.TFBertModel.from_pretrained('bert-large-uncased-whole-word-masking-finetuned-squad') # works [2] cluster_resolver = tf.distribute.cluster_resolver.TPUClusterResolver( tpu='[My TPU]', zone='us-central1-a', project='[My Project]' ) tf.config.experimental_connect_to_cluster(cluster_resolver) tf.tpu

Deep learnin on Google Colab: loading large image dataset is very long, how to accelerate the process?

前提是你 提交于 2020-02-03 01:51:05
问题 I'm working on a Deep Learning model using Keras and to speed up the computation I'd like to use the GPU available on google colab. My image files are already loaded on my google drive. I have 24'000 images for training on 4'000 for testing my model. However when I load my images into an array, it takes a very long time (almost 2h) So it is not very convenient to do that every time I use google colab notebook. Would you know how to accelerate the process ? This is my current code: TRAIN_DIR =

Failed installing pyaudio on Google Colab with “ERROR: Failed building wheel for pyaudio”

六月ゝ 毕业季﹏ 提交于 2020-01-25 10:31:35
问题 Trying to install pyaudio on Google Colab but got an error "ERROR: Failed building wheel for pyaudio". !apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools !pip install pyaudio I got this error: Collecting pyaudio Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Building wheels for collected packages: pyaudio Building wheel for pyaudio (setup.py) ... error

How do I import a csv file into Google Colab that uses R kernel?

老子叫甜甜 提交于 2020-01-25 07:05:12
问题 I have a csv on my computer that I can upload to Google Drive. I am trying to use a Google colab but in R and not Python. How can I import this csv? 回答1: https://stackoverflow.com/a/57927212/5333248 Here a workaround for you. Lateral arrow on top-left of the screen >> files >> upload. In this way you can upload the .csv file from your pc. There's even a Mount Drive option in the same path, but as I understand is only for python. The file last only for the current session. You'll need to re

Upload File From Colab to Google Drive Folder

随声附和 提交于 2020-01-24 21:29:07
问题 I want to upload a file from colab to a specific folder in my google drive. I can get the folder by using the folder id and below snippet: my_folder = drive.ListFile( {'q': "'1QYaM1vaUvdzbdsfWbsolncz1xc2pgnpextuP' in parents"}).GetList() But my question: how do I upload a file(image) to this folder? Is there a function such as my_folder.upload(my_file)? So far I have seen some examples with zip files but I do not want to upload it as a zip file. 回答1: I take from this answer fid =

Best way to import data in google-colaboratory for fast computing and training?

元气小坏坏 提交于 2020-01-24 12:54:06
问题 I am running a simple deep learning model on Google's colab, but it's running slower than my MacBook Air with no GPU. I read this question and found out it's a problem because of dataset importing over the internet, but I am unable to figure out how to speed up this process. My model can be found here. Any idea of how I can make the epoch faster? My local machine takes 0.5-0.6 seconds per epoch and google-colabs takes 3-4 seconds 回答1: Is GPU always faster than CPU? No, why? because the speed

How to import python files in google colaboratory?

为君一笑 提交于 2020-01-23 07:43:09
问题 I am trying to run my program on Google Colab; where my code make use of .py files written seprately. In normal system I have all files inside one folder and it works using import xyz , but when I tried using same folder in Google drive it gives import error. 回答1: If you have just 2-3 files, you can try the solution I gave in another question here. Importing .py files in Google Colab But if you have something like 5-10 files, I would suggest you put your library on github, then !git clone it

How to build libraries via conda on colab.research?

泄露秘密 提交于 2020-01-22 12:20:10
问题 So I want to use python-occ library. It requires conda-forge to be build. I try to install it in basic notebook !wget -c https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh !chmod +x Anaconda3-5.1.0-Linux-x86_64.sh !bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -f -p=conda3 !export PYTHONPATH=./conda3/lib/python !export PATH=./conda3/bin/:$PATH !conda install -y -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core Yet it will install a package into condas python. How to make

In Google's Colab notebook, How do I call a function from a Python file?

烈酒焚心 提交于 2020-01-22 07:08:57
问题 From a Colab notebook, I would like to call a python function that I wrote in a separate python file. How do I do that? 回答1: Edit : If you would like to import a local module, you'll want to edit your sys.path to point to that new directory. Here's an example notebook: https://colab.research.google.com/notebook#fileId=1PtYW0hZit-B9y4PL978kV2ppJJPhjQua Original reply : Sure, here's an example notebook: https://colab.research.google.com/notebook#fileId=1KBrq8aAiy8vYIIUiTb5UHG9GKOdEMF3n There