Spaces:
Sleeping
Sleeping
Models Directory
LegalBERT Model
You can add your fine-tuned LegalBERT model in two ways:
Option 1: Zip File (Recommended)
Place your model zip file as legalbert_epoch4.zip in this directory:
models/
βββ legalbert_epoch4.zip
The system will automatically extract it to legalbert_model/ when the server starts.
Option 2: Direct Files
Place your LegalBERT model files directly in the legalbert_model/ subdirectory:
models/
βββ legalbert_model/
βββ config.json
βββ pytorch_model.bin
βββ tokenizer_config.json
βββ tokenizer.json
βββ vocab.txt
Installation
Once you have the model files:
Install required dependencies:
pip install torch transformersThe LegalBertService will automatically detect and load the model when the server starts.
Model Requirements
- Should output binary classification (guilty/not guilty)
- Compatible with AutoModelForSequenceClassification
- Supports text truncation and padding
- Returns logits that can be converted to probabilities
Auto-Detection
The service checks for models in this order:
legalbert_epoch4.zip(extracts automatically)legalbert_model/directory with model files- Falls back to placeholder mode if neither found