junshengma commited on
Commit
28ba560
·
verified ·
1 Parent(s): ee7ee45

Add files using upload-large-folder tool

Browse files
README.md CHANGED
@@ -12,17 +12,24 @@ tags:
12
  pipeline_tag: text-generation
13
  ---
14
 
15
- # Qwythos-9B-WeChat
16
 
17
  基于 [empero-ai/Qwythos-9B-Claude-Mythos-5-1M](https://huggingface.co/empero-ai/Qwythos-9B-Claude-Mythos-5-1M)(Qwen3.5-9B 架构)LoRA 微调后合并的模型,专用于生成**微信公众号科技 / AI / 新闻类文章**(Markdown 格式输出)。
18
 
 
 
 
 
 
 
 
19
  ## 训练细节
20
 
21
- - **训练数据**:2459 篇清洗后的公众号科技类文章(instruction → Markdown 正文)
22
- - **方法**:LoRA(r=16, alpha=16, dropout=0.05),目标模块 q/k/v/o/gate/up/down projections
23
- - **训练参数**:3 epochs,序列长度 4096,有效 batch size 8,lr 2e-4(cosine),BF16
24
- - **硬件**:单卡 RTX 5090D 32GB(Windows 原生),训练用时约 11.3 小时
25
- - **收敛**:loss 2.86 → ~1.8,token 准确率 44% → 63%
26
 
27
  ## 使用
28
 
@@ -30,7 +37,7 @@ pipeline_tag: text-generation
30
  import torch
31
  from transformers import AutoModelForImageTextToText, AutoTokenizer
32
 
33
- model_id = "junshengma/Qwythos-9B-WeChat"
34
  tok = AutoTokenizer.from_pretrained(model_id)
35
  model = AutoModelForImageTextToText.from_pretrained(
36
  model_id, dtype=torch.bfloat16, device_map="auto"
@@ -45,18 +52,19 @@ inputs = tok.apply_chat_template(
45
  msgs, add_generation_prompt=True, tokenize=True,
46
  return_dict=True, return_tensors="pt"
47
  ).to(model.device)
48
- out = model.generate(**inputs, max_new_tokens=1500, temperature=0.7, top_p=0.9, do_sample=True)
49
  print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
50
  ```
51
 
52
- 也可以用 vLLM 部署 OpenAI 兼容 API(32GB 显存下建议 `--max-model-len 49152`):
53
-
54
  ```bash
55
- vllm serve junshengma/Qwythos-9B-WeChat --max-model-len 49152 --gpu-memory-utilization 0.92
 
 
 
56
  ```
57
 
58
  ## 说明
59
 
60
- - 模型保留了基座的推理(thinking)能力,会先规划文章结构再输出正文
61
  - 权重按 4GB 分片保存,避免 Windows 下超大单文件 mmap 问题
62
- - `lora-adapter/` 目录内附训练得到的原始 LoRA adapter(111MB),可单独配合基座模型使用
 
12
  pipeline_tag: text-generation
13
  ---
14
 
15
+ # Qwythos-9B-WeChat (v2)
16
 
17
  基于 [empero-ai/Qwythos-9B-Claude-Mythos-5-1M](https://huggingface.co/empero-ai/Qwythos-9B-Claude-Mythos-5-1M)(Qwen3.5-9B 架构)LoRA 微调后合并的模型,专用于生成**微信公众号科技 / AI / 新闻类文章**(Markdown 格式输出)。
18
 
19
+ ## v2 相对 v1 的改进
20
+
21
+ - 清洗规则增强:清除来源声明、加星标、点赞引导、往期推荐、编辑署名等 boilerplate
22
+ - 粗体独立行还原为 `##` 小标题,训练数据结构化排版占比从 5% → 55%
23
+ - 训练超参:2 epochs、lr 1e-4(v1 为 3 epochs / 2e-4,减轻过拟合与复读)
24
+ - 推理建议:`repetition_penalty=1.1`,vLLM 加 `--reasoning-parser qwen3`
25
+
26
  ## 训练细节
27
 
28
+ - **训练数据**:2398 篇二次清洗后的公众号科技类文章
29
+ - **方法**:LoRA(r=16, alpha=16, dropout=0.05)
30
+ - **训练参数**:2 epochs,序列长度 4096,有效 batch size 8,lr 1e-4(cosine),BF16
31
+ - **硬件**:单卡 RTX 5090D 32GB(Windows 原生),约 5.2 小时
32
+ - **收敛**:train_loss ≈ 2.26
33
 
34
  ## 使用
35
 
 
37
  import torch
38
  from transformers import AutoModelForImageTextToText, AutoTokenizer
39
 
40
+ model_id = "junshengma/Qwythos-9B-WeChat" # 或本地 D:/models/Qwythos-9B-WeChat-v2
41
  tok = AutoTokenizer.from_pretrained(model_id)
42
  model = AutoModelForImageTextToText.from_pretrained(
43
  model_id, dtype=torch.bfloat16, device_map="auto"
 
52
  msgs, add_generation_prompt=True, tokenize=True,
53
  return_dict=True, return_tensors="pt"
54
  ).to(model.device)
55
+ out = model.generate(**inputs, max_new_tokens=1500, temperature=0.8, top_p=0.95, repetition_penalty=1.1)
56
  print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
57
  ```
58
 
 
 
59
  ```bash
60
+ vllm serve junshengma/Qwythos-9B-WeChat \
61
+ --max-model-len 49152 \
62
+ --gpu-memory-utilization 0.90 \
63
+ --reasoning-parser qwen3
64
  ```
65
 
66
  ## 说明
67
 
68
+ - 模型保留基座推理(thinking)能力;部署时请用 reasoning parser 分离思考与正文
69
  - 权重按 4GB 分片保存,避免 Windows 下超大单文件 mmap 问题
70
+ - `lora-adapter/` 目录内附原始 LoRA adapter(111MB)
lora-adapter/adapter_config.json CHANGED
@@ -30,13 +30,13 @@
30
  "rank_pattern": {},
31
  "revision": null,
32
  "target_modules": [
33
- "gate_proj",
34
- "q_proj",
35
  "down_proj",
36
  "o_proj",
37
- "up_proj",
38
  "v_proj",
39
- "k_proj"
 
 
40
  ],
41
  "target_parameters": null,
42
  "task_type": "CAUSAL_LM",
 
30
  "rank_pattern": {},
31
  "revision": null,
32
  "target_modules": [
33
+ "k_proj",
 
34
  "down_proj",
35
  "o_proj",
 
36
  "v_proj",
37
+ "up_proj",
38
+ "gate_proj",
39
+ "q_proj"
40
  ],
41
  "target_parameters": null,
42
  "task_type": "CAUSAL_LM",
lora-adapter/adapter_model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4ae915f67a65187d53ee6e0f0e2497d4d99dfc44018268e1594bec3ea6dd8953
3
  size 116429720
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3970bc718cf438d56e7d608bbf073e01dad7cb8f5a9bc646113e1a293dc936da
3
  size 116429720
model-00002-of-00006.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fc68da8774a993c50306569e8669850655402434f173cb5df09e675afb87a336
3
- size 3999617760
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:659566955b7c3ab74ca9ad21b3a54f82d00bf12c946907423730e3ac114d66fe
3
+ size 3999615808
model-00003-of-00006.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:39b90ea2b4d2f02198d54d1d36f031713b0a300ac1f32029acca5a38f412b8f1
3
- size 3997277760
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:073d16a4567e216b02e092c5efb1686dc0f3d99bb994b6d181ca76d9661c5301
3
+ size 3997274128
model-00004-of-00006.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:52ac1afcd9b73b45b61d73b75a0a3ba176894f92b632a4f2fe79e9e19a212772
3
- size 3997294592
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05032c12b941c567cfa19a8e962c3f7eb365abf0e357690cd8851eee09fd8974
3
+ size 3997290904
model-00005-of-00006.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dbb9d524db2d84318f53ea229d1710f71249feb4ff1d300d67def8a58c85b4e0
3
- size 3991243424
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b7221618e05b1f46de22dde34f4012d168a04f471d66f31c2448f8bacd386e6
3
+ size 3991239264
model-00006-of-00006.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3a4102282545dc41cfa7372464c16b54f8ef73c60e75ef377830bc8f6435f9d6
3
- size 800067168
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db688e61fd7575e8537120bc7aaeff043d31d6ca2bafa14df1135c969a081013
3
+ size 800062816