🚀 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微調模型的優勢進行融合,從而實現代碼和數學能力的結合。在運行模型時,用戶可以根據自己的需求選擇合適的接口和參數,以獲得最佳的使用效果。
📄 許可證
文檔未提及許可證相關信息。