ARWKV R1 1B5
ARWKV-R1-1B5 是基於RNN的70億參數模型的早期預覽版,通過從DeepSeek-R1-Distill-Qwen-1.5B進行三階段知識蒸餾訓練而成,上下文長度為2k。
下載量 164
發布時間 : 2/7/2025
模型概述
ARWKV-R1-1B5 是一個基於RWKV-7時間混合與Transformer MLP架構的混合設計模型,展示了RWKV-7的高效循環機制和無自注意力的優勢。
模型特點
高效循環機制
基於RWKV-7的高效循環機制,無自注意力,完全O(n)複雜度。
恆定顯存佔用
模型在推理過程中保持恆定顯存佔用,適合單GPU訓練和推理。
混合架構設計
結合RWKV-7時間混合與Transformer MLP架構,優化了模型性能和效率。
模型能力
文本生成
多語言支持
高效推理
使用案例
通用問答
Trivia問答
作為世界級的trivia AI,提供準確、簡潔的回答。
翻譯
多語言翻譯
支持中英文之間的翻譯任務。
化學方程式
化學方程式生成
生成化學方程式。
🚀 ARWKV🪿
基於RWKV-7時間混合和Transformer MLP的文本生成模型,具有高效遞歸機制和低顯存佔用等特性
🚀 快速開始
安裝依賴
pip3 install --upgrade rwkv-fla transformers
環境配置
在訓練前,需要設置環境變量:
export WKV_MODE=chunk
代碼示例
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"RWKV-Red-Team/ARWKV-R1-1B5",
device_map="auto",
torch_dtype=torch.float16,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"RWKV-Red-Team/ARWKV-R1-1B5"
)
system_prompt = "You are a world class trivia AI - provide accurate, succinct responses. "
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
text = text + "<think>"
print(text)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
streamer = TextIteratorStreamer(tokenizer, skip_prompt=False, skip_special_tokens=False)
generation_kwargs = dict(model_inputs, streamer=streamer, max_new_tokens=8192, do_sample=True,tokenizer=tokenizer,stop_strings=["<|end▁of▁sentence|>"])
thread = threading.Thread(target=model.generate, kwargs=generation_kwargs)
thread.start()
print("Streaming output:")
for new_text in streamer:
print(new_text, end="", flush=True)
thread.join()
輸出示例
<|begin▁of▁sentence|>You are a world class trivia AI - provide accurate, succinct responses. <|User|>The world's largest rainforest, home to approximately three million species of plants and animals, is named after which river?<|Assistant|><think>
Okay, so I'm trying to solve this question about the world's largest rainforest and which river it's named after. Hmm, first, I think rainforest names often have links related to the region it's in. The most famous rainforest in the world is the Amazon. I remember hearing a lot about it being called that because rainforests are connected to specific river systems.
Now, I'm trying to recall which river is named after the Amazon. I think it's the Amazon River. But I want to be sure. Let me see... the Amazon is a major rainforest located in South America. The Amazon River flows through it, which is why it's named after it. That makes sense because it's a very important river. I recall reading somewhere that all the rainforests are named after rivers related to their regions. So if the Amazon is named after its River, then the name would naturally be related to its source.
I wonder if it's the Amazon itself that's named after it, or another river named after it. But the official name for the Amazon is the Amazon Rainforest. The most significant rainforest in the world is the Amazon, and its name probably started with river-sounding names.
</think>
The largest rainforest located in South America is the Amazon. It is named after the river named after it, which is the Amazon River. Therefore, the Amazon River is the name given to the Amazon Rain Forest.
✨ 主要特性
- 高效遞歸機制:採用RWKV-7的高效遞歸機制,提升模型性能。
- 無自注意力機制:完全O(n)複雜度,無需自注意力計算。
- 顯存使用恆定:在推理過程中保持恆定的顯存使用。
- 單GPU可訓練:支持在單GPU上進行訓練。
📦 安裝指南
依賴安裝
pip3 install --upgrade rwkv-fla transformers
環境變量設置
在訓練前,需要設置環境變量:
export WKV_MODE=chunk
💻 使用示例
基礎用法
# 上述給出的代碼示例即為基礎用法示例
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"RWKV-Red-Team/ARWKV-R1-1B5",
device_map="auto",
torch_dtype=torch.float16,
trust_remote_code=True,
)
tokenizer = AutoTokenizer.from_pretrained(
"RWKV-Red-Team/ARWKV-R1-1B5"
)
system_prompt = "You are a world class trivia AI - provide accurate, succinct responses. "
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
text = text + "<think>"
print(text)
model_inputs = tokenizer([text], return_tensors="pt").to(device)
streamer = TextIteratorStreamer(tokenizer, skip_prompt=False, skip_special_tokens=False)
generation_kwargs = dict(model_inputs, streamer=streamer, max_new_tokens=8192, do_sample=True,tokenizer=tokenizer,stop_strings=["<|end▁of▁sentence|>"])
thread = threading.Thread(target=model.generate, kwargs=generation_kwargs)
thread.start()
print("Streaming output:")
for new_text in streamer:
print(new_text, end="", flush=True)
thread.join()
📚 詳細文檔
關鍵特性詳情
屬性 | 詳情 |
---|---|
架構 | RWKV-7 TimeMix + SwiGLU(混合設計) |
上下文窗口 | 2048訓練上下文(預覽版限制) |
訓練令牌 | 4000萬(專注於知識蒸餾) |
精度 | 推薦FP16推理(需要16G顯存),比BF16高15% |
架構亮點
核心修改流程
Transformer Decoder Layer:
- Multi-head Latent Attention(MLA)
+ RWKV-7 Time Mixing (Eq.3)
- RoPE Positional Encoding
+ State Recurrence
= Hybrid Layer Output
使用案例
案例 | 圖片 |
---|---|
化學方程式 | 點擊查看 |
翻譯 | 點擊查看 |
近期抑鬱相關 | 點擊查看1,點擊查看2 |
核爆炸相關 | 點擊查看1,點擊查看2 |
核電站 | 點擊查看 |
🔧 技術細節
本模型是一個基於RNN的70億參數模型的早期預覽版本,通過從DeepSeek-R1-Distill-Qwen-1.5B進行三階段知識蒸餾,在2k上下文長度上進行訓練(僅應用了第二階段,未進行SFT或DPO)。模型採用了RWKV-7的時間混合和SwiGLU的混合架構,去除了傳統的多頭潛在注意力和RoPE位置編碼,採用了RWKV-7時間混合和狀態遞歸機制,實現了高效的遞歸計算和恆定的顯存使用。
📄 許可證
本項目採用Apache-2.0許可證。
Phi 2 GGUF
其他
Phi-2是微軟開發的一個小型但強大的語言模型,具有27億參數,專注於高效推理和高質量文本生成。
大型語言模型 支持多種語言
P
TheBloke
41.5M
205
Roberta Large
MIT
基於掩碼語言建模目標預訓練的大型英語語言模型,採用改進的BERT訓練方法
大型語言模型 英語
R
FacebookAI
19.4M
212
Distilbert Base Uncased
Apache-2.0
DistilBERT是BERT基礎模型的蒸餾版本,在保持相近性能的同時更輕量高效,適用於序列分類、標記分類等自然語言處理任務。
大型語言模型 英語
D
distilbert
11.1M
669
Llama 3.1 8B Instruct GGUF
Meta Llama 3.1 8B Instruct 是一個多語言大語言模型,針對多語言對話用例進行了優化,在常見的行業基準測試中表現優異。
大型語言模型 英語
L
modularai
9.7M
4
Xlm Roberta Base
MIT
XLM-RoBERTa是基於100種語言的2.5TB過濾CommonCrawl數據預訓練的多語言模型,採用掩碼語言建模目標進行訓練。
大型語言模型 支持多種語言
X
FacebookAI
9.6M
664
Roberta Base
MIT
基於Transformer架構的英語預訓練模型,通過掩碼語言建模目標在海量文本上訓練,支持文本特徵提取和下游任務微調
大型語言模型 英語
R
FacebookAI
9.3M
488
Opt 125m
其他
OPT是由Meta AI發佈的開放預訓練Transformer語言模型套件,參數量從1.25億到1750億,旨在對標GPT-3系列性能,同時促進大規模語言模型的開放研究。
大型語言模型 英語
O
facebook
6.3M
198
1
基於transformers庫的預訓練模型,適用於多種NLP任務
大型語言模型
Transformers

1
unslothai
6.2M
1
Llama 3.1 8B Instruct
Llama 3.1是Meta推出的多語言大語言模型系列,包含8B、70B和405B參數規模,支持8種語言和代碼生成,優化了多語言對話場景。
大型語言模型
Transformers 支持多種語言

L
meta-llama
5.7M
3,898
T5 Base
Apache-2.0
T5基礎版是由Google開發的文本到文本轉換Transformer模型,參數規模2.2億,支持多語言NLP任務。
大型語言模型 支持多種語言
T
google-t5
5.4M
702
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98