google-colaboratory

How use TPU in google colab

孤人 提交于 2020-01-22 05:51:45
问题 Google colab brings TPUs in the Runtime Accelerator. I found an example, How to use TPU in Official Tensorflow github. But the example not worked on google-colaboratory. It stuck on following line: tf.contrib.tpu.keras_to_tpu_model(model, strategy=strategy) When I print available devices on colab it return [] for TPU accelerator. Does anyone knows how to use TPU on colab? 回答1: Here's a Colab-specific TPU example: https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab

How can I download a pandas Dataframe in Google Colab?

微笑、不失礼 提交于 2020-01-21 04:39:25
问题 I have been stuck on how to download a pandas DataFrame into my local disk (or onto Google Drive) after creating it in Google Colab. I have tried converting it to bytes, a string (using pd.to_string), a dict (pd.to_dict), but nothing seems to work. Additionally, I've looked at using the drive.CreateFile method as explained in the intro Colab Code and as specified here: How to download file created in Colaboratory workspace?, but I'm not sure how to apply this to pandas. Any help is

Querying SQLite database file in Google Colab

孤街醉人 提交于 2020-01-16 19:47:29
问题 print ('Files in Drive:') !ls drive/AI Files in Drive: database.sqlite Reviews.csv Untitled0.ipynb fine_food_reviews.ipynb Titanic.csv When I run the above code in Google Colab, clearly my sqlite file is present in my drive. But whenever I run some query on this file, it says # using the SQLite Table to read data. con = sqlite3.connect('database.sqlite') #filtering only positive and negative reviews i.e. # not taking into consideration those reviews with Score=3 filtered_data = pd.read_sql

How to 3d visualize output layers during training phase

邮差的信 提交于 2020-01-16 08:43:29
问题 My final goal is to find a way to 3d visualize all layers during the training something like tensorSpace but real time during the training phase . I am using tensorflow and google colab. I managed to get each output like a tensor by creating a custom callback and creating this method def on_train_batch_end(self, batch, logs=None): for i in range(len(model_inception.layers)): get_layer_output = K.function(inputs = self.model.layers[i].input, outputs = self.model.layers[i].output) print('\n

Google Colab: Disk size with GPU backend

我与影子孤独终老i 提交于 2020-01-16 08:19:12
问题 I've been using Google Colab with the GPU backend. On December when I used it, the disk size for the GPU backend was more than 300 GB. Now running df -h on the virtual machine shows this: Filesystem Size Used Avail Use% Mounted on overlay 69G 33G 33G 50% / tmpfs 64M 0 64M 0% /dev tmpfs 6.4G 0 6.4G 0% /sys/fs/cgroup /dev/sda1 75G 37G 39G 49% /opt/bin tmpfs 6.4G 12K 6.4G 1% /var/colab shm 5.9G 4.0K 5.9G 1% /dev/shm tmpfs 6.4G 0 6.4G 0% /proc/acpi tmpfs 6.4G 0 6.4G 0% /proc/scsi tmpfs 6.4G 0 6

Convert curl command from google-colab to python script

ぃ、小莉子 提交于 2020-01-15 03:41:33
问题 I have the following google colab code: code : !wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip !unzip ngrok-stable-linux-amd64.zip LOG_DIR = './log' get_ipython().system_raw( 'tensorboard --logdir {} --host 0.0.0.0 --port 6006 &' .format(LOG_DIR) ) get_ipython().system_raw('./ngrok http 6006 &') ! curl -s http://localhost:4040/api/tunnels | python3 -c \ "import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])" output: https://6a112ff8.ngrok.io My

How to upgrade tensorflow with GPU on google colaboratory

血红的双手。 提交于 2020-01-13 07:00:08
问题 Currently google colaboratory uses tensorflow 1.4.1. I want to upgrade it to 1.5.0 version. Each time when i executed !pip install --upgrade tensorflow command, notebook instance succesfully upgrades the tensorflow version to 1.5.0. But after upgrade operation tensorflow instance only supports "CPU". When i have executed this command it shows nothing : from tensorflow.python.client import device_lib device_lib.list_local_devices() Should there be another way for upgrading tensorflow ? such as

How to install models/download packages on Google Colab?

丶灬走出姿态 提交于 2020-01-13 05:13:59
问题 I am using text analytics library "Spacy". I've installed spacy on Google Colab notebook without any issue. But for using it I need to download "en" model. Generally, that command should look like this: python -m spacy download en I tried few ways but I am not able to get it to install on the notebook. Looking for help. Cheers 回答1: If you have a Python interpreter but not a teriminal, you could try: import spacy.cli spacy.cli.download("en_core_web_sm") More manual alternatives can be found

How to downgrade tensorflow version in colab?

不问归期 提交于 2020-01-13 04:30:10
问题 I am using pip3 install tensorflow==1.8.0 , but it doesn't have GPU support. So I am using pip3 install tensorflow-gpu==1.8.0 , but it still raises an exception libcudart.so.VERSION No such file. Should I use colab to install tensorflow from source? After pip3 list : tensorboard 1.10.0 tensorflow 1.10.0 tensorflow-hub 0.1.1 回答1: You can downgrade Tensorflow to a previous version without GPU support on Google Colab. I ran: !pip install tensorflow==1.12.0 import tensorflow as tf print(tf._

How to increase Google Colab storage

末鹿安然 提交于 2020-01-12 16:51:14
问题 I am working on a Dataset of 70gb Earlier using df -BG command I was being shown Filesystem 1G-blocks Used Available Use% Mounted on overlay 359G 6G 335G 2% / tmpfs 7G 0G 7G 0% /dev tmpfs 7G 0G 7G 0% /sys/fs/cgroup /dev/root 2G 1G 1G 44% /opt/bin tmpfs 7G 1G 7G 4% /usr/lib64-nvidia /dev/sda1 365G 8G 358G 3% /etc/hosts shm 1G 0G 1G 0% /dev/shm tmpfs 7G 0G 7G 0% /sys/firmware Suddenly Now it has changed to Filesystem 1G-blocks Used Available Use% Mounted on overlay 40G 5G 33G 14% / tmpfs 7G 0G