公告
README
license: other library_name: transformers pipeline_tag: text-generation
1. 模型介绍 (Model Introduction)
Mobius 是一款基于 RWKV v6 架构构建的大语言模型。作为一个融合了状态级 RNN、CNN 和 Transformer 优势的混合模型,它在海量数据上进行了预训练。相较于上一代 Mobius,新版本在性能和功能上均实现了显著突破。
核心特性 (Key Features)
- 高效本地运行:在 FP16 精度下,仅需 24G 显存即可在本地流畅运行。
- 中文能力显著提升:针对中文理解与生成进行了深度优化,性能大幅增强。
- 超长上下文支持:稳定支持 16K 上下文长度,满足长文本处理需求。
- 函数调用 (Function Call):原生支持函数调用功能,能够与外部工具进行交互。
2. 模型概览 (Model Summary)
| 架构 (Architecture) | RWKV v6 (RNN) |
| 参数量 (Total Parameters) | 12B |
| 层数 (Number of Layers) | 32 |
| 隐藏层维度 (Hidden Dimension) | 5120 |
| 注意力头数 (Number of Attention Heads) | 80 |
| Head Size | 64 |
| 词表大小 (Vocabulary Size) | 65536 |
| 上下文长度 (Context Length) | 16K |
| Attention Mechanism | Linear Attention (RWKV) |
3. 部署方式 (Deployment)
硬件需求
- FP16: 约 21.9G VRAM
- INT8: 约 13.7G VRAM
- NF4: 约 7.2G VRAM (使用 Ai00 server)
使用 Hugging Face Transformers 运行
您可以使用以下代码在 GPU 上加载并运行 Mobius 模型:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
def generate_prompt(instruction, input=""):
instruction = instruction.strip().replace('\r\n','\n').replace('\n\n','\n')
input = input.strip().replace('\r\n','\n').replace('\n\n','\n')
if input:
return f"""Instruction: {instruction}
Input: {input}
Response:"""
else:
return f"""User: hi
Assistant: Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.
User: {instruction}
Assistant:"""
# 请确保已安装相关依赖并信任远程代码
model = AutoModelForCausalLM.from_pretrained("Mobius", trust_remote_code=True, torch_dtype=torch.float16).to(0)
tokenizer = AutoTokenizer.from_pretrained("Mobius", trust_remote_code=True)
text = "介绍一下大熊猫"
prompt = generate_prompt(text)
inputs = tokenizer(prompt, return_tensors="pt").to(0)
output = model.generate(inputs["input_ids"], max_new_tokens=128, do_sample=True, temperature=1.0, top_p=0.3, top_k=0)
print(tokenizer.decode(output[0].tolist(), skip_special_tokens=True))
4. 模型使用 (Model Usage)
对话格式 (Chat Format)
推荐的生成参数为:Temperature: 1, Top_p: 0.3
基本对话模板:
User: xxxx
Assistant: xxx
工具调用 (Tool Calling)
Mobius 支持 JSON 格式的函数定义与调用。
Function call 格式示例:
{
"name": "get_exchange_rate",
"description": "Get the exchange rate between two currencies",
"parameters": {
"type": "object",
"properties": {
"base_currency": {
"type": "string",
"description": "The currency to convert from"
},
"target_currency": {
"type": "string",
"description": "The currency to convert to"
}
},
"required": [
"base_currency",
"target_currency"
]
}
}
对话示例:
User: Hi, I need to know the exchange rate from USD to EUR
Assistant: xxxx
Observation: xxxx
Assistant: xxxx
5. 许可协议 (License)
本项目遵循 开放原子模型许可证。
热门项目
12
Mobius大模型是开放原子基金会开源项目,采用OpenAtom-Model-License-V1.0协议。具备强大的自然语言理解与生成能力,支持多场景应用开发,代码完全开放可商用,助力开发者快速构建智能应用,推动AI技术开源生态发展。
Python
12
0