Upload Dataset to Hugging Face - Quick Guide
Step 1: Install Requirements
pip install huggingface_hub
Step 2: Login to Hugging Face
huggingface-cli login
You'll need a Hugging Face token:
- Go to https://huggingface.co/settings/tokens
- Create a new token with "write" permission
- Copy and paste it when prompted
Step 3: Configure the Upload Script
Edit upload_to_huggingface.py:
- Change
HF_USERNAMEto your Hugging Face username - Optionally change
DATASET_NAMEto your preferred name
Step 4: Run the Upload Script
python upload_to_huggingface.py
Step 5: Use in Kaggle
Once uploaded, in your Kaggle notebook:
- Click "Add Data" button
- Select "Hugging Face" tab
- Search for your dataset name
- 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:
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).