cjkasbdkjnlakb/qwen3-4b-agent-0927-qc
这是一个经过fine-tuning的qwen3模型,基于 Qwen/Qwen3-4B-Instruct-2507 进行训练。
模型详情
- 基础模型: Qwen/Qwen3-4B-Instruct-2507
- 模型类型: qwen3
- 架构: Qwen3ForCausalLM
- 词汇表大小: 151,936 tokens
- 隐藏层大小: 2560
- 层数: 36
- 注意力头数: 32
- 模型大小: ~7.49 GB
- 最大序列长度: 2048
使用方法
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# 加载模型和tokenizer
model_name = "cjkasbdkjnlakb/qwen3-4b-agent-0927-qc"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
# 推理示例
def chat(messages):
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.7,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id
)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
return response
# 使用示例
messages = [
{"role": "user", "content": "你好,请介绍一下你自己。"}
]
response = chat(messages)
print(response)
训练信息
该模型使用 Axolotl 框架进行fine-tuning。
注意事项
- 建议使用
torch.bfloat16或torch.float16精度以节省显存 - 根据你的硬件配置调整
device_map设置 - 模型遵循原始模型的license条款
性能
请注意这是一个fine-tuned模型,在特定任务上可能有更好的表现,但也可能在某些通用任务上性能有所变化。建议在使用前进行充分测试。
- Downloads last month
- 4
Model tree for cjkasbdkjnlakb/qwen3-4b-agent-0927-qc
Base model
Qwen/Qwen3-4B-Instruct-2507