Downloads · 30 days
39
100% of all-time downloads
tchbcb/samai-27b
samai-27b is a text generation model from tchbcb. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
将 samai-4b (tchbcb/samai-4b) 的自适应计算改造方案移植到 Qwen/Qwen3.8-27B 的 27B 因果/图文语言模型。骨干权重原样保留, 新增模块按稠密等价原则初始化 (零 router = 初始与基座逐位可对拍), 可直接进入下游 SFT。
Downloads · 30 days
39
100% of all-time downloads
All-time downloads
39
Public
Parameters
27.8B
58.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors56.1 GB · 100%
From the Hugging Face model README
将 samai-4b (tchbcb/samai-4b) 的自适应计算改造方案移植到 Qwen/Qwen3.8-27B 的 27B 因果/图文语言模型。骨干权重原样保留, 新增模块按稠密等价原则初始化 (零 router = 初始与基座逐位可对拍), 可直接进入下游 SFT。
from transformers import AutoModelForImageTextToText, AutoTokenizer
import torch
m = AutoModelForImageTextToText.from_pretrained(
"tchbcb/samai-27b", trust_remote_code=True,
dtype=torch.bfloat16, device_map="auto")
tok = AutoTokenizer.from_pretrained("tchbcb/samai-27b")
out = m.generate(**tok.apply_chat_template(
[{"role": "user", "content": "你好"}], add_generation_prompt=True,
tokenize=True, return_dict=True), max_new_tokens=256)
print(m.ponder_stats()) # 每层 executed 步数 / 平均思考步数 / MoE 激活专家数
AutoModelForCausalLM / AutoModel 亦注册到同一实现 (trust_remote_code=True)m.config.ponder_forced_steps=1 (等价模式/直通), max_ponder_steps,
commit_kv 等ponder_loss_beta KL 正则 (Geometric 先验), 停机头 bias +4 起步moe_aux_weight 负载均衡; router 从零起步, SFT 后稀疏化 (4b 实测 8→1.4~4.8)mtp_loss_weight 控制 t+2 预测项 (推理旁路, 仅辅助训练)s27_convert.py (流式: 逐分片 下载→手术→上传→删除, 断点续传)s27_smoke.py; 建模代码 modeling_samai_27b.py (单文件, 依赖
transformers ≥5.8 的 qwen3_5 原生实现)samai-2b (r18) → samai-4b (XHToken/Spark-X2.5-4B) → samai-27b (Qwen3.8-27B); PonderNet 思想源自 PonderNet/ACT, MoE 路由为 Switch 式, MTP 结构对齐 DeepSeek-V3。