简体   繁体   中英

How can I run notebooks of a Github project in Google Colab?

I want to run the notbooks in the following project on Github (located in notebook folder)

https://github.com/n-waves/multifit

The notebooks depend on the other modules, files and data of the whole project, so I can't just open them in google Colab. I can use .git clone... to make a clone on the space provided by Colab, but then I can't open the notbooks in the browser and run them (like other notebooks run by google Colab).

So, my question is how to run those notebooks in google colab, I would prefer to run them in visual mode (I mean the browser)?

Open Github notebook whatever you want to work in Google Colab. Change the domain from ' github.com ' to ' githubtocolab.com '. The notebook will open in Colab.

A helpful extension is Open in Colab .

This will provide an icon in your browser toolbar that will open the GitHub notebook you're currently viewing in Colab.

(There's no mechanism to load notebooks from the filesystem after .git clone... .)

Another option is to browse the repository using Colab's UI. If you visit this URL, it will present you with options:
https://colab.research.google.com/
在此处输入图像描述

Then you can select your repository:

https://colab.research.google.com/github/n-waves/multifit/blob/master/

预习

PS Picked this trick up while reviewing this PR for Drake.

PPS I'm not yet sure how to constrain it to a certain folder ( PR comment )

The trick is to copy those notebooks to Google Drive. Extract their FILE_ID, then open them using

https://colab.research.google.com/drive/FILE_ID

I wrote a library to extract FILE_ID easier. It's based on xattr .

Here's an example how to open a multifit notebook. CLS-DE.ipynb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM