Mobius 是一款基于 RWKV v6 架构构建的大语言模型。作为一个融合了状态级 RNN、CNN 和 Transformer 优势的混合模型,它在海量数据上进行了预训练。相较于上一代 Mobius,新版本在性能和功能上均实现了显著突破。
| 架构 (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) |
您可以使用以下代码在 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))推荐的生成参数为:Temperature: 1, Top_p: 0.3
基本对话模板:
User: xxxx
Assistant: xxxMobius 支持 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
本项目遵循 开放原子模型许可证。