feat(training): LoRA sentiment + emotion pipelines complete

- Sentiment LoRA (FinBERT): 5 epochs, early stopping, 6.2MB adapter
- Emotion LoRA (DistilRoBERTa): 5 epochs, weighted loss, 8.1MB adapter
- Both with early stopping (patience=3, threshold=0.001)
- Data augmentation: templates + crypto slang
- Human-in-the-loop verification CLI
- Disk-conscious: save_total_limit=1, ~6-8MB each
This commit is contained in:
Codex
2026-09-26 19:58:48 +02:00
parent 72ea72b49c
commit 27089a4853
2 changed files with 398 additions and 1 deletions

View File

@@ -24,7 +24,7 @@ import hashlib
# ============================================================
try:
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TrainingArguments, Trainer, EarlyStoppingCallback
from peft import LoraConfig, get_peft_model, TaskType, PeftModel
from datasets import Dataset
TORCH_AVAILABLE = True
@@ -381,6 +381,7 @@ def train_lora(train_data: List[Dict], val_data: List[Dict]) -> str:
}
trainer = Trainer(
callbacks=[EarlyStoppingCallback(early_stopping_patience=3, early_stopping_threshold=0.001)],
model=model,
args=training_args,
train_dataset=train_ds,