File size: 5,684 Bytes
1b12abd | 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | # Hugging Face Upload Guide for ConceptFrameMet
This guide will help you upload your ConceptFrameMet model to the Hugging Face Hub.
## Prerequisites
1. **Hugging Face Account**: Create an account at [huggingface.co](https://huggingface.co)
2. **Install Hugging Face CLI**:
```bash
pip install huggingface_hub
```
## Step 1: Login to Hugging Face
```bash
huggingface-cli login
```
Enter your Hugging Face token when prompted. You can create a token at:
https://huggingface.co/settings/tokens
## Step 2: Create a New Model Repository
### Option A: Via Web Interface (Recommended)
1. Go to https://huggingface.co/new
2. Choose a repository name: `ConceptFrameMet`
3. Select visibility (Public or Private)
4. Click "Create model"
### Option B: Via CLI
```bash
huggingface-cli repo create ConceptFrameMet --type model
```
## Step 3: Prepare Your Model Files
Your ConceptFrameMet directory should contain:
```
ConceptFrameMet/
βββ pytorch_model.bin # Main model weights (1.5GB)
βββ config.json # Model configuration
βββ vocab.json # Tokenizer vocabulary
βββ merges.txt # BPE merges
βββ README.md # Model card
βββ requirements.txt # Dependencies
βββ modeling_conceptframemet.py # Custom model class
βββ inference.py # Inference script
βββ HUGGINGFACE_UPLOAD_GUIDE.md # This file
```
## Step 4: Upload Files to Hugging Face
### Method 1: Using Git LFS (Recommended for Large Files)
```bash
cd /data/gpfs/projects/punim0478/otmakhovay/ConceptFrameMet
# Clone your model repository
git clone https://huggingface.co/YOUR_USERNAME/ConceptFrameMet
cd ConceptFrameMet
# Install Git LFS if not already installed
git lfs install
# Track large files
git lfs track "*.bin"
git lfs track "pytorch_model.bin"
# Copy all files
cp ../pytorch_model.bin .
cp ../config.json .
cp ../vocab.json .
cp ../merges.txt .
cp ../README.md .
cp ../requirements.txt .
cp ../modeling_conceptframemet.py .
cp ../inference.py .
# Add, commit, and push
git add .
git commit -m "Upload ConceptFrameMet model with frame and source prediction"
git push
```
### Method 2: Using Hugging Face Hub Python API
```python
from huggingface_hub import HfApi, create_repo
# Initialize API
api = HfApi()
# Create repository (if not done via web)
create_repo("ConceptFrameMet", exist_ok=True)
# Upload files
api.upload_folder(
folder_path="/data/gpfs/projects/punim0478/otmakhovay/ConceptFrameMet",
repo_id="YOUR_USERNAME/ConceptFrameMet",
repo_type="model",
)
```
### Method 3: Manual Upload via Web Interface
1. Go to your model page: `https://huggingface.co/YOUR_USERNAME/ConceptFrameMet`
2. Click "Files" tab
3. Click "Add file" β "Upload files"
4. Drag and drop or select files
5. Click "Commit changes"
**Note**: For large files (>100MB), use Git LFS or the Python API.
## Step 5: Create Model Card (README.md)
The README.md is already created with model information. You can enhance it with:
- Training metrics
- Example outputs
- Your contact information
- License information
## Step 6: Test Your Model
After uploading, test that others can use your model:
```python
from transformers import AutoTokenizer, AutoModel
# Load model
model_name = "YOUR_USERNAME/ConceptFrameMet"
tokenizer = AutoTokenizer.from_pretrained(model_name)
print(f"β Model successfully loaded from Hugging Face Hub!")
```
## Step 7: Add Model Tags and Metadata
Edit your model card to include:
```yaml
---
language:
- en
tags:
- metaphor-detection
- semantic-frames
- source-domains
- nlp
- text-classification
license: mit # or your license
datasets:
- vua
metrics:
- f1
- accuracy
widget:
- text: "The company is navigating through troubled waters"
example_title: "Metaphor Example"
---
```
## Troubleshooting
### Large File Issues
If `pytorch_model.bin` is too large:
```bash
# Make sure Git LFS is tracking it
git lfs track "pytorch_model.bin"
git add .gitattributes
git add pytorch_model.bin
git commit -m "Add model weights with LFS"
git push
```
### Authentication Issues
```bash
# Re-login
huggingface-cli logout
huggingface-cli login
```
### Upload Timeout
For very large files, use the Python API with chunks:
```python
from huggingface_hub import HfApi
api = HfApi()
api.upload_file(
path_or_fileobj="/path/to/pytorch_model.bin",
path_in_repo="pytorch_model.bin",
repo_id="YOUR_USERNAME/ConceptFrameMet",
repo_type="model",
)
```
## Model Usage After Upload
Users can then use your model like this:
```python
from transformers import RobertaTokenizer
model_name = "YOUR_USERNAME/ConceptFrameMet"
tokenizer = RobertaTokenizer.from_pretrained(model_name)
# Your inference code here
```
## Additional Features
### Add Model to a Collection
Create collections on Hugging Face to organize related models.
### Enable Spaces Demo
Create a Gradio or Streamlit demo in Hugging Face Spaces to showcase your model.
### Add DOI
Get a DOI for your model through Hugging Face for academic citations.
## Resources
- Hugging Face Documentation: https://huggingface.co/docs
- Model Card Guide: https://huggingface.co/docs/hub/model-cards
- Git LFS Guide: https://git-lfs.github.com/
- Hugging Face CLI: https://huggingface.co/docs/huggingface_hub/guides/cli
## Next Steps
1. Upload your model following the steps above
2. Test that it loads correctly
3. Share your model with the community!
4. Consider creating a Space demo for interactive use
---
**Your Model**: ConceptFrameMet
**Model Type**: Metaphor Detection with Frame & Source Prediction
**Base Model**: RoBERTa-base
**Size**: ~1.5GB
|