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
Install Hugging Face Hub CLI:
pip install huggingface_hubLogin 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
- Go to https://huggingface.co/new
- Create a new repository named
chest2vec_0.6b_chest(orchest2vec/chest2vec_0.6b_chestif under an organization) - 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
- Create a PyPI account at https://pypi.org/account/register/
- Create an API token at https://pypi.org/manage/account/token/
- 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.whldist/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:
- First publish to Hugging Face Hub (for model weights and repository)
- 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.pyandpyproject.tomlif publishing a new version