Downloads · 30 days
16
17% of all-time downloads
FutureMa/Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH
Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH is a text generation model from FutureMa. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This is a LoRA fine-tuned version of Qwen/Qwen2.5-7B-Instruct on the Alpaca-GPT4-ZH dataset.
Downloads · 30 days
16
17% of all-time downloads
All-time downloads
94
Public
Repo size
243 MB
Likes
0
Public
Click a slice to open those files.
.pt162 MB · 67%
From the Hugging Face model README
This is a LoRA fine-tuned version of Qwen/Qwen2.5-7B-Instruct on the Alpaca-GPT4-ZH dataset.
Model: Qwen/Qwen2.5-7B-Instruct
Training Type: LoRA
Quantization: 4-bit (BitsAndBytes)
LoRA Rank: 8
LoRA Alpha: 32
Target Modules: all-linear
Batch Size: 1
Gradient Accumulation: 4 steps
Learning Rate: 1e-4
Epochs: 1
Max Length: 2048
Training Loss: 1.395
GPU Memory: ~7GB
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA weights
model = PeftModel.from_pretrained(
base_model,
"FutureMa/Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH"
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
# Generate response
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "解释什么是人工智能"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.7,
top_p=0.9,
)
response = tokenizer.decode(
outputs[0][len(inputs.input_ids[0]):],
skip_special_tokens=True
)
print(response)
# Inference with fine-tuned model
swift infer --ckpt_dir FutureMa/Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH
Question: "给出三个健康饮食的建议"
Base Model Response:
Fine-tuned Model Response:
The fine-tuned model shows improved:
If you use this model, please cite:
@misc{qwen2.5-7b-lora-alpaca-zh,
author = {FutureMa},
title = {Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH},
year = {2025},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/FutureMa/Qwen2.5-7B-Instruct-LoRA-Alpaca-ZH}}
}
This model is released under the Apache 2.0 license, following the base model's licensing.