> ## Documentation Index
> Fetch the complete documentation index at: https://hubify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# HuggingFace Integration

> Push models, datasets, and results to HuggingFace Hub from Hubify Labs.

# HuggingFace Integration

Hubify Labs integrates with [HuggingFace Hub](https://huggingface.co) for publishing models, datasets, and experiment artifacts. Share your research outputs with the community directly from your lab.

## Setup

<Steps>
  <Step title="Get a HuggingFace token">
    Go to [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) and create a write-access token.
  </Step>

  <Step title="Configure in Hubify">
    ```bash theme={null}
    hubify config set huggingface-token "hf_abc123..."
    ```
  </Step>

  <Step title="Verify">
    ```bash theme={null}
    hubify config test huggingface
    ```

    ```
    HuggingFace connection: OK
    User: houston-golden
    Organizations: hubify-labs
    ```
  </Step>
</Steps>

## Publishing Datasets

Push experiment outputs and processed datasets to HuggingFace:

```bash theme={null}
# Push a dataset from an experiment
hubify data publish EXP-054 \
  --target huggingface \
  --repo hubify-labs/planck-bao-chains \
  --description "MCMC posterior samples from Planck+BAO analysis"
```

This creates a HuggingFace dataset repository with:

* Data files (Parquet format for tabular data)
* Dataset card (auto-generated from experiment metadata)
* Schema and column descriptions
* Provenance information (experiment ID, lab, date)

### Dataset Cards

Hubify auto-generates HuggingFace dataset cards:

```bash theme={null}
hubify data card EXP-054
```

The card includes:

* Dataset description and purpose
* Column definitions
* Collection methodology
* License information
* Citation instructions

## Publishing Models

Push trained models to HuggingFace:

```bash theme={null}
hubify model publish \
  --experiment EXP-060 \
  --repo hubify-labs/anomaly-detector-v2 \
  --framework pytorch
```

## Publishing Spaces

Create a HuggingFace Space with an interactive demo:

```bash theme={null}
hubify space create \
  --repo hubify-labs/bounce-cosmology-explorer \
  --type gradio \
  --experiment EXP-054
```

This creates a Gradio app that lets anyone explore your experiment results interactively.

## Bulk Publishing

Publish all publishable artifacts from a lab:

```bash theme={null}
# List what can be published
hubify data list --publishable

# Publish everything
hubify data publish --all --target huggingface --org hubify-labs
```

## Linking to Lab Site

Published HuggingFace resources are automatically linked from your lab site:

```bash theme={null}
# After publishing, sync the site
hubify site sync
```

The lab site will display links to your HuggingFace datasets, models, and Spaces.

## Examples

```bash theme={null}
# Publish anomaly catalog
hubify data publish EXP-045 \
  --target huggingface \
  --repo hubify-labs/desi-anomaly-catalog \
  --description "195,829 anomalous spectra from DESI DR1"

# Publish MCMC chains for reproducibility
hubify data publish EXP-054 \
  --target huggingface \
  --repo hubify-labs/bounce-cosmology-mcmc \
  --description "424K posterior samples across 4 dataset combinations"

# Publish a trained autoencoder
hubify model publish \
  --experiment EXP-038 \
  --repo hubify-labs/spectral-anomaly-ae \
  --framework pytorch \
  --description "Autoencoder for spectral anomaly detection (16D latent)"
```

## Privacy

* Only experiments and data you explicitly publish are uploaded
* Private lab data is never automatically shared
* You control the repository visibility (public or private) on HuggingFace
* API tokens are stored locally and never sent to Hubify servers
