Downloads · 30 days
0
galoyoung/guancha-qwen
guancha-qwen is a machine learning model from galoyoung. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Dec 22, 2025
Repo size
144 MB
Likes
0
Public
Click a slice to open those files.
.safetensors132 MB · 89%
From the Hugging Face model README
<a name="english"></a>
This is a LoRA adapter fine-tuned on the Guancha.cn (观察者网) news dataset, based on Qwen/Qwen3-4B-Instruct-2507. The model uses LoRA (Low-Rank Adaptation) technology to enable the base model to answer political and current affairs questions in the analytical style of Guancha.cn, while retaining the general capabilities of the original model.
This model is suitable for:
⚠️ Important: This is a LoRA adapter, not a complete model. You need to load it with the base model.
from transformers import AutoTokenizer
from peft import AutoPeftModelForCausalLM
import torch
# Load the adapter (automatically merges with base model)
model = AutoPeftModelForCausalLM.from_pretrained(
"galoyoung/guancha-qwen",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"galoyoung/guancha-qwen",
trust_remote_code=True
)
# Use the model
messages = [{"role": "user", "content": "Why did Macron visit China in December?"}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.8,
do_sample=True
)
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[1]:],
skip_special_tokens=True
)
print(response)
llamafactory-cli chat \
--model_name_or_path Qwen/Qwen3-4B-Instruct-2507 \
--adapter_name_or_path galoyoung/guancha-qwen
# This won't work! This is an adapter, not a complete model
from transformers import pipeline
pipe = pipeline("text-generation", model="galoyoung/guancha-qwen") # ❌ Will error
The training data comes from Q&A pairs collected from the Guancha.cn Official Zhihu Account, crawled and organized using the open-source tool MediaCrawler. The dataset has been cleaned and formatted, converted to the standard ChatML format.
If you use this model in your research, please cite:
@misc{guancha-qwen-lora,
title={Qwen3-4B-Instruct-2507-Guancha-LoRA},
author={galoyoung},
year={2025},
howpublished={\url{https://huggingface.co/galoyoung/guancha-qwen}}
}
This model is released under the same license as the base model Qwen/Qwen3-4B-Instruct-2507.
This model is for research and educational purposes only. The training data content belongs to the original author (Guancha.cn) and the platform (Zhihu). Please comply with relevant terms of service and copyright laws when using this model.
<a name="chinese"></a>
这是一个基于 Qwen/Qwen3-4B-Instruct-2507 使用**观察者网(Guancha.cn)**新闻数据集进行微调的 LoRA 适配器模型。本模型采用 LoRA(Low-Rank Adaptation)技术,使基础模型能够以"观察者网"的新闻分析风格回答时政问题,同时保持原模型的通用能力。
本模型适用于:
⚠️ 重要提示: 这是一个 LoRA 适配器,不是完整的模型。使用时需要配合基础模型加载。
from transformers import AutoTokenizer
from peft import AutoPeftModelForCausalLM
import torch
# 加载适配器(会自动合并基础模型)
model = AutoPeftModelForCausalLM.from_pretrained(
"galoyoung/guancha-qwen",
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(
"galoyoung/guancha-qwen",
trust_remote_code=True
)
# 使用模型
messages = [{"role": "user", "content": "法国总统马克龙将于 12 月初访华,为何会在此时访华?"}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.8,
do_sample=True
)
response = tokenizer.decode(
outputs[0][inputs.input_ids.shape[1]:],
skip_special_tokens=True
)
print(response)
llamafactory-cli chat \
--model_name_or_path Qwen/Qwen3-4B-Instruct-2507 \
--adapter_name_or_path galoyoung/guancha-qwen
# 这样不行!因为这是一个适配器,不是完整模型
from transformers import pipeline
pipe = pipeline("text-generation", model="galoyoung/guancha-qwen") # ❌ 会报错
训练数据来源于从观察者网知乎官方账号收集的问答对,通过开源工具 MediaCrawler 爬取并整理获得。数据集经过清洗和格式化处理,转换为标准的 ChatML 格式。
如果您在研究中使用此模型,请引用:
@misc{guancha-qwen-lora,
title={Qwen3-4B-Instruct-2507-Guancha-LoRA},
author={galoyoung},
year={2025},
howpublished={\url{https://huggingface.co/galoyoung/guancha-qwen}}
}
本模型遵循与基础模型 Qwen/Qwen3-4B-Instruct-2507 相同的许可证。
本模型仅供学术研究和教育用途。训练数据内容的版权归原作者(观察者网)及平台(知乎)所有。在使用本模型时,请遵守相关的服务条款及版权法律法规。
license: other base_model: Qwen/Qwen3-4B-Instruct-2507 library_name: peft tags: