Model Overview
Model Features
Model Capabilities
Use Cases
🚀 RedPajama-INCITE-7B-Instruct
RedPajama-INCITE-7B-Instruct 是由 Together 以及開源 AI 社區的領導者們共同開發的,這些領導者來自 Ontocord.ai、ETH DS3Lab、AAI CERC、蒙特利爾大學、魁北克人工智能研究所(MILA)、斯坦福基礎模型研究中心(CRFM)、斯坦福 Hazy Research 研究小組和 LAION。該模型在 GPT-JT 的數據上針對少樣本應用進行了微調,同時排除了與 HELM 核心場景重疊的任務。
🚀 快速開始
請注意,該模型需要 transformers
版本 >= 4.25.1。
GPU 推理
這需要一個具有 16GB 內存的 GPU。
import torch
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
MIN_TRANSFORMERS_VERSION = '4.25.1'
# 檢查 transformers 版本
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'請將 transformers 升級到 {MIN_TRANSFORMERS_VERSION} 或更高版本。'
# 初始化
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct", torch_dtype=torch.float16)
model = model.to('cuda:0')
# 推理
prompt = "Q: The capital of France is?\nA:"
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
input_length = inputs.input_ids.shape[1]
outputs = model.generate(
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
)
token = outputs.sequences[0, input_length:]
output_str = tokenizer.decode(token)
print(output_str)
"""
Paris
"""
Int8 格式的 GPU 推理
這需要一個具有 12GB 內存的 GPU。
要使用 int8 進行推理,請確保你已經安裝了 accelerate 和 bitandbytes。你可以使用以下命令安裝它們:
pip install accelerate
pip install bitsandbytes
然後你可以按如下方式使用 int8 進行推理:
import torch
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
MIN_TRANSFORMERS_VERSION = '4.25.1'
# 檢查 transformers 版本
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'請將 transformers 升級到 {MIN_TRANSFORMERS_VERSION} 或更高版本。'
# 初始化
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct", device_map='auto', torch_dtype=torch.float16, load_in_8bit=True)
# 推理
prompt = "Q: The capital of France is?\nA:"
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
input_length = inputs.input_ids.shape[1]
outputs = model.generate(
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
)
token = outputs.sequences[0, input_length:]
output_str = tokenizer.decode(token)
print(output_str)
"""
Paris
"""
CPU 推理
import torch
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
MIN_TRANSFORMERS_VERSION = '4.25.1'
# 檢查 transformers 版本
assert transformers.__version__ >= MIN_TRANSFORMERS_VERSION, f'請將 transformers 升級到 {MIN_TRANSFORMERS_VERSION} 或更高版本。'
# 初始化
tokenizer = AutoTokenizer.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct")
model = AutoModelForCausalLM.from_pretrained("togethercomputer/RedPajama-INCITE-7B-Instruct", torch_dtype=torch.bfloat16)
# 推理
prompt = "Q: The capital of France is?\nA:"
inputs = tokenizer(prompt, return_tensors='pt').to(model.device)
input_length = inputs.input_ids.shape[1]
outputs = model.generate(
**inputs, max_new_tokens=128, do_sample=True, temperature=0.7, top_p=0.7, top_k=50, return_dict_in_generate=True
)
token = outputs.sequences[0, input_length:]
output_str = tokenizer.decode(token)
print(output_str)
"""
Paris
"""
請注意,由於 LayerNormKernelImpl
未針對 CPU 的 fp16 進行實現,因此我們在 CPU 推理時使用 bfloat16
。
✨ 主要特性
模型詳情
屬性 | 詳情 |
---|---|
開發者 | Together Computer |
模型類型 | 語言模型 |
語言 | 英語 |
許可證 | Apache 2.0 |
模型描述 | 一個具有 69 億參數的預訓練語言模型 |
模型版本
- 基礎模型:RedPajama-INCITE-7B-Base
- 指令微調版本:RedPajama-INCITE-7B-Instruct
- 聊天版本:RedPajama-INCITE-7B-Chat
示例展示
情感分析
Label the sentences as either 'positive', 'negative', 'mixed', or 'neutral':
Sentence: I can say that there isn't anything I would change.
Label: positive
Sentence: I'm not sure about this.
Label: neutral
Sentence: I liked some parts but I didn't like other parts.
Label: mixed
Sentence: I think the background image could have been better.
Label: negative
Sentence: I really like it.
Label: positive
問答系統
Please answer the following question:
Question: What is the capital of Canada?
Answer: Ottawa
Question: What is the currency of Switzerland?
Answer: Swiss franc
Question: In which country is Wisconsin located?
Answer: United States
主題分類
Given a news article, classify its topic.
Possible labels: 1. World 2. Sports 3. Business 4. Sci/Tech
Article: A nearby star thought to harbor comets and asteroids now appears to be home to planets, too.
Label: Sci/Tech
Article: Soaring crude prices plus worries about the economy and the outlook for earnings are expected to hang over the stock market next week during the depth of the summer doldrums.
Label: Business
Article: Murtagh a stickler for success Northeastern field hockey coach Cheryl Murtagh doesn't want the glare of the spotlight that shines on her to detract from a team that has been the America East champion for the past three years and has been to the NCAA tournament 13 times.
Label: Sports
句子改寫
Paraphrase the given sentence into a different sentence.
Input: Can you recommend some upscale restaurants in New York?
Output: What upscale restaurants do you recommend in New York?
Input: What are the famous places we should not miss in Paris?
Output: Recommend some of the best places to visit in Paris?
Input: Could you recommend some hotels that have cheap price in Zurich?
Output: Can you recommend some inexpensive hotels in Zurich?
文本摘要
Given a review from Amazon's food products, the task is to generate a short summary of the given review in the input.
Input: I have bought several of the Vitality canned dog food products and have found them all to be of good quality. The product looks more like a stew than a processed meat and it smells better. My Labrador is finicky and she appreciates this product better than most.
Output: Good Quality Dog Food
Input: Product arrived labeled as Jumbo Salted Peanuts...the peanuts were actually small sized unsalted. Not sure if this was an error or if the vendor intended to represent the product as 'Jumbo'.
Output: Not as Advertised
Input: My toddler loves this game to a point where he asks for it. That's a big thing for me. Secondly, no glitching unlike one of their competitors (PlayShifu). Any tech I don’t have to reach out to support for help is a good tech for me. I even enjoy some of the games and activities in this. Overall, this is a product that shows that the developers took their time and made sure people would not be asking for refund. I’ve become bias regarding this product and honestly I look forward to buying more of this company’s stuff. Please keep up the great work.
Output: Great Kids' Game
詞義消歧
Identify which sense of a word is meant in a given context.
Context: The river overflowed the bank.
Word: bank
Sense: river bank
Context: A mouse takes much more room than a trackball.
Word: mouse
Sense: computer mouse
Context: The bank will not be accepting cash on Saturdays.
Word: bank
Sense: commercial (finance) banks
Context: Bill killed the project
Word: kill
Sense: terminate
自然語言推理
Given a pair of sentences, choose whether the two sentences agree (entailment)/disagree (contradiction) with each other.
Possible labels: 1. entailment 2. contradiction
Sentence 1: The skier was on the edge of the ramp. Sentence 2: The skier was dressed in winter clothes.
Label: entailment
Sentence 1: The boy skated down the staircase railing. Sentence 2: The boy is a newbie skater.
Label: contradiction
Sentence 1: Two middle-aged people stand by a golf hole. Sentence 2: A couple riding in a golf cart.
Label: contradiction
推理參數
參數 | 值 |
---|---|
temperature | 0.7 |
top_p | 0.7 |
top_k | 50 |
max_new_tokens | 128 |
📚 詳細文檔
使用方式
直接使用
以下是被排除的使用場景說明。
不當使用、惡意使用和超出範圍的使用
最終用戶有責任確保模型以負責任和符合道德的方式使用。
超出範圍的使用
RedPajama-INCITE-7B-Instruct 是一個語言模型,對於其預期範圍之外的其他用例可能表現不佳。例如,它可能不適用於安全關鍵型應用或用於做出對個人或社會有重大影響的決策。重要的是要考慮模型的侷限性,僅將其用於預期目的。
不當使用和惡意使用
RedPajama-INCITE-7B-Instruct 是為語言建模而設計的。對模型的不當使用,例如使用它從事非法或不道德的活動,是嚴格禁止的,並且違反了項目的原則。
使用該模型生成對個人殘酷的內容是對該模型的不當使用。這包括但不限於:
- 生成假新聞、錯誤信息或宣傳內容
- 宣揚仇恨言論、歧視或對個人或群體的暴力行為
- 在未經同意的情況下冒充個人或組織
- 進行網絡欺凌或騷擾
- 誹謗性內容
- 垃圾郵件或詐騙
- 在沒有適當授權的情況下分享機密或敏感信息
- 違反模型或用於訓練它的數據的使用條款
- 創建用於惡意目的的自動化機器人,如傳播惡意軟件、釣魚詐騙或垃圾郵件
侷限性
RedPajama-INCITE-7B-Instruct 與其他語言模型一樣,有一些需要考慮的侷限性。例如,該模型可能並不總是提供準確或相關的答案,特別是對於複雜、模糊或超出其訓練數據範圍的問題。因此,我們歡迎個人和組織的貢獻,並鼓勵合作以創建一個更強大和包容的聊天機器人。
訓練信息
訓練數據
請參考 togethercomputer/RedPajama-Data-1T。
訓練過程
- 硬件:8 塊 A100 GPU
- 優化器:Adam
- 梯度累積:1
- 令牌數量:10 億個令牌
- 學習率:1e - 5
社區參與
加入我們的 Together Discord 社區。
📄 許可證
本項目採用 Apache 2.0 許可證。



