File size: 3,191 Bytes
364cd6b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# 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:
```bash
pip install huggingface_hub
```
2. Login to Hugging Face:
```bash
huggingface-cli login
# Enter your HF token when prompted
```
### Initialize Git Repository (if not already)
```bash
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
```bash
# 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:
```bash
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:
```bash
pip install build twine
```
### Build the Package
```bash
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
```bash
# Upload to TestPyPI first to test
twine upload --repository testpypi dist/*
# You'll be prompted for:
# username: __token__
# password: your API token
```
Test installation:
```bash
pip install --index-url https://test.pypi.org/simple/ chest2vec
```
#### Then upload to PyPI
```bash
twine upload dist/*
# You'll be prompted for:
# username: __token__
# password: your API token
```
### After Publishing
Once published, users can install with:
```bash
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
|