Hi
Can some one please list out the steps to run the notebooks in google colabs notebooks after we do the git.
Regards
Jaideep
NathanHub
(Nathan Hubens)
April 11, 2019, 3:19pm
2
Hi !
For me simply run the cell:
!curl -s https://course.fast.ai/setup/colab | bash
Works perfectly !
All the steps are listed here if you want more information
i dont have problem in import fast ai librariesâŚ
I have trouble running Part2 notebooks ⌠it cant access the local procedures called in notebooks ,defined in the .pys of ipynbs.
NathanHub
(Nathan Hubens)
April 11, 2019, 4:24pm
4
Maybe then this is what your are looking for:
Hey guys,
I had some issue with running the âexportâ parts of the lesson using Google colab. After I figure this out, there is nothing complicated about it, but Iâll add it here anyway to save you some time.
Assuming the google drive is already mounted to colab, this is what you need to do:
Download notebook2script.py from the course github and upload it to Google driveâs âColab Notebooksâ folder (make sure to download the âRawâ code and not copy/paste it)
Run the following code in colabâŚ
No luckâŚ
I followed below steps
!git clone https://github.com/fastai/fastai_docs.git in colab ⌠which created fastai_docs folder under ./content
from google.colab import drive
drive.mount(â/content/fai/â, force_remount=True)
then i copied using cp command all files to exp folder that i created on mounted path My drive/colabnotebooks/exp
JennyCai
(Jenny Cai)
April 24, 2019, 5:13am
7
For notebooks in part 2, I have been using Colab.
I put the notes here:
https://course.fast.ai/start_colab.html
has excellent instructions.
Since each notebook imports the library built in previous notebooks, start with 00_exports.ipynb
Here are the steps:
1) Sign into google drive
2) go to Colab welcome page
https://colab.research.google.com/notebooks/welcome.ipynb#recent=true
3) Click github tub then paste this url:
https://github.com/fastai/fastai_docs/blob/master/dev_course/dl2/00_exports.ipynb
4) Select 00_exports.ipynb, click âFile -> save a copy in driveâ. The newly saved copy is automatically named
âCopy of 00_exports.ipynbâ.
Close the original copy. Rename the newly saved copy to the original name, i.e. remove the âCopy of â from the file name.
This is because the end of the notebook has this line:
!python notebook2script.py 00_exports.ipynb
If we have a different file name, itâll say âcanât find notebook 00_exports.ipynbâ
This file has been truncated. show original
4 Likes
jcatanza
(Joseph Catanzarite)
July 25, 2019, 5:23pm
8
Here is how I got the notebooks to run: Colab setup for Part 2 2019
Conwyn
April 11, 2020, 8:24pm
9
I am probably reinventing the wheel here.
Goto Colab
Select lesson 8 - https://colab.research.google.com/github/fastai/course-v3/blob/master/nbs/dl2/00_exports.ipynb
Save to drive. It becomes Copy of 00_exports.ipynb. This is saved to folder Colab Notebooks on your Google Drive.
Rename it to 00_exports.ipynb (File->Rename)
On a new tab locate
#!/usr/bin/env python
import json,fire,re
from pathlib import Path
import io
def is_export(cell):
if cell['cell_type'] != 'code': return False
src = cell['source']
if len(src) == 0 or len(src[0]) < 7: return False
#import pdb; pdb.set_trace()
return re.match(r'^\s*#\s*export\s*$', src[0], re.IGNORECASE) is not None
def getSortedFiles(allFiles, upTo=None):
'''Returns all the notebok files sorted by name.
allFiles = True : returns all files
= '*_*.ipynb' : returns this pattern
upTo = None : no upper limit
= filter : returns all files up to 'filter' included
The sorting optioj is important to ensure that the notebok are executed in correct order.
This file has been truncated. show original
Next retrieve the source code and select the RAW option to get the text. Save this to your computer and upload it to the folder Colab Notebooks on your Google Drive
Return to Colab and make Colab Netbooks the working directory
!curl -s https://course.fast.ai/setup/colab | bash
!pip install fire
from google.colab import drive
drive.mount(â/content/gdriveâ, force_remount=True)
%cd â/content/gdrive/My Drive/Colab Notebooks/â
Now you can continue the lesson
#export
TEST = âtestâ
!python notebook2script.py 00_exports.ipynb
import json
d = json.load(open(â00_exports.ipynbâ,ârâ))[âcellsâ]