🚀 rwkv7-0.1B-g1
これは、Flash線形注意力機構に基づくRWKV-7 g1モデルです。g1
シリーズのモデルは大量のデータを追加し、深度思考能力を組み込んでいます。
🚀 クイックスタート
このモデルを使用する前に、flash-linear-attention
と最新バージョンのtransformers
をインストールしてください。
pip install git+https://github.com/fla-org/flash-linear-attention
pip install 'transformers>=4.48.0'
✨ 主な機能
- 多言語対応:英語、中国語、日本語、韓国語、フランス語、アラビア語、スペイン語、ポルトガル語など、多くの言語をサポートしています。
- 深度思考能力:
g1
モデルシリーズには深度思考能力が組み込まれています。
📦 インストール
flash-linear-attention
と最新バージョンのtransformers
をインストールします。
pip install git+https://github.com/fla-org/flash-linear-attention
pip install 'transformers>=4.48.0'
💻 使用例
基本的な使用法
他のHuggingFaceモデルと同じようにこのモデルを使用することができます。
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained('fla-hub/rwkv7-0.1B-g1', trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained('fla-hub/rwkv7-0.1B-g1', trust_remote_code=True)
model = model.cuda()
prompt = "What is a large language model?"
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=1024,
do_sample=True,
temperature=1.0,
top_p=0.3,
repetition_penalty=1.2
)
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=False)[0]
print(response)
📚 ドキュメント
モデル詳細
属性 |
详情 |
开发者 |
Bo Peng, Yu Zhang, Songlin Yang, Ruichong Zhang |
資助者 |
RWKVプロジェクト(LF AI & Data財団に所属) |
モデルタイプ |
RWKV7 |
サポート言語(NLP) |
多言語 |
ライセンス |
Apache-2.0 |
パラメータ数 |
1.91億 |
トークナイザー |
RWKV Worldトークナイザー |
語彙数 |
65,536 |
モデルのソース
- リポジトリ:https://github.com/fla-org/flash-linear-attention ; https://github.com/BlinkDL/RWKV-LM
- 論文:https://arxiv.org/abs/2503.14456
学習データ
このモデルはWorld v3.5で学習されており、合計で5兆以上のトークンが含まれています。
🔧 技術詳細
よくある質問
Q: safetensorsのメタデータが空です。
A: transformers
を>=4.48.0にアップグレードしてください:pip install 'transformers>=4.48.0'
思考プロンプト
<|rwkv_tokenizer_end_of_text|>User: <あなたの質問>
Assistant: <think
<think
の括弧を閉じないでください!
プロンプトの追加注意事項
⚠️ 重要な注意
常にあなたのプロンプトの前に<|rwkv_tokenizer_end_of_text|>
(トークンID = 0)を追加してください。状態初期化の問題により、モデルは受け取った最初のトークンを処理できません。
誤ったプロンプトの例:
Mathews lifted a dark brow. "Are you sure about that? I mean, wouldn't it be better to wait until Dale is home safe and sound?"
"The longer I wait to tell her, the worse it will be for both of us."
"Good luck. You're going to need it," said
モデルは Mathews
を思い出せません。なぜなら、これが入力の最初のトークンだからです。
正しいプロンプトの例:
<|rwkv_tokenizer_end_of_text|>Mathews lifted a dark brow. "Are you sure about that? I mean, wouldn't it be better to wait until Dale is home safe and sound?"
"The longer I wait to tell her, the worse it will be for both of us."
"Good luck. You're going to need it," said
モデルは Mathews
を予想通りに出力します。
このトークンがない場合:lambada_openai ppl=13.84 acc=48.13%
このトークンを追加した後:lambada_openai ppl=12.36 acc=49.12%
注意:この現象はTransformersでは非常にまれですが、RNNでは明らかです。私たちは、モデルが最初のトークンを使用して状態を固定し、それ以降のトークンから情報をより良く取得するためだと推測しています。
📄 ライセンス
このモデルはApache-2.0ライセンスの下で提供されています。