chest2vec_0.6b_chest / PUBLISH.md
lukeingawesome's picture
Upload folder using huggingface_hub
364cd6b verified

Publishing chest2vec_0.6b_chest

This guide covers publishing to both Hugging Face Hub (model repository) and PyPI (Python package).

Option 1: Publish to Hugging Face Hub

Prerequisites

  1. Install Hugging Face Hub CLI:

    pip install huggingface_hub
    
  2. Login to Hugging Face:

    huggingface-cli login
    # Enter your HF token when prompted
    

Initialize Git Repository (if not already)

cd /opt/project/chest2vec/export_chest2vec_0.6b_chest
git init
git add .
git commit -m "Initial commit: chest2vec_0.6b_chest"

Create Repository on Hugging Face Hub

  1. Go to https://huggingface.co/new
  2. Create a new repository named chest2vec_0.6b_chest (or chest2vec/chest2vec_0.6b_chest if under an organization)
  3. Choose "Model" as the repository type

Push to Hugging Face Hub

# Add HF remote (replace with your username/org)
git remote add origin https://huggingface.co/YOUR_USERNAME/chest2vec_0.6b_chest

# Push to HF Hub
git push origin main

Or use the HF Hub CLI:

huggingface-cli upload YOUR_USERNAME/chest2vec_0.6b_chest . --repo-type model

Verify Upload

Visit https://huggingface.co/YOUR_USERNAME/chest2vec_0.6b_chest to verify all files are uploaded.


Option 2: Publish to PyPI

Prerequisites

  1. Create a PyPI account at https://pypi.org/account/register/
  2. Create an API token at https://pypi.org/manage/account/token/
  3. Install build tools:
    pip install build twine
    

Build the Package

cd /opt/project/chest2vec/export_chest2vec_0.6b_chest
python3 -m build

This creates:

  • dist/chest2vec-0.6.0-py3-none-any.whl
  • dist/chest2vec-0.6.0.tar.gz

Upload to PyPI

Test first on TestPyPI

# Upload to TestPyPI first to test
twine upload --repository testpypi dist/*
# You'll be prompted for:
#   username: __token__
#   password: your API token

Test installation:

pip install --index-url https://test.pypi.org/simple/ chest2vec

Then upload to PyPI

twine upload dist/*
# You'll be prompted for:
#   username: __token__
#   password: your API token

After Publishing

Once published, users can install with:

pip install chest2vec

Note: Users will still need to install PyTorch and flash-attention separately as documented in the README, since PyPI doesn't support custom index URLs in dependencies.


Option 3: Publish to Both

You can publish to both platforms:

  1. First publish to Hugging Face Hub (for model weights and repository)
  2. Then publish to PyPI (for easy Python package installation)

Users can then either:

  • Load from HF Hub: Chest2Vec.from_pretrained("YOUR_USERNAME/chest2vec_0.6b_chest")
  • Install from PyPI: pip install chest2vec (then load from HF Hub or local path)

Important Notes

  • Model weights (section_pooler.pt, contrastive/) should be on Hugging Face Hub
  • Python package can be on PyPI for easier installation
  • The package name on PyPI is chest2vec (shared across all variants)
  • Make sure to update version numbers in setup.py and pyproject.toml if publishing a new version