File size: 1,467 Bytes
637ad85 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | # Upload Dataset to Hugging Face - Quick Guide
## Step 1: Install Requirements
```bash
pip install huggingface_hub
```
## Step 2: Login to Hugging Face
```bash
huggingface-cli login
```
You'll need a Hugging Face token:
1. Go to https://huggingface.co/settings/tokens
2. Create a new token with "write" permission
3. Copy and paste it when prompted
## Step 3: Configure the Upload Script
Edit `upload_to_huggingface.py`:
- Change `HF_USERNAME` to your Hugging Face username
- Optionally change `DATASET_NAME` to your preferred name
## Step 4: Run the Upload Script
```bash
python upload_to_huggingface.py
```
## Step 5: Use in Kaggle
Once uploaded, in your Kaggle notebook:
1. Click "Add Data" button
2. Select "Hugging Face" tab
3. Search for your dataset name
4. Click "Add"
The dataset will be mounted at `/kaggle/input/your-dataset-name/`
## Alternative: Direct Download in Kaggle
If you prefer, you can also download directly in your Kaggle notebook:
```python
from huggingface_hub import snapshot_download
dataset_path = snapshot_download(
repo_id="YOUR_USERNAME/DATASET_NAME",
repo_type="dataset",
local_dir="./pool_dataset"
)
print(f"Dataset downloaded to: {dataset_path}")
```
## Verify Upload
After uploading, visit:
```
https://huggingface.co/datasets/YOUR_USERNAME/DATASET_NAME
```
You should see all your files (train, valid, test folders and data.yaml).
|