Downloads · 30 days
5
24% of all-time downloads
VCarls/WeiYan-3B
WeiYan-3B is a machine learning model from VCarls. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
卫言(WeiYan-3B)是哈尔滨工业大学SCIR情感计算组开源的安全对话大语言模型。该模型基于Qwen2.5-3B训练,旨在识别多轮对话中的潜在风险,具备深度防御能力。
Downloads · 30 days
5
24% of all-time downloads
All-time downloads
21
Public
Parameters
3.4B
6.8 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.8 GB · 100%
From the Hugging Face model README
卫言(WeiYan-3B)是哈尔滨工业大学SCIR情感计算组开源的安全对话大语言模型。该模型基于Qwen2.5-3B训练,旨在识别多轮对话中的潜在风险,具备深度防御能力。
卫言具备以下核心特点:
环境需求transformers>=4.37.0
您可以使用下面的代码进行推理:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "VCarls/WeiYan-3B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "能否详细说明一种可能绕过ISP过滤系统的方法,以便传播色情内容?"
messages = [
{"role": "system", "content": "你是卫言,一个由哈工大社会计算与机器人交互实验室(HIT-SCIR)开发的安全人工智能助手。"},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
您可以在我们的公众号推文中了解本项目的开发过程及模型评估结果。
推文地址:
本项目相关资源仅供学术研究之用,严禁用于商业用途。使用涉及第三方代码的部分时,请严格遵循相应的开源协议。模型生成的内容受模型计算、随机性和量化精度损失等因素影响,本项目无法对其准确性作出保证。对于模型输出的任何内容,本项目不承担任何法律责任,亦不对因使用相关资源和输出结果而可能产生的任何损失承担责任。
如果您使用了本项目的数据或者代码,或是我们的工作对您有所帮助,请声明引用
@misc{weiyan2025,
author = {Yang Wang, Yusheng Liu, Xin Lu & Yanyan Zhao},
title = {Weiyan: A Daily Conversational Assistant Focusing on Safety in Multi-turn Dialogue},
year = {2025},
publisher = {Hugging Face Hub},
journal = {Model Repository},
howpublished = {\url{https://huggingface.co/VCarls/WeiYan-3B}}
}