Files
ModelHub XC 1bd4836ef0 初始化项目,由ModelHub XC社区提供模型
Model: JavaFamily/corvus-gov-3B
Source: Original Platform
2026-11-11 16:36:12 +08:00

157 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
license: Apache License 2.0
tags:
- 政衡
- 政企大模型
- 政务 AI 大模型
- JavaFamily
- 微调
- LLaMA-Factory
- LoRA
- SFT
- 政务领域
- 中文对话
tasks:
- text-generation
#model-type:
##如 gpt、phi、llama、chatglm、baichuan 等
#- gpt
model_type: llama3
#domain:
##如 nlp、cv、audio、multi-modal
#- nlp
#language:
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
#- cn
#metrics:
##如 CIDEr、Blue、ROUGE 等
#- CIDEr
#tags:
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
#- pretrained
#tools:
##如 vllm、fastchat、llamacpp、AdaSeq 等
#- vllm
base_model:
- LLM-Research/Llama-3.2-3B-Instruct
base_model_relation: finetune
language:
- zh
metrics:
- accuracy
---
# Corvus-Gov-3B
当大模型从实验室涌向政务大厅,考验的不是才华,而是分寸。行政边界一字之差,政策口径一厘之偏,足以让信任归零。
「政衡」corvus-gov 基于 Llama3/Qwen3 基座模型,在百万级中文政务领域对话数据集上完成 SFT 微调。训练采用 LoRA 轻量化微调方案。 以衡为名,百万数据精训为每一句政务回答校准刻度。这不是参数的竞赛,而是关于可信的承诺。政企 AI 落地,自此有衡。
- 训练框架:LLaMA Factory
- 对话模板:`llama3`/`qwen3`
## Training Loss
训练 loss 曲线如下图所示,loss 随训练 step 平稳下降,模型收敛效果良好:
![training loss](https://www.modelscope.cn/models/JavaFamily/corvus-gov-3B/resolve/main/loss_plot.png)
## Training Data
- 数据规模:百万级中文政务领域对话样本
- 训练方式:LoRA SFT 有监督微调
- 训练框架:LLaMA Factory
## Quickstart
### ModelScope Python SDK
```python
from modelscope import AutoTokenizer, AutoModelForCausalLM
model_id = "JavaFamily/corvus-gov-3B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="auto",
device_map="auto"
)
messages = [
{"role": "system", "content": "你是政务领域智能助手,请严谨、准确回答用户问题。"},
{"role": "user", "content": "请介绍一下政务咨询相关政策。"}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to("cuda")
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9
)
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]
print(response)
```
### vLLM 快速推理(推荐部署)
```python
from vllm import LLM, SamplingParams
model_id = "JavaFamily/corvus-gov-3B"
sampling_params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=512)
llm = LLM(model=model_id)
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
outputs = llm.generate(prompt, sampling_params)
print(outputs[0].outputs[0].text)
```
#### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型
1)ModelScope 下载
```bash
#安装ModelScope
pip install modelscope
```
* CLI 命令下载
```shell
# cli 下载
modelscope download --model JavaFamily/corvus-gov-3B --local_dir ./llama3/corvus‑gov‑3B
```
* SDK下载
```python
#SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('JavaFamily/corvus-gov-3B')
```
2) Git下载
```
#Git模型下载
git clone https://www.modelscope.cn/JavaFamily/corvus-gov-3B.git
```
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>