misery-index / UPLOAD_INSTRUCTIONS.md
bansalaman18's picture
Upload UPLOAD_INSTRUCTIONS.md
f8684ab verified

Hugging Face Dataset Upload Instructions

Files to Upload

Core Dataset Files

  1. README.md - Complete dataset card with metadata, description, and usage examples
  2. data.csv - Clean CSV file with 516 scenarios and their misery scores
  3. load_dataset.py - Python script for easy dataset loading and exploration
  4. requirements.txt - Dependencies needed to use the dataset

Supporting Files (Optional)

  • misery_index.py - Advanced datasets library loading script
  • UPLOAD_INSTRUCTIONS.md - This file (for reference)

Upload Steps

Method 1: Using Hugging Face Hub (Recommended)

  1. Install Hugging Face Hub:

    pip install huggingface_hub
    
  2. Login to Hugging Face:

    huggingface-cli login
    
  3. Create and upload the dataset:

    from huggingface_hub import HfApi, create_repo
    
    # Create repository
    repo_id = "your-username/misery-index"
    create_repo(repo_id, repo_type="dataset")
    
    # Upload files
    api = HfApi()
    api.upload_file(
        path_or_fileobj="README.md",
        path_in_repo="README.md",
        repo_id=repo_id,
        repo_type="dataset"
    )
    
    api.upload_file(
        path_or_fileobj="data.csv",
        path_in_repo="data.csv",
        repo_id=repo_id,
        repo_type="dataset"
    )
    
    api.upload_file(
        path_or_fileobj="load_dataset.py",
        path_in_repo="load_dataset.py",
        repo_id=repo_id,
        repo_type="dataset"
    )
    
    api.upload_file(
        path_or_fileobj="requirements.txt",
        path_in_repo="requirements.txt",
        repo_id=repo_id,
        repo_type="dataset"
    )
    

Method 2: Using Git

  1. Clone the dataset repository:

    git clone https://huggingface.co/datasets/your-username/misery-index
    cd misery-index
    
  2. Copy files:

    cp /path/to/your/files/* .
    
  3. Push to Hugging Face:

    git add .
    git commit -m "Add Misery Index Dataset"
    git push
    

Method 3: Web Interface

  1. Go to Hugging Face Datasets
  2. Create a new dataset repository
  3. Upload files using the web interface
  4. Edit README.md directly in the browser if needed

Usage After Upload

Once uploaded, users can load the dataset in several ways:

Using Datasets Library

from datasets import load_dataset

# Load from Hugging Face Hub
dataset = load_dataset("your-username/misery-index")
print(dataset["train"][0])

Using Pandas (Direct CSV)

import pandas as pd
from huggingface_hub import hf_hub_download

# Download and load CSV
file_path = hf_hub_download(
    repo_id="your-username/misery-index", 
    filename="data.csv",
    repo_type="dataset"
)
df = pd.read_csv(file_path)

Using the Provided Script

# Download the load_dataset.py script and use it
from huggingface_hub import hf_hub_download
import importlib.util

# Download the script
script_path = hf_hub_download(
    repo_id="your-username/misery-index",
    filename="load_dataset.py", 
    repo_type="dataset"
)

# Load and use
spec = importlib.util.spec_from_file_location("load_dataset", script_path)
load_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(load_module)

df = load_module.load_misery_dataset("data.csv")
stats = load_module.get_dataset_statistics(df)

Dataset Configuration

The dataset uses these configurations:

  • License: CC-BY-4.0 (Creative Commons Attribution)
  • Language: English (en)
  • Task: Text regression, sentiment analysis, emotion prediction
  • Size: 516 samples (100<n<1K category)

Validation Checklist

Before uploading, ensure:

  • README.md contains comprehensive dataset card
  • data.csv has all 516 rows with proper formatting
  • No missing values in critical columns (scenario, misery_score)
  • load_dataset.py script runs without errors
  • requirements.txt includes all necessary dependencies
  • License is properly specified (CC-BY-4.0)
  • Dataset tags are appropriate for discoverability

Post-Upload Tasks

  1. Test the uploaded dataset:

    from datasets import load_dataset
    ds = load_dataset("your-username/misery-index")
    print(f"Dataset loaded successfully with {len(ds['train'])} samples")
    
  2. Update dataset card if needed using the web interface

  3. Share the dataset with relevant research communities

  4. Consider creating a model trained on this dataset

Support

If you encounter issues:

  1. Check the Hugging Face documentation
  2. Visit the Hugging Face Discord
  3. Create an issue in the dataset repository