google-colaboratory

Mounting google drive on google Colab

自古美人都是妖i 提交于 2019-12-12 20:55:14
问题 I followed the steps given in this Medium tutorial on google colab and then tried to clone a git repository but I cannot see the repository anywhere in my drive. The following image is the code snippet I used which is exactly the same as that from the Medium tutorial: 回答1: To mount google drive on google Colab just use these commands: from google.colab import drive drive.mount('/content/drive') It would need an authentication process. Do whatever it needs (open the link and copy the key) Now

Loading local data google colab

久未见 提交于 2019-12-12 19:37:45
问题 I have a npy file, (largeFIle.npy) saved in the same "colab notebooks" folder on my google drive that I have my google colab notebook saved in. I'm trying to load the data into my notebook with the code below but I'm getting the error below. This code works fine when I run it locally on my laptop with the notebook in the same folder as the file. Is there something different I need to do when loading data with notebooks in google colab? I'm very new to colab. code: dataset_name = 'largeFIle

Custom fonts in Google Colaboratory matplotlib charts

可紊 提交于 2019-12-12 18:08:33
问题 Using custom fonts in matplotlib locally involves storing the .ttf s in the matplotlib/mpl-data/fonts/ttf/ folder, then calling mpl.font_manager._rebuild() , then setting mpl.rcParams['font.sans-serif'] . Is there any way to do this in Google Colaboratory, where it doesn't seem that this ttf folder is accessible? For example, I'd like to use the Roboto font. After installing, this would be invoked using mpl.rcParams['font.sans-serif'] = 'Roboto' . 回答1: The ttf folder is here: /usr/local/lib

LaTeX equations do not render in google Colaboratory when using matplotlib

让人想犯罪 __ 提交于 2019-12-12 00:49:48
问题 If I take the official example containing latex from the matplotlib website: from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True) import numpy as np import matplotlib.pyplot as plt # Example data t = np.arange(0.0, 1.0 + 0.01, 0.01) s = np.cos(4 * np.pi * t) + 2 plt.rc('text', usetex=True) plt.rc('font', family='serif') plt.plot(t, s) plt.xlabel(r'\textbf{time} (s)') plt.ylabel(r'\textit{voltage} (mV)',fontsize=16) plt.title(r"\TeX\

Simple TensorFlow computation not reproducible on different systems (macOS, Colab, Azure)

纵然是瞬间 提交于 2019-12-11 19:49:18
问题 I am investigating the reproducibility of code in TensorFlow on my macOS machine, on Google Colab, and on Azure with Docker. I understand that I can set a graph-level seed and an operation-level seed. I am using eager mode (so no parallelism optimization) and no GPUs. I use 100x100 random draws from the unit normal and calculate their mean and standard deviation. The test code below verifies that I am not using the GPU, that I am using Tensorflow 1.12.0 or the preview of TensorFlow 2, that

Google Colab can't access drive content

断了今生、忘了曾经 提交于 2019-12-11 18:44:10
问题 Even though I defined my Google Drive(and my dataset in it) to google colab but when I run my code I give this error:FileNotFoundError: [Errno 2] No such file or directory: 'content/drive/My Drive/.... I already defined google drive in google colab and I can access to it through google colab but when I run my code I give this error from keras.models import Sequential from keras.layers import Convolution2D from keras.layers import MaxPooling2D from keras.layers import Flatten from keras.layers

keras kernel initializers are called incorrectly when using load_model

我的未来我决定 提交于 2019-12-11 18:35:37
问题 Keras version 2.2.4, tensorflow version 1.13.1, I'm using colab notebooks I'm trying to make a custom initializer and save the model using model.save() but when I load the model again I get the following error: TypeError: myInit() missing 1 required positional argument: 'input_shape' I have the following code: import numpy as np import tensorflow as tf import keras from google.colab import drive from keras.models import Sequential, load_model from keras.layers import Dense, Dropout, Flatten,

Refresh results in Google Colaboratory as the page loads

假如想象 提交于 2019-12-11 18:25:43
问题 I am working on google colab as it a part of my school project. But I got stuck on a problem. So, I wanted some one to help me out. I want that every time the page is refreshed, a new random number generated using python gets shown up in the output area (in the image it has number 1). I am able to run a javascript code as soon as the page loads. But I don't know how to simulate a click on the run icon. So, if someone knows how to simulate click on that run button (it's actually not a button,

Zoom and have cursor for a matplotlib plot within iPython

半城伤御伤魂 提交于 2019-12-11 16:37:37
问题 Within Google-colaboratory, I cannot use matplotlib. use(TkAgg) . The possibility that it offers to me is though very helpful: I can zoom in my plot interactively and also get a cursor that shows me the present values of x and y where my mouse is hovering over. Is there anything similar within iPython / Jupyter that has a similar functionality? 回答1: With these snippet, both zooming and the hovered mouse x/y cursor works in google colab: !pip install mpld3 !pip install "git+https://github.com

How to remove folder on GitHub using Coab?

北城余情 提交于 2019-12-11 15:33:50
问题 I clone my repo where I have some folders and files: !git clone https://{username}:{password}@github.com/{username}/{project}.git then I change current directory: %cd {project} remove a folder: !rm -rf "/content/{project}/sample_data" check status: !git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)