google-colaboratory

Update keras.json on Google Colab

你离开我真会死。 提交于 2019-12-06 06:38:40
I tried to update keras.json on Google Colabs, but its throwing UnsupportedOperation error Is there any other alternative to achieve this? You're opening the file as readonly -- pass 'w' to the open call on line 9. ( docs ) 来源: https://stackoverflow.com/questions/50083075/update-keras-json-on-google-colab

How to use Flask in Google Colaboratory Python Notebook?

夙愿已清 提交于 2019-12-06 04:08:20
问题 I am trying to build a website using Flask, in a Google Colab Python notebook. However, running a regular Flask code that works on a regular Python, fails to work on Google Colab. I need code that will work it out please.. :) 回答1: the server code: import socket print(socket.gethostbyname(socket.getfqdn(socket.gethostname()))) from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" import threading threading.Thread(target=app.run, kwargs={'host':'0.0.0

How to download large files (like weights of a model) from Colaboratory?

痞子三分冷 提交于 2019-12-05 23:22:19
I have tried downloading small files from google Colaboratory. They are easily downloaded but whenever I try to download files which have a large sizes it shows an error? What is the way to download large files? This is how I handle this issue: from google.colab import auth from googleapiclient.http import MediaFileUpload from googleapiclient.discovery import build auth.authenticate_user() Then click on the link, authorize Google Drive and paste the code in the notebook. drive_service = build('drive', 'v3') def save_file_to_drive(name, path): file_metadata = { 'name': name, 'mimeType':

How to resolve: ModuleNotFoundError: No module named 'google.colab'

孤街醉人 提交于 2019-12-05 21:36:48
I want to run the command: from google.colab import auth But I am getting this error: ModuleNotFoundError: No module named 'google.colab' This is required for accessing files on google drive from python. There is a package google but not module colab in it. How to resolve this error? AFAIK, you can execute the module 'google.colab' from within colab.research.google.com Looking at the tag conda in your question. I assume that you are running the code from your local machine. Please make use of PyDrive to read from google drive on your local machine. References: Google Colaboratory FAQ PyDrive

Unable to import module in Google Colab after installing

给你一囗甜甜゛ 提交于 2019-12-05 18:31:01
I was trying to clone and install the Google Unrestricted adversarial examples repository following the instructions provided here . But I am unable to import the any of the modules. First I cloned the repository and changed to that directory. !git clone https://github.com/google/unrestricted-adversarial-examples.git cd unrestricted-adversarial-examples Then I used the pip install command. !pip -e install bird-or-bicycle The installation completed without any error. However, when I try to import I get the 'module not found error'. Could anyone tell me what I am doing wrong? I tried the same

How to use Tensorboard in Colaboratory

吃可爱长大的小学妹 提交于 2019-12-05 14:37:39
Is it possible to use Tensorboard in Colaboratory. Running tensorboard locally shows rich information about model behaviour like loss etc..is it possible get same information when working with Colaboratory( https://colab.research.google.com ). You have two options you can use one of the python programs that allows you to tunnel to the machine instance that is hosting your python app. I tested this one: https://github.com/taomanwai/tensorboardcolab !pip install -U tensorboardcolab from tensorboardcolab import * import shutil #clean out the directory shutil.rmtree('./Graph', ignore_errors=True)

Keras TPU. Compilation failure: Detected unsupported operations

删除回忆录丶 提交于 2019-12-05 09:49:29
I try to run my keras UNet model using Google Colab TPU and I faced this problem with UpSampling2D . Any solutions or workaround? Code to run: import os import numpy as np import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import UpSampling2D model = Sequential() model.add(UpSampling2D((2, 2), input_shape=(16, 16, 1))) model.compile(optimizer=tf.train.RMSPropOptimizer(learning_rate=0.01), loss='binary_crossentropy', metrics=['acc']) TPU_WORKER = 'grpc://' + os.environ['COLAB_TPU_ADDR'] tf.logging.set_verbosity(tf.logging.INFO) model = tf.contrib

The new Form feature in Google Colaboratory

感情迁移 提交于 2019-12-05 09:21:47
Can someone explain or give a notebook example how to use the new Form feature? It looks really exciting, but I cannot find any example or even an announcement anywhere. Now there is an official example here: https://colab.research.google.com/notebooks/forms.ipynb Exciting feature indeed. It seems we can use checkboxes and date fields: boolean_checkbox = True #@param {type:"boolean"} date_input = '2018-03-22' #@param {type:"date"} but I would really love to be able to construct dropdown lists using existing variables. Currently this seems limited: dropdown = '1st option' #@param ["1st option",

openAI Gym NameError in Google Colaboratory

别说谁变了你拦得住时间么 提交于 2019-12-05 05:45:35
I've just installed openAI gym on Google Colab, but when I try to run 'CartPole-v0' environment as explained here . Code: import gym env = gym.make('CartPole-v0') for i_episode in range(20): observation = env.reset() for t in range(100): env.render() print(observation) action = env.action_space.sample() observation, reward, done, info = env.step(action) if done: print("Episode finished after {} timesteps".format(t+1)) break I get this: WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype. -------------------------------------------------------------

How to insert an inline image in Google Colaboratory from Google Drive

大憨熊 提交于 2019-12-05 05:26:55
I am trying to insert an image in Google Colaboratory (markdown) already saved in Google Drive using this expression ![Text](https://xxxx) but it doesn't work. For example, the Colaboratory markdown manual shows how to insert a photo inline with this example An inline image: ![Google's logo](https://www.google.com/images/logos/google_logo_41.png) . Ok, that is a photo from internet, but, when I replace that photo for one already saved in my Google Drive it doesn't appear. According to the answers here ![](https://drive.google.com/uc?export=view&id=XXX) Shaswat Lenka I tried all the answers