""" 单元测试 — 训练模块 (Person C 实现后需通过) """ import pytest import torch class TestLabelSmoothedLoss: """测试标签平滑损失。""" def test_no_smoothing_equals_ce(self): """smoothing=0 时应等于标准交叉熵。""" pass def test_smoothing_reduces_confidence(self): """标签平滑应降低损失对正确预测的自信度。""" pass def test_ignore_padding(self): """应忽略 padding 位置的损失。""" pass class TestOptimizer: """测试优化器构建。""" def test_build_adamw(self): """测试构建 AdamW。""" pass def test_weight_decay_groups(self): """测试权重衰减参数组正确。""" pass class TestScheduler: """测试学习率调度器。""" def test_warmup_phase(self): """测试 warmup 阶段 lr 线性增长。""" pass def test_decay_phase(self): """测试衰减阶段 lr 下降。""" pass