hitit-cuneiform-ocr / code /configs /classification_hitit_only.yaml
savastakan's picture
Initial upload: code + 5 record checkpoints + fuse
f211247 verified
Raw
History Blame Contribute Delete
3.34 kB
# HITIT-ONLY Classification (v3) — Target top-1 ≥ 90%
# 198 sınıf, 21K kayıt, IR=1229×, manuel etiketli
# NOT: Hierarchical head gereksiz (198 flat yeter)
backbone:
arch: dinov3_vitl14 # LARGE — 300M params
pretrained: hitit_ocr/runs/ssl_dinov3_continual/checkpoint.pt # SSL continual
freeze: false
lora:
r: 32 # Larger rank (198 class için yeter)
alpha: 64
dropout: 0.1
targets: ['qkv', 'proj', 'mlp.fc1', 'mlp.fc2']
bias: none
head:
type: flat # NO hierarchy
n_classes: 198 # Hitit direct
dropout: 0.3
loss:
type: cross_entropy
label_smoothing: 0.1
class_weights: sqrt_inverse
class_weight_cap: 10.0 # Avoid extreme rare tier boost
sampler:
type: weighted_random
weight_mode: sqrt_inverse
replacement: true
augmentation:
mixup: {alpha: 0.2, p: 0.5}
cutmix: {alpha: 1.0, p: 0.3}
elastic_transform: {alpha: 40.0, sigma: 6.0, p: 0.5}
grid_distortion: {num_steps: 5, distort_limit: 0.15, p: 0.3}
rotation: {degrees: 5, p: 0.5}
color_jitter: {brightness: 0.2, contrast: 0.2, p: 0.5}
horizontal_flip: {enabled: false} # Cuneiform yön-duyarlı!
illumination_variation: {enabled: true, p: 0.3} # MaiCuBeDa stili
optimizer:
type: AdamW
lrs:
backbone: 1.0e-5
lora: 5.0e-4
head: 1.0e-3
weight_decay: 0.05
betas: [0.9, 0.999]
scheduler:
type: cosine_with_warmup
warmup_epochs: 5
total_epochs: 100
eta_min: 1.0e-6
ema:
enabled: true
decay: 0.9999
start_epoch: 20
swa:
enabled: true
start_epoch: 85 # son 15 epoch
swa_lr: 5.0e-5
update_bn_on_end: true
batch_size: 64
gradient_accumulation: 2 # effective 128
epochs: 100 # LP 10 + FT 90 with strong aug
gradient_clip_val: 1.0
# Mixed precision (Option A — bf16 daha stabil, aynı hız)
bf16: true # bit-exact accuracy, fp16'dan stabil
fp16: false
# Training efficiency (Option A — accuracy-neutral speedups)
torch_compile:
enabled: true
mode: "max-autotune" # 1.3x throughput, bit-exact
flash_attention:
enabled: true
version: 2 # FA2 on A100
fused_optimizer:
enabled: true # AdamW(fused=True), 1.1x
normalize:
mean: [0.489, 0.448, 0.424] # dataset-specific
std: [0.362, 0.359, 0.364]
data:
manifest: datasets/sources/hitit_local/manifest_classification.parquet
filter: "class_sample_count >= 5 AND integrity_ok == True AND quality_gate_pass == True"
# 177 sınıf, 21162 sample (99.8% coverage) — 21 rare sınıf hariç
cv:
strategy: tablet_view_fold
val_fold: 0
test_fold: 4 # LOCKED for final eval
# Rendered domain adaptation: MaiCuBeDa Hitit-uyumlu augment eklenebilir
aux_domain_adapt:
enabled: true
sources: ['maicubeda', 'heicubeda'] # rendered → hitit style
weight: 0.1 # %10 karışım
eval:
metrics: [top1_acc, top5_acc, macro_f1, balanced_acc]
stratify_by: class_frequency_tier
per_tablet_id: true # tablet-level aggregation
selective_classification:
enabled: true
thresholds: [0.3, 0.5, 0.6, 0.7, 0.8]
targets:
top1_accuracy: 0.90 # ⭐ PRIMARY TARGET
top5_accuracy: 0.98
macro_f1: 0.88
selective_acc_90cov: 0.94
output_dir: hitit_ocr/runs/hitit_only_dinov3/