V5 Eagle 7B HF
RWKV-5 Eagle 7B是基於RWKV架構的7B參數規模大語言模型,支持中文文本生成任務
下載量 6,788
發布時間 : 1/29/2024
模型概述
該模型是基於RWKV架構的大語言模型,專注於中文文本生成任務,可作為智能助手提供專業解答
模型特點
高效推理
支持在CPU和GPU上高效運行,提供流暢的文本生成體驗
中文優化
專門針對中文文本生成進行優化,提供符合中文表達習慣的輸出
對話友好
內置對話模板,適合構建智能助手類應用
模型能力
中文文本生成
問答系統
知識解答
對話系統
使用案例
智能助手
旅遊諮詢
提供旅遊景點介紹和推薦
能詳細描述北京等城市的著名景點信息
知識問答
回答各類知識性問題
如對大熊貓等動物知識的準確描述
內容生成
信息摘要
生成特定主題的簡明摘要
能對城市、動物等主題提供結構化信息
🚀 Huggingface RWKV - 5 Eagle 7B模型
本項目是基於Huggingface Transformers庫實現的RWKV - 5 Eagle 7B模型。它能為自然語言處理任務提供強大的支持,可在CPU和GPU上運行,還支持批量推理。
🚀 快速開始
重要提示
⚠️ 重要提示
以下是RWKV - 5 Eagle 7B模型的Huggingface Transformers實現,此實現僅適用於Huggingface Transformers庫。
若要獲取完整的模型權重以用於其他RWKV庫,請參考[此處](https://huggingface.co/RWKV/v5 - Eagle - 7B)。
這不是一個經過指令微調的模型!(很快會有...)
相關鏈接
- [HF演示](https://huggingface.co/spaces/BlinkDL/RWKV - Gradio - 2)
- 項目維基
- [pth模型權重](https://huggingface.co/RWKV/v5 - Eagle - 7B)
模型運行示例
在CPU上通過HF Transformers運行
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("RWKV/HF_v5-Eagle-7B", trust_remote_code=True).to(torch.float32)
tokenizer = AutoTokenizer.from_pretrained("RWKV/HF_v5-Eagle-7B", trust_remote_code=True)
text = "請介紹北京的旅遊景點"
prompt = generate_prompt(text)
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(inputs["input_ids"], max_new_tokens=333, do_sample=True, temperature=1.0, top_p=0.3, top_k=0, )
print(tokenizer.decode(output[0].tolist(), skip_special_tokens=True))
輸出示例:
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: 請介紹北京的旅遊景點
Assistant: 北京是中國的首都,擁有眾多的旅遊景點,以下是其中一些著名的景點:
1. 故宮:位於北京市中心,是明清兩代的皇宮,內有大量的文物和藝術品。
2. 天安門廣場:是中國最著名的廣場之一,是中國人民政治協商會議的舊址,也是中國人民政治協商會議的中心。
3. 頤和園:是中國古代皇家園林之一,有著悠久的歷史和豐富的文化內涵。
4. 長城:是中國古代的一道長城,全長約萬里,是中國最著名的旅遊景點之一。
5. 北京大學:是中國著名的高等教育機構之一,有著悠久的歷史和豐富的文化內涵。
6. 北京動物園:是中國最大的動物園之一,有著豐富的動物資源和豐富的文化內涵。
7. 故宮博物院:是中國最著名的博物館之一,收藏了大量的文物和藝術品,是中國最重要的文化遺產之一。
8. 天壇:是中國古代皇家
在GPU上通過HF Transformers運行
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("RWKV/HF_v5-Eagle-7B", trust_remote_code=True, torch_dtype=torch.float16).to(0)
tokenizer = AutoTokenizer.from_pretrained("RWKV/HF_v5-Eagle-7B", 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))
輸出示例:
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: 介紹一下大熊貓
Assistant: 大熊貓是一種中國特有的哺乳動物,也是中國的國寶之一。它們的外貌特徵是圓形的黑白相間的身體,有著黑色的毛髮和白色的耳朵。大熊貓的食物主要是竹子,它們會在竹林中尋找竹子,並且會將竹子放在竹籠中進行儲存。大熊貓的壽命約為20至30年,但由於棲息地的喪失和人類活動的
批量推理
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("RWKV/HF_v5-Eagle-7B", trust_remote_code=True).to(torch.float32)
tokenizer = AutoTokenizer.from_pretrained("RWKV/HF_v5-Eagle-7B", trust_remote_code=True)
texts = ["請介紹北京的旅遊景點", "介紹一下大熊貓", "烏蘭察布"]
prompts = [generate_prompt(text) for text in texts]
inputs = tokenizer(prompts, return_tensors="pt", padding=True)
outputs = model.generate(inputs["input_ids"], max_new_tokens=128, do_sample=True, temperature=1.0, top_p=0.3, top_k=0, )
for output in outputs:
print(tokenizer.decode(output.tolist(), skip_special_tokens=True))
輸出示例:
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: 請介紹北京的旅遊景點
Assistant: 北京是中國的首都,擁有豐富的旅遊資源和歷史文化遺產。以下是一些北京的旅遊景點:
1. 故宮:位於北京市中心,是明清兩代的皇宮,是中國最大的古代宮殿建築群之一。
2. 天安門廣場:位於北京市中心,是中國最著名的城市廣場之一,也是中國最大的城市廣場。
3. 頤和
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: 介紹一下大熊貓
Assistant: 大熊貓是一種生活在中國中部地區的哺乳動物,也是中國的國寶之一。它們的外貌特徵是圓形的黑白相間的身體,有著黑色的毛髮和圓圓的眼睛。大熊貓是一種瀕危物種,目前只有在野外的幾個保護區才能看到它們的身影。大熊貓的食物主要是竹子,它們會在竹子上尋找食物,並且可以通
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: 烏蘭察布
Assistant: 烏蘭察布是中國新疆維吾爾自治區的一個縣級市,位於新疆維吾爾自治區中部,是新疆的第二大城市。烏蘭察布市是新疆的第一大城市,也是新疆的重要城市之一。烏蘭察布市是新疆的經濟中心,也是新疆的重要交通樞紐之一。烏蘭察布市的人口約為2.5萬人,其中漢族佔絕大多數。烏
📄 許可證
本項目採用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