google-colaboratory

WebDriverException: Message: Service /content/chromedriver unexpectedly exited. Status code was: -6 with ChromeDriver Google Colab and Selenium

白昼怎懂夜的黑 提交于 2019-11-28 09:33:40
I was trying to run headless chrome browser using selenium to scrape contents from the web. I installed headless chrome using wget and then unzipped in my current folder. !wget "http://chromedriver.storage.googleapis.com/2.25/chromedriver_linux64.zip" !unzip chromedriver_linux64.zip Now when I am loading the driver from selenium.webdriver.chrome.options import Options import os # instantiate a chrome options object so you can set the size and headless preference chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--window-size=1920x1080") chrome

RuntimeError: size mismatch m1: [a x b], m2: [c x d]

扶醉桌前 提交于 2019-11-28 08:29:27
问题 Can anyone help me in this.? I am getting below error. I use Google Colab. How to Solve this error.? size mismatch, m1: [64 x 100], m2: [784 x 128] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:2070 Below Code I am trying to Run. import torch from torch import nn import torch.nn.functional as F from torchvision import datasets, transforms # Define a transform to normalize the data transform = transforms.Compose([transforms.CenterCrop(10),transforms.ToTensor(),]) # Download the load the

Is it possible to import my own modules into a google-colaboratory notebook?

可紊 提交于 2019-11-28 07:04:05
I am using google colaboratory for teaching Data Science with python and in order to leave the notebooks only with the specific lesson for the students I would like to import some basic methods we have coded instead to give them a big notebook pre-filled with these methods for preventing any distractions. How can I import these methods without publishing them on pip?. Can google-colaborary pip install from github? The best option for us would be to be able to have the code in Drive and an upload the module to colab space like we do with the csv files, and use standard import. Is that possible?

Importing .py files in Google Colab

烂漫一生 提交于 2019-11-28 06:46:10
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? 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 mylib You can upload local files to google colab by using upload() function in google.colab.files If you

read csv to dataframe in google colab

一个人想着一个人 提交于 2019-11-28 05:26:05
I am trying to read a csv file which I stored locally on my machine. (Just for additional reference it is titanic data from Kaggle which is here .) From this question and answers I learnt that you can import data using this code which works well from me. from google.colab import files uploaded = files.upload() Where I am lost is how to convert it to dataframe from here. The sample google notebook page listed in the answer above does not talk about it. I am trying to convert the dictionary uploaded to dataframe using from_dict command but not able to make it work. There is some discussion on

How to import and read a shelve or Numpy file in Google Colaboratory?

瘦欲@ 提交于 2019-11-27 20:49:15
I have file.npy and I want to load it in Google Colaboratory Notebook. I already know that I must load the file from Google Drive, however I have no idea how to do so. Any help is welcome Upload your file into Colaboratory Notebook with the following: from google.colab import files uploaded = files.upload() Then you can reach the contents of your file from uploaded object and then write it into a file: with open("my_data.h5", 'w') as f: f.write(uploaded[uploaded.keys()[0]]) If you run: !ls you will see my_data.h5 file in the current directory. This is the method that worked for me. Hope it

Load local data files to Colaboratory

非 Y 不嫁゛ 提交于 2019-11-27 18:02:38
I just wondering that is it possible to load local data files(like .xlsx or .csv files that on my google drive) into Colaboratory? I was a bit confused by the example for loading local files on first glance as there was no place to specify a file path. All you need to do is copy and paste the recipe to figure this out, but to be clear: from google.colab import files uploaded = files.upload() will open an upload dialogue window where you can browse and select your local files for upload. Then for fn in uploaded.keys(): print('User uploaded file "{name}" with length {length} bytes'.format( name

How to download file created in Colaboratory workspace?

混江龙づ霸主 提交于 2019-11-27 12:03:28
问题 I found many hints how to upload data into Colaboratory. But now I want to do opposite -> I want to download .csv I've created in Colaboratory workspace. How to do this? 回答1: Save it to google drive use Pydrive # Install the PyDrive wrapper & import libraries. # This only needs to be done once in a notebook. !pip install -U -q PyDrive from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials #

Google Colaboratory: misleading information about its GPU (only 5% RAM available to some users)

你。 提交于 2019-11-27 08:57:12
问题 update: this question is related to Google Colab's "Notebook settings: Hardware accelerator: GPU". This question was written before the "TPU" option was added. Reading multiple excited announcements about Google Colaboratory providing free Tesla K80 GPU, I tried to run fast.ai lesson on it for it to never complete - quickly running out of memory. I started investigating of why. The bottom line is that “free Tesla K80” is not "free" for all - for some only a small slice of it is "free". I

Rendering LaTeX in output cells in Colaboratory

心不动则不痛 提交于 2019-11-27 07:12:32
问题 I expect a cell like from IPython.display import display, Math display(Math(r"e^\alpha")) to render with MathJax as it does in normal jupyter, but instead it just displays latex code like: $$e^\alpha$$ Is there a way to get Colaboratory to render it correctly? (It manages it fine for text cells). 回答1: Simplify scraaappy's answer a bit. from IPython.display import HTML, Math display(HTML("<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/" "latest.js?config=default'></script>")