[PYTHON] [For beginners] How to implement O'reilly sample code in Google Colab

Implemented sample code in Google Colab

In O'Reilly "Deep Learning from scratch ~ The theory and implementation of deep learning learned with Python ~", the sample code is on GitHub, but I left it because I had a little trouble when implementing it with Google Colab. I think there is a better way, but now that it's ready to use, please take a look. Also, please understand that there may be mistakes in the usage of terms. By the way, it is the method in windows10.

Clone GitHub code locally

I am also a super beginner writing this article, so I will write it carefully. Also, I was not good at the word "clone" locally, so I would like to explain it by chewing as much as possible. (Please note that the meaning is slightly different.) Let's go.

First of all, cloning locally means copying the sample code to a folder on your PC and bringing it to you. You can check the sample code you want to copy this time from the following URL. https://github.com/oreilly-japan/deep-learning-from-scratch

To clone the GitHub code, you need a software called Git. Please see other very easy-to-understand sites for how to install. I referred to this site. https://eng-entrance.com/git-install#i-3

After that, clone GitHub after installation and initial setup. This time I want to clone on the page I posted earlier, so I will go to the URL above. Something like this. スクリーンショット (74).png Then, when you press the green tab on the right side of the center of the screen, a pop-up like the one above will appear, so copy it. After copying, open Git Bash. I think Git Bash is inside Git by opening the windows mark at the bottom left of the screen.

After opening Git Bash, type in the following code.

GitBash


cd projects
git clone https://github.com/oreilly-japan/deep-learning-from-scratch.git

You should now be able to clone locally. Try catching your own folder.

Implement sample code in Google Colab

First, put the entire folder that you cloned into the folder on your PC into My Drive of Google Drive. Then open Google Colab. I think there are about 3 tabs on the left side of Google Colab, but press the folder mark at the bottom. When you open it, there is a button that says "Mount Drive", so press it. Do you want to allow it? A pop-up like this will appear, so allow it. However, there is a hierarchical structure of drives. スクリーンショット (75).png Something like this. (Sorry for the cluttered screen ...) In this My Drive, there is a folder called "deep-learning-from-scratch" that I put in earlier. If you haven't changed the name, it should be this name.

When you open My Drive, the file should be there, so when you hit the pointer, three black dots will line up on the left end, so press it. Then, the path will be copied, so press it. Then type the following code in the cell on the right.

cell


cd(What I just copied)

When actually writing, omit (). This code will work where I have this file from now on! about it. If you don't do this, you'll get an error saying that some modules you don't know when you copy and run your code. You should now be able to copy and paste the code.

I think this article is full of highlights, but thank you for reading to the end.

Recommended Posts

[For beginners] How to implement O'reilly sample code in Google Colab
How to display videos inline in Google Colab
How to use VS Code (code server) with Google Colab in just 3 lines
[For beginners] How to use say command in python!
How to run AutoGluon in Google Colab GPU environment
How to implement 100 data science knocks for data science beginners (for windows10 Home)
How to implement Python EXE for Windows in Docker container
For beginners, how to deal with common errors in keras
How to run TensorFlow 1.0 code in 2.0
How to implement Java code in the background of RedHat (LinuxONE)
[For beginners] How to register a library created in Python in PyPI
How to use Google Test in C
How to implement nested serializer in drf-flex-fields
How to implement Scroll View in pythonista 1
How to run a quickstart for Google Cloud Text-to-Speech .NET in Unity
How to make Spigot plugin (for Java beginners)
How to implement Rails helper-like functionality in Django
How to implement Discord Slash Command in Python
How to implement shared memory in Python (mmap.mmap)
How to implement a gradient picker in Houdini
How to use data analysis tools for beginners
Try to calculate RPN in Python (for beginners)
How to make Python faster for beginners [numpy]
[For beginners] How to study programming Private memo
[For beginners] Introduction to vectorization in machine learning
How to get the notebook name you are currently using in Google Colab
Instructions for connecting Google Colab. To the local runtime in a Windows environment
How to convert Python # type for Python super beginners: str
[For beginners] How to study Python3 data analysis exam
Specific sample code for working with SQLite3 in Python
How to run python in virtual space (for MacOS)
How to load files in Google Drive with Google Colaboratory
How to install Google Test / Google Mock in Visual Studio 2019
Python # How to check type and type for super beginners
How to use Spacy Japanese model in Google Colaboratory
How to use linux commands in Visual Studio Code terminal
How to support x-nullable for swagger in python's jsonschema library
Test code to check for broken links in the page
[For beginners] How to read Numerai's HP + Submit + Convenient links
How to extract any appointment in Google Calendar with Python
[Google Colab] How to interrupt learning and then resume it
How to use VS Code in venv environment on windows
[For beginners] How to use for statements on Linux (variables, etc.)
How to temporarily implement a progress bar in a scripting language
[Explanation for beginners] Introduction to convolution processing (explained in TensorFlow)
How to define multiple variables in a python for statement
[Explanation for beginners] Introduction to pooling processing (explained in TensorFlow)
How to learn TensorFlow for liberal arts and Python beginners
How to specify Cache-Control for blob storage in Azure Storage in Python
How to sample from any probability density function in Python
How to convert Python # type for Python super beginners: int, float
Sample code summary when working with Google Spreadsheets from Google Colab
Reference reference for those who want to code in Rhinoceros / Grasshopper
Try HeloWorld in your own language (with How to & code)
[Python] Sample code for Python grammar
How to develop in Python
~ Tips for beginners to Python ③ ~
How to use Google Colaboratory
How to set the output resolution for each keyframe in Blender
How to auto-update App Store description in Google Sheets and Fastlane
How to display formulas in latex when using sympy (> = 1.4) in Google Colaboratory