# Set project name for organization
os.environ["OPIK_PROJECT_NAME"] = "huggingface-datasets-integration-demo"
```

## HuggingFaceToOpikConverter

The integration provides a utility class to convert Hugging Face datasets to Opik format:

```python
from datasets import load_dataset, Dataset as HFDataset
from opik import Opik
from typing import Optional, Dict, Any, List
import json
from tqdm import tqdm
import warnings
import numpy as np
import pandas as pd

warnings.filterwarnings('ignore')

class HuggingFaceToOpikConverter:
    """Utility class to convert Hugging Face datasets to Opik format."""

    def __init__(self, opik_client: Opik):
        self.opik_client = opik_client

    def load_hf_dataset(
        self,
        dataset_name: str,
        split: Optional[str] = None,
        config: Optional[str] = None,
        subset_size: Optional[int] = None,
        **kwargs
    ) -> HFDataset:
        """
        Load a dataset from Hugging Face Hub.

        Args:
            dataset_name: Name of the dataset on HF Hub
            split: Specific split to load (train, validation, test)
            config: Configuration/subset of the dataset
            subset_size: Limit the number of samples
            **kwargs: Additional arguments for load_dataset

        Returns:
            Loaded Hugging Face dataset
        """
        print(f"📥 Loading dataset: {dataset_name}")
        if config:
            print(f"   Config: {config}")
        if split:
            print(f"   Split: {split}")

        # Load the dataset
        dataset = load_dataset(
            dataset_name,
            name=config,
            split=split,
            **kwargs
        )

        # Limit dataset size if specified
        if subset_size and len(dataset) > subset_size:
            dataset = dataset.select(range(subset_size))
            print(f"   Limited to {subset_size} samples")

        print(f"   ✅ Loaded {len(dataset)} samples")
        print(f"   Features: {list(dataset.features.keys())}")

        return dataset
```

## Basic Usage

### Convert and Upload a Dataset

Here's how to convert a Hugging Face dataset to Opik format and upload it:

```python