Views
No views yet
0.12.21# 基础模型配置
2base_model: /workspace/agent-0927-05-merged
3load_in_8bit: false
4load_in_4bit: false # QLoRA才需要4bit
5
6# LoRA 适配器配置 - 这是关键部分
7adapter: lora # 明确指定使用LoRA
8lora_model_dir: # 如果有预训练的LoRA权重可以在这里指定
9
10# LoRA 具体参数
11lora_r: 32
12lora_alpha: 64
13lora_dropout: 0.15
14lora_target_modules: # Qwen3模型的关键模块
15 - q_proj
16 - k_proj
17 - v_proj
18 - o_proj
19 - gate_proj
20 - up_proj
21 - down_proj
22lora_target_linear: true # 自动找到所有线性层
23lora_fan_in_fan_out: false
24
25# 数据集设置
26chat_template: qwen3
27datasets:
28 - path: /workspace/train_dir_0927-05/all_tool_data_4500.json
29 type: chat_template
30 weight: 20
31 roles_to_train: ["assistant"]
32 field_messages: messages
33 message_property_mappings:
34 role: role
35 content: content
36
37 - path: /workspace/final_data.json
38 type: chat_template
39 weight: 30
40 roles_to_train: ["assistant"]
41 field_messages: messages
42 message_property_mappings:
43 role: role
44 content: content
45
46 - path: /workspace/train_dir_0927-05/retrieval_data_sql.json
47 type: chat_template
48 weight: 50
49 roles_to_train: ["assistant"]
50 field_messages: messages
51 message_property_mappings:
52 role: role
53 content: content
54
55dataset_prepared_path:
56val_set_size: 0.1
57output_dir: /workspace/train_dir_0927-06/checkpoints
58
59# 序列长度设置
60sequence_len: 7000
61pad_to_sequence_len: true
62sample_packing: false
63eval_sample_packing: false
64group_by_length: true # 启用长度分组,提高效率
65
66# 训练超参数
67num_epochs: 2
68micro_batch_size: 8 # H100显存大
69gradient_accumulation_steps: 2 # 8卡LoRA不需要太大的累积
70eval_batch_size: 8
71
72# 优化器设置
73optimizer: adamw_torch_fused
74lr_scheduler: cosine_with_restarts
75cosine_restarts: 2 # 每个epoch重启一次
76learning_rate: 4e-5
77warmup_ratio: 0.03
78weight_decay: 0.05
79
80# 精度设置
81bf16: auto # H100支持bf16
82tf32: true
83gradient_checkpointing: true # 节省显存
84flash_attention: true
85
86# 日志和保存
87logging_steps: 30
88evals_per_epoch: 1
89saves_per_epoch: 1
90save_total_limit: 3 # 只保留最新的3个checkpoint
91
92# 多卡训练配置 - 使用DeepSpeed而不是FSDP
93deepspeed: /workspace/axolotl/deepspeed_configs/zero2.json # 或者直接内联配置
94
95# 其他优化
96ddp_timeout: 3600 # DDP超时设置
97ddp_find_unused_parameters: false # LoRA通常不需要
98| Training Loss | Epoch | Step | Validation Loss | Mem Active(gib) | Mem Allocated(gib) | Mem Reserved(gib) |
|---|---|---|---|---|---|---|
| No log | 0 | 0 | 0.5713 | 88.01 | 88.01 | 88.7 |
| 0.0669 | 1.0 | 113 | 0.0590 | 114.45 | 114.45 | 132.41 |
| 0.0594 | 2.0 | 226 | 0.0567 | 114.45 | 114.45 | 132.51 |