午夜视频在线网站,日韩视频精品在线,中文字幕精品一区二区三区在线,在线播放精品,1024你懂我懂的旧版人,欧美日韩一级黄色片,一区二区三区在线观看视频

分享

Deep Learning Development with Google Colab, Tenso...

 Arthur1668 2018-03-05

By Fuat Be?er, Deep Learning Researcher

Hello! I will show you how to use Google ColabGoogle’s free cloud service for AI developers. With Colab, you can develop deep learning applications on the GPU for free.

 

What is Google Colab?

 
Google Colab is a free cloud service and now it supports free GPU! You can:

  • improve your Python programming language coding skills.
  • develop deep learning applications using popular libraries such as Keras,
    TensorFlow, PyTorch, and OpenCV.

The most important feature that distinguishes Colab from other free cloud services is: Colab provides GPU and is totally free. Detailed information about the service can be found on the faq page.

 

Getting Google Colab Ready to Use

 
Creating Folder on Google Drive

Since Colab is working on your own Google Drive, we first need to specify the folder we’ll work. I created a folder named “app” on my Google Drive. Of course, you can use a different name or choose the default Colab Notebooks folder instead of app folder.


I created an empty “app” folder

Creating New Colab Notebook

Create a new notebook via Right click > More > Colaboratory


Right click > More > Colaboratory

Rename notebook by means of clicking the file name.

 

Setting Free GPU

 
It is so simple to alter default hardware (CPU to GPU or vice versa); just follow Edit > Notebook settings or Runtime>Change runtime type and select GPU as Hardware accelerator.

 

Running Basic Python Codes with Google Colab

 
Now we can start using Google Colab.

I will run some Basic Data Types codes from Python Numpy Tutorial.

It works as expected :) If you do not know Python which is the most popular programming language for AI, I would recommend this simple and clean tutorial.

 

Running or Importing .py Files with Google Colab

 
Run these codes first in order to install the necessary libraries and perform authorization.

!apt-get install -y -qq software-properties-common python-software-properties module-init-tools!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null!apt-get update -qq 2>&1 > /dev/null!apt-get -y install -qq google-drive-ocamlfuse fusefrom google.colab import authauth.authenticate_user()from oauth2client.client import GoogleCredentialscreds = GoogleCredentials.get_application_default()import getpass!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < ev/null="" 2="">&1 | grep URLvcode = getpass.getpass()!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}


When you run the code above, you should see a result like this:

Click the link, copy verification code and paste it to text box.

After completion of the authorization process, mount your Google Drive:

!mkdir -p drive!google-drive-ocamlfuse drive


install Keras:

!pip install -q keras


upload mnist_cnn.py file to app folder which is located on your Google Drive.


mnist_cnn.py file

Run the code below to train a simple convnet on the MNIST dataset.

!python3 drive/app/mnist_cnn.py


As you can see from the results, each epoch lasts only 11 seconds.

 

Download Titanic Dataset (.csv File) and Display First 5 Rows

 
If you want to download .csv file from url to “app” folder, simply run:


You may upload your .csv files directly to “app” folder instead of wget method.

Read .csv file in “app” folder and display first 5 rows:

import pandas as pdtitanic = pd.read_csv(“drive/app/Titanic.csv”)titanic.head(5)


    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多