Hugging Face Upload Guide for ConceptFrameMet
This guide will help you upload your ConceptFrameMet model to the Hugging Face Hub.
Prerequisites
- Hugging Face Account: Create an account at huggingface.co
- Install Hugging Face CLI:
pip install huggingface_hub
Step 1: Login to Hugging Face
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)
- Go to https://huggingface.co/new
- Choose a repository name:
ConceptFrameMet - Select visibility (Public or Private)
- Click "Create model"
Option B: Via CLI
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)
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
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
- Go to your model page:
https://huggingface.co/YOUR_USERNAME/ConceptFrameMet - Click "Files" tab
- Click "Add file" β "Upload files"
- Drag and drop or select files
- 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:
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:
---
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:
# 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
# Re-login
huggingface-cli logout
huggingface-cli login
Upload Timeout
For very large files, use the Python API with chunks:
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:
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
- Upload your model following the steps above
- Test that it loads correctly
- Share your model with the community!
- 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