Downloads · 30 days
6
11% of all-time downloads
liuyanliang/qwen3-4b-instruct-modern-to-luxun-api-lora-fast
qwen3-4b-instruct-modern-to-luxun-api-lora-fast is a text generation model from liuyanliang. Use it when you need the model to write or continue text. It is set up for peft.
This repository contains a LoRA adapter for Qwen/Qwen3-4B-Instruct-2507. It was fine-tuned for Chinese modern-text rewriting in a Lu Xun-inspired prose style.
Downloads · 30 days
6
11% of all-time downloads
All-time downloads
57
Public
Repo size
144 MB
Likes
1
Public
Click a slice to open those files.
.safetensors132 MB · 89%
From the Hugging Face model README
This repository contains a LoRA adapter for Qwen/Qwen3-4B-Instruct-2507.
It was fine-tuned for Chinese modern-text rewriting in a Lu Xun-inspired prose style.
本仓库只包含 LoRA adapter,不包含 Qwen3-4B 基座模型权重。推理时需要同时加载基座模型和本 adapter。
Qwen/Qwen3-4B-Instruct-2507This adapter is intended for the Classical Chinese NLP demo backend in the luxun_style route.
It can also be loaded manually with transformers and peft.
The model is intended for stylistic rewriting experiments and demos. It should not be used as an authoritative representation of Lu Xun's original writing.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
base_model = "Qwen/Qwen3-4B-Instruct-2507"
adapter = "liuyanliang/qwen3-4b-instruct-modern-to-luxun-api-lora-fast"
tokenizer = AutoTokenizer.from_pretrained(base_model, trust_remote_code=True)
if tokenizer.pad_token_id is None:
tokenizer.pad_token = tokenizer.eos_token
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.float16,
)
model = AutoModelForCausalLM.from_pretrained(
base_model,
trust_remote_code=True,
device_map="auto",
quantization_config=quantization_config,
)
model = PeftModel.from_pretrained(model, adapter)
model.eval()
For this project backend:
export CCNLP_QWEN_BASE_MODEL=Qwen/Qwen3-4B-Instruct-2507
export CCNLP_LUXUN_ADAPTER=liuyanliang/qwen3-4b-instruct-modern-to-luxun-api-lora-fast
PYTHONPATH=src uvicorn ccnlp.api_server:app --host 127.0.0.1 --port 8000
The adapter was trained for the project's Lu Xun style-transfer task. In the project code, prompts are built by ccnlp.causal_sft.build_generation_prompt.
For best results, use the same prompt construction logic as the backend.
adapter_model.safetensors: LoRA adapter weightsadapter_config.json: PEFT adapter configuration