Skip to content

Instantly share code, notes, and snippets.

@MossabDiae
Last active July 20, 2021 07:23
Show Gist options
  • Save MossabDiae/2b4cda721923db7374c4e8413a4c330c to your computer and use it in GitHub Desktop.
Save MossabDiae/2b4cda721923db7374c4e8413a4c330c to your computer and use it in GitHub Desktop.
Load data automatically to google colab notebook from github

The benfits:

  1. less loading time (google download speed is better than your upload speed)
  2. one click data loading
  3. making data online you can work from other machines.
  4. we'll be using private github repository so data is private.

2- compress your data as zip , make a private github repository and upload it

3- use this snippet in your colab notebook to get the data and unzip it

!curl -H 'Authorization: token YOUR_TOKEN_HERE' -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/USERNAME/REPO_NAME/contents/FILE.zip

!unzip FILE.zip

make sure to set : YOUR_TOKEN_HERE, USERNAME , REPO_NAME, FILE.zip if you've put the data inside a folder in the repository just use the correct path , e.g if folder is data then :

https://api.github.com/repos/USERNAME/REPO_NAME/contents/data/FILE.zip

written for a friend , good luck Iyad .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment