|
--- |
|
language: |
|
- zh |
|
- en |
|
license: gpl-3.0 |
|
tags: |
|
- deepseek |
|
- qwen |
|
- lora |
|
- text-generation |
|
- causal-lm |
|
- approval |
|
- distilled |
|
pipeline_tag: text-generation |
|
model-index: |
|
- name: Approval Bureau Merged Model |
|
results: |
|
- task: |
|
type: text-generation |
|
name: Text Generation |
|
metrics: |
|
- type: perplexity |
|
value: "N/A" |
|
name: Perplexity |
|
--- |
|
|
|
# Approval Bureau Merged Model (审批局合并模型) |
|
|
|
这个模型是将基础模型 DeepSeek-R1-Distill-Qwen-32B 与 approval_bureau_model_lora 适配器合并后的结果。 |
|
|
|
## 模型基本信息 |
|
|
|
- **基础模型**: DeepSeek-R1-Distill-Qwen-32B |
|
- **LoRA适配器**: approval_bureau_model_lora |
|
- **模型类型**: 因果语言模型 (Causal Language Model) |
|
- **参数规模**: 32B |
|
- **语言支持**: 中英双语,以中文为主 |
|
|
|
## 模型特点 |
|
|
|
- 基于强大的DeepSeek-R1-Distill-Qwen-32B架构 |
|
- 融合了审批局专用的LoRA微调层 |
|
- 适用于文档审核、文本生成和内容审批相关场景 |
|
- 保留了基础模型的推理能力,同时增强了特定领域功能 |
|
|
|
## 使用方法 |
|
|
|
### 使用Transformers加载模型 |
|
|
|
```python |
|
from transformers import AutoModelForCausalLM, AutoTokenizer |
|
import torch |
|
|
|
# 设置模型路径 |
|
model_path = "distill/approval-bureau-merged" # 或使用本地路径 |
|
|
|
# 加载模型和分词器 |
|
tokenizer = AutoTokenizer.from_pretrained(model_path) |
|
model = AutoModelForCausalLM.from_pretrained( |
|
model_path, |
|
torch_dtype=torch.float16, # 使用半精度可节省内存 |
|
device_map="auto" # 自动分配到可用设备 |
|
) |
|
|
|
# 生成文本示例 |
|
input_text = "请审核以下文档内容:" |
|
inputs = tokenizer(input_text, return_tensors="pt").to(model.device) |
|
outputs = model.generate( |
|
inputs.input_ids, |
|
max_length=500, |
|
temperature=0.7, |
|
top_p=0.9 |
|
) |
|
response = tokenizer.decode(outputs[0], skip_special_tokens=True) |
|
print(response) |
|
流式输出示例 |
|
pythonCopyfrom transformers import TextIteratorStreamer |
|
from threading import Thread |
|
|
|
# 初始化流式输出 |
|
streamer = TextIteratorStreamer(tokenizer, skip_special_tokens=True) |
|
|
|
# 创建生成参数 |
|
generation_kwargs = { |
|
"input_ids": inputs.input_ids, |
|
"max_length": 500, |
|
"temperature": 0.7, |
|
"top_p": 0.9, |
|
"streamer": streamer |
|
} |
|
|
|
# 在后台线程中运行生成 |
|
thread = Thread(target=model.generate, kwargs=generation_kwargs) |
|
thread.start() |
|
|
|
# 流式输出结果 |
|
for text in streamer: |
|
print(text, end="", flush=True) |
|
注意事项 |
|
|
|
该模型需要较大的GPU内存(推荐至少24GB以上) |
|
对于内存受限的环境,建议使用4-bit或8-bit量化 |
|
模型输出仅供参考,关键决策请结合人工审核 |
|
|
|
许可证 |
|
本模型使用GPL-3.0许可证。使用前请确保了解相关许可条款。 |
|
致谢 |
|
感谢DeepSeek和Qwen团队提供的基础模型,以及所有为模型训练和调优做出贡献的开发者。 |
|
Copy |