chore: initial commit — unified project repo
Merged code repo (CompanionGuard-RL) into single project-level git. Reorganized root: docs/, reference/, experiments/, tmp/active|archives/. Gitignored: data/, checkpoints/, .venv, experiment logs, tmp/archives. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
54
code/configs/detector_config_server.yaml
Normal file
54
code/configs/detector_config_server.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
model:
|
||||
name: "/root/siton-data-740d234e02d749f08fe5347b0c74c49f/zsy/macbert-large"
|
||||
hidden_size: 1024
|
||||
num_heads: 8
|
||||
dropout: 0.1
|
||||
use_lora: false
|
||||
|
||||
data:
|
||||
train_path: "data/processed/CompanionRisk-Bench/train.jsonl"
|
||||
val_path: "data/processed/CompanionRisk-Bench/dev.jsonl"
|
||||
test_path: "data/processed/CompanionRisk-Bench/test.jsonl"
|
||||
max_persona_len: 128
|
||||
max_context_len: 512
|
||||
max_response_len: 256
|
||||
max_history_turns: 5
|
||||
num_workers: 4 # Linux server: 4 workers; Windows: use 0
|
||||
|
||||
training:
|
||||
epochs: 10
|
||||
per_gpu_batch_size: 16 # 4 GPUs × 16 × accum 2 = effective batch 128
|
||||
gradient_accumulation_steps: 2
|
||||
lr: 2e-5
|
||||
warmup_steps: 100
|
||||
weight_decay: 0.01
|
||||
gradient_clip: 1.0
|
||||
eval_steps: 100 # global steps between validation runs
|
||||
mixed_precision: "bf16" # RTX 5090 native bf16
|
||||
seed: 42
|
||||
|
||||
loss_weights:
|
||||
binary: 1.0
|
||||
level: 1.0
|
||||
primary: 1.0
|
||||
fine: 2.0 # ↑ 2.0: 加强细粒度标签损失权重(配合 fine_training 开启)
|
||||
|
||||
# Fine-grained label training options(下次训练时开启,当前 best.pt 不受影响)
|
||||
# 两项均开启可显著改善 fine_macro_f1:
|
||||
# use_pos_weight: 对 Romanticization/CoRumination 等稀有标签设置 ~25 倍正样本权重
|
||||
# risky_only: 只在 y_risk=1 的样本上计算 fine loss,避免 safe 样本教模型预测全负
|
||||
fine_training:
|
||||
use_pos_weight: true # ✓ 开启:对稀有 fine 标签设置 pos_weight(max 30)
|
||||
risky_only: true # ✓ 开启:只在 y_risk=1 样本上计算 fine loss
|
||||
|
||||
evaluation:
|
||||
binary_threshold: 0.5
|
||||
fine_threshold: 0.4
|
||||
|
||||
logging:
|
||||
project: "CompanionGuard-RL"
|
||||
run_name: "detector-macbert-4gpu"
|
||||
use_wandb: false
|
||||
|
||||
output:
|
||||
checkpoint_dir: "checkpoints/detector"
|
||||
Reference in New Issue
Block a user