File size: 1,316 Bytes
9844436
 
 
 
9ae222c
9844436
9ae222c
 
 
 
 
 
 
 
 
 
 
9844436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ae222c
 
 
 
 
 
 
 
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
# 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:

1. Install required dependencies:
   ```bash
   pip install torch transformers
   ```

2. The 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:
1. `legalbert_epoch4.zip` (extracts automatically)
2. `legalbert_model/` directory with model files
3. Falls back to placeholder mode if neither found