大整理: 仓库重组 + 新词表 + 新README

- 清理仓库: 删除所有废弃的generate_*脚本和旧版数据文件
- 目录重组:
  - data/       → 训练数据
  - scripts/    → 数据生成脚本
  - templates/  → Web UI
- 重命名:
  - train_v2.py  → train.py
  - vocab_v3.json → vocab.json (BPE, 6.8k tokens)
- 更新 train.py 指向新词表路径
- 重写 README.md 完整文档
- 更新 .gitignore
This commit is contained in:
shuiyu1123 committed 2026-06-18 11:17:30 +00:00
1 parent 6e0ced4772
commit 231af72de9
26 files changed
+124 -126

No files matched your search

+11 -1
View File
@@ -786,7 +786,17 @@ class LLMChat:
outputs = self.model(seq)
# 获取最后一个时间步的预测
next_token_logits = outputs[0, -1, :] / temperature
logits = outputs[0, -1, :]
# 温度=0 → greedy解码(取概率最高的token)
if temperature == 0:
next_token = torch.argmax(logits).item()
generated.append(next_token)
new_token = torch.tensor([[next_token]], device=self.device)
input_tensor = torch.cat([input_tensor, new_token], dim=1)
continue
next_token_logits = logits / temperature
# === 重复惩罚 ===
# 1. 对最近生成的token进行惩罚(更强)