File size: 1,443 Bytes
ea8bfa1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# CLARA Scripts

CLI scripts converted from `notebooks/CLARA_HFM.ipynb` for training and evaluating HFM.

## Available Scripts

### 1) `scripts/train_hfm.py`
Train CLARA on HFM and save best checkpoint.

```bash
python3 scripts/train_hfm.py \
  --data-root data/HFM \
  --text-dir data/HFM/text \
  --output-dir outputs/hfm \
  --checkpoint-name clara_hfm.pt \
  --batch-size 32 \
  --max-epochs 50
```

### 2) `scripts/evaluate_hfm.py`
Evaluate one checkpoint on HFM test set with all variants from notebook:
- `Raw`
- `Bias+Temp`
- `Top-2 Flip`
- `Affine Neutral`

```bash
python3 scripts/evaluate_hfm.py \
  --checkpoint outputs/hfm/clara_hfm.pt \
  --data-root data/HFM \
  --text-dir data/HFM/text \
  --output-dir results/hfm
```

### 3) `scripts/run_hfm_all.py`
Run train then evaluate in one command.

```bash
python3 scripts/run_hfm_all.py \
  --data-root data/HFM \
  --text-dir data/HFM/text \
  --train-output-dir outputs/hfm \
  --results-dir results/hfm
```

## HFM Data Preparation

If your HFM comes as 3 zip files in `data/`, extract with:

```bash
cd data
unzip -n HFM-20260303T020235Z-1-001.zip
unzip -n HFM-20260303T020235Z-1-002.zip
unzip -n HFM-20260303T020235Z-1-003.zip
```

Expected structure:

```text
data/HFM/
β”œβ”€β”€ image/
β”œβ”€β”€ train/image/
β”œβ”€β”€ val/image/ (or valid/image/)
β”œβ”€β”€ test/image/
└── text/
    β”œβ”€β”€ train.txt
    β”œβ”€β”€ val.txt (or valid.txt)
    └── test.txt
```