Machine Learning/Tip

Easiest way to download kaggle data in Google Colab

WakaraNai 2021. 10. 26. 00:13
728x90
반응형

https://www.kaggle.com/general/74235

 

Easiest way to download kaggle data in Google Colab | Data Science and Machine Learning

Easiest way to download kaggle data in Google Colab.

www.kaggle.com

 

1. Go to your account, Scroll to API section and Click Expire API Token to remove previous tokens

2. Click on Create New API Token - It will download kaggle.json file on your machine.

3. Go to your Google Colab project file and run the following commands:

1) ! pip install -q kaggle

2) from google.colab import files

files.upload()

  • Choose the kaggle.json file that you downloaded

3) ! mkdir ~/.kaggle

! cp kaggle.json ~/.kaggle/

  • Make directory named kaggle and copy kaggle.json file there.

4) ! chmod 600 ~/.kaggle/kaggle.json

  • Change the permissions of the file.

5) ! kaggle datasets list
- That's all ! You can check if everything's okay by running this command.

 

 

Download Dataset

!kaggle datasets download -d kozodoi/timm-pytorch-image-models

 

Download Data

! kaggle competitions download -c 'name-of-competition'

Use unzip command to unzip the data:

For example,

Create a directory named train,

! mkdir train

unzip train data there,

! unzip train.zip -d train

 

 

특정 대회 이름 가져오기
 ! kaggle competitions list

여기서 대회 이름 찾기

 

<competition name>에 찾은 이름 넣고 실행

!kaggle competitions download -c <competition name>

 

이 방법 외에 사이트에서 복사해올 수도 있다

! kaggle competitions download -c 'name-of-competition' 복사해오는 법

 

728x90
반응형