🚀 Tom-Qwen-7B-Instruct
这是一个经过微调的70亿参数模型,专门用于逐步执行指令和进行对话。
🚀 快速开始
本模型是基于Qwen/Qwen2.5 - 7B - Instruct微调而来,借助Unsloth框架和LoRA(低秩自适应)技术实现高效训练。以下是使用示例:
基础用法
from unsloth import FastLanguageModel
import torch
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="theprint/Tom-Qwen-7B-Instruct",
max_seq_length=4096,
dtype=None,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
inputs = tokenizer(["Your prompt here"], return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
高级用法:标准Transformers使用方式
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"theprint/Tom-Qwen-7B-Instruct",
torch_dtype=torch.float16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("theprint/Tom-Qwen-7B-Instruct")
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Your question here"}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
response = tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True)
print(response)
高级用法:使用llama.cpp
wget https://huggingface.co/theprint/Tom-Qwen-7B-Instruct/resolve/main/gguf/Tom-Qwen-7B-Instruct-q4_k_m.gguf
./llama.cpp/main -m Tom-Qwen-7B-Instruct-q4_k_m.gguf -p "Your prompt here" -n 256
✨ 主要特性
- 专门针对逐步指令和对话进行微调。
- 使用LoRA技术进行高效训练。
- 提供多种量化版本,方便不同场景使用。
📦 安装指南
文档未提及具体安装步骤,暂不提供。
📚 详细文档
模型详情
属性 |
详情 |
开发者 |
theprint |
模型类型 |
因果语言模型(使用LoRA微调) |
语言 |
英文 |
许可证 |
apache - 2.0 |
基础模型 |
Qwen/Qwen2.5 - 7B - Instruct |
微调方法 |
LoRA,秩为128 |
GGUF量化版本
你可以在/gguf - folder找到该模型的量化gguf版本。量化后的GGUF版本位于gguf/
目录,可用于llama.cpp:
Tom-Qwen-7B-Instruct-f16.gguf
(14531.9 MB) - 16位浮点数(原始精度,文件最大)
Tom-Qwen-7B-Instruct-q3_k_m.gguf
(3632.0 MB) - 3位量化(中等质量)
Tom-Qwen-7B-Instruct-q4_k_m.gguf
(4466.1 MB) - 4位量化(中等,推荐用于大多数用例)
Tom-Qwen-7B-Instruct-q5_k_m.gguf
(5192.6 MB) - 5位量化(中等,质量较好)
Tom-Qwen-7B-Instruct-q6_k.gguf
(5964.5 MB) - 6位量化(高质量)
Tom-Qwen-7B-Instruct-q8_0.gguf
(7723.4 MB) - 8位量化(非常高质量)
预期用途
对话、头脑风暴和一般指令执行。
训练详情
训练数据
为该模型专门创建的合成数据集,专注于实用技巧和幸福感。
- 数据集:theprint/Tom - 4.2k - alpaca
- 格式:alpaca
训练过程
- 训练轮数:3
- LoRA秩:128
- 学习率:0.0002
- 批量大小:4
- 框架:Unsloth + transformers + PEFT
- 硬件:NVIDIA RTX 5090
🔧 技术细节
本模型使用Unsloth框架和LoRA技术对Qwen/Qwen2.5 - 7B - Instruct进行微调。训练过程中,使用了专门创建的合成数据集,通过多轮训练和特定的学习率、批量大小等参数,在NVIDIA RTX 5090硬件上完成训练。同时,为了方便不同场景使用,还提供了多种量化版本。
📄 许可证
本模型使用apache - 2.0许可证。
局限性
该模型可能会产生幻觉或提供错误信息,不适合用于关键决策。
引用
如果使用此模型,请引用:
@misc{tom_qwen_7b_instruct,
title={Tom-Qwen-7B-Instruct: Fine-tuned Qwen/Qwen2.5-7B-Instruct},
author={theprint},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/theprint/Tom-Qwen-7B-Instruct}
}
致谢