🚀 Ties合并代码、数学与推理模型
本项目是一个基于多个预训练语言模型合并而成的模型,借助 mergekit 工具,将多个Qwen 3微调模型进行合并,旨在融合代码和数学能力,为用户提供更强大的语言处理功能。
🚀 快速开始
本模型提供了多种运行方式,你可以根据自己的需求选择合适的接口。
📦 安装指南
本模型的运行依赖于 transformers
库,你可以使用以下命令进行安装:
pip install transformers
💻 使用示例
基础用法
以下是使用 transformers
库运行模型的示例代码:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "ertghiu256/Qwen3-4b-tcomanr-merge"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
try:
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("思考内容:", thinking_content)
print("生成内容:", content)
高级用法
除了 transformers
库,本模型还支持使用其他工具进行运行,以下是一些常见工具的使用示例:
vllm
vllm serve ertghiu256/Qwen3-4b-tcomanr-merge --enable-reasoning --reasoning-parser deepseek_r1
Sglang
python -m sglang.launch_server --model-path ertghiu256/Qwen3-4b-tcomanr-merge --reasoning-parser deepseek-r1
llama.cpp
llama-server --hf-repo ertghiu256/Qwen3-4b-tcomanr-merge
或者
llama-cli --hf ertghiu256/Qwen3-4b-tcomanr-merge
ollama
ollama run hf.co/ertghiu256/Qwen3-4b-tcomanr-merge:Q4_K_M
lm studio
在 lm studio
的模型搜索列表中搜索:
ertghiu256/Qwen3-4b-tcomanr-merge
然后下载使用。
推荐参数
温度 (temp): 0.6
上下文长度 (num_ctx): ≥8192
核采样概率 (top_p): 0.95
采样数量 (top_k): 10
📚 详细文档
合并详情
本模型使用 TIES 合并方法,以 Qwen/Qwen3-4B 为基础模型进行合并。
参与合并的模型
以下是参与合并的模型列表:
合并配置
以下是用于生成本模型的YAML配置文件:
models:
- model: ertghiu256/qwen3-math-reasoner
parameters:
weight: 0.7
- model: ertghiu256/qwen3-4b-code-reasoning
parameters:
weight: 0.8
- model: ertghiu256/qwen-3-4b-mixture-of-thought
parameters:
weight: 0.9
- model: POLARIS-Project/Polaris-4B-Preview
parameters:
weight: 0.7
- model: ertghiu256/qwen3-multi-reasoner
parameters:
weight: 0.8
- model: ValiantLabs/Qwen3-4B-Esper3
parameters:
weight: 0.8
- model: Tesslate/UIGEN-T3-4B-Preview-MAX
parameters:
weight: 0.8
- model: ValiantLabs/Qwen3-4B-ShiningValiant3
parameters:
weight: 0.9
- model: prithivMLmods/Crux-Qwen3_OpenThinking-4B
parameters:
weight: 0.4
merge_method: ties
base_model: Qwen/Qwen3-4B
parameters:
normalize: true
int8_mask: true
dtype: float16
🔧 技术细节
本模型的合并过程使用了先进的TIES合并方法,通过调整不同模型的权重,将多个Qwen 3微调模型的优势进行融合,从而实现代码和数学能力的结合。在运行模型时,用户可以根据自己的需求选择合适的接口和参数,以获得最佳的使用效果。
📄 许可证
文档未提及许可证相关信息。