news-classifier/ml-module/config.yaml

33 lines
979 B
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BERT模型训练配置
database:
url: "mysql+pymysql://root:root@localhost/news_classifier" # 数据库连接URL
data_limit: 1000 # 加载数据量限制
model:
name: "bert-base-chinese" # 模型名称
num_labels: 9 # 分类数量
output_dir: "./models/deep_learning/bert_finetuned" # 模型输出目录
training:
use_gpu: true # 是否使用GPU自动检测
epochs: 3 # 训练轮数
batch_size: 8 # 训练批大小
learning_rate: 2e-5 # 学习率
warmup_steps: 500 # 预热步数
weight_decay: 0.01 # 权重衰减
fp16: null # 混合精度null表示自动检测
# 日志和输出配置
logging:
level: "INFO" # 日志级别
file: "./training.log" # 日志文件
# 设备配置
device:
max_memory: "8GB" # 最大内存限制
gradient_checkpointing: true # 梯度检查点
# 性能优化
optimization:
gradient_accumulation_steps: 1 # 梯度累积步数
mixed_precision: true # 混合精度(如果支持)