Downloads · 30 days
94
43% of all-time downloads
cjkasbdkjnlakb/qwen3-4b-agent-0927-qc
qwen3-4b-agent-0927-qc is a text generation model from cjkasbdkjnlakb. 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.
这是一个经过fine-tuning的qwen3模型,基于 Qwen/Qwen3-4B-Instruct-2507 进行训练。
Downloads · 30 days
94
43% of all-time downloads
All-time downloads
217
Public
Parameters
4B
8.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
这是一个经过fine-tuning的qwen3模型,基于 Qwen/Qwen3-4B-Instruct-2507 进行训练。
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 设置请注意这是一个fine-tuned模型,在特定任务上可能有更好的表现,但也可能在某些通用任务上性能有所变化。建议在使用前进行充分测试。