🚀 MPT-7B-Chat
MPT-7B-Chatは、対話生成用のチャットボット型モデルです。このモデルは、MPT-7BをShareGPT-Vicuna、HC3、Alpaca、HH-RLHF、Evol-Instructのデータセットでファインチューニングすることで構築されました。
このモデルはMosaicMLによって訓練され、修正されたデコーダー専用のトランスフォーマーアーキテクチャに従っています。
🚀 クイックスタート
このモデルは、訓練とファインチューニングにはMosaicMLのllm-foundryリポジトリを使用するのが最適です。
import transformers
model = transformers.AutoModelForCausalLM.from_pretrained(
'mosaicml/mpt-7b-chat',
trust_remote_code=True
)
注意: このモデルでは、from_pretrained
メソッドにtrust_remote_code=True
を渡す必要があります。これは、Hugging Faceのtransformers
パッケージにまだ含まれていないカスタムMPT
モデルアーキテクチャを使用しているためです。MPT
には、FlashAttention、ALiBi、QK LayerNormなどの多くの訓練効率機能が含まれています。
FlashAttentionの最適化されたtriton実装を使用するには、attn_impl='triton'
とbfloat16
精度でモデルをGPU (cuda:0
) にロードすることができます。
import torch
import transformers
name = 'mosaicml/mpt-7b-chat'
config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
config.attn_config['attn_impl'] = 'triton'
config.init_device = 'cuda:0'
model = transformers.AutoModelForCausalLM.from_pretrained(
name,
config=config,
torch_dtype=torch.bfloat16,
trust_remote_code=True
)
モデルはシーケンス長2048で訓練されましたが、ALiBiにより、ユーザーはファインチューニングや推論時に最大シーケンス長を増やすことができます。例えば:
import transformers
name = 'mosaicml/mpt-7b-chat'
config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
config.max_seq_len = 4096
model = transformers.AutoModelForCausalLM.from_pretrained(
name,
config=config,
trust_remote_code=True
)
このモデルはEleutherAI/gpt-neox-20bトークナイザーで訓練されました。
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
モデルは、例えばテキスト生成パイプライン内で使用することができます。
注意: 低精度でTorchモジュールを実行する場合は、torch.autocastコンテキストマネージャーを使用するのがベストプラクティスです。
from transformers import pipeline
pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
with torch.autocast('cuda', dtype=torch.bfloat16):
print(
pipe('Here is a recipe for vegan banana bread:\n',
max_new_tokens=100,
do_sample=True,
use_cache=True))
✨ 主な機能
📚 ドキュメント
会話例
SamIAm85:
この記事の要約に基づいてツイートを考えてほしい:
"Introducing MPT-7B, the latest entry in our MosaicML Foundation Series.
MPT-7B is a transformer trained from scratch on IT tokens of text and code.
It is open source and it matches the quality of LLaMA-7B.
MPT-7B was trained on the MosaicML platform in 9.5 days with zero human intervention at a cost of ~$200k.
Starting today, you can train, finetune, and deploy your own private MPT models, either starting from one of our checkpoints or training from scratch.
For inspiration, we are also releasing three finetuned models in addition to the base MPT-7B: MPT-7B-Instruct, MPT-7B-Chat, and MPT-7B-Story Writer-65k+, the last of which uses a context length of 65k tokens!"
MPT-7B-Instruct:
これが私のツイートの提案です:
"Exciting news! @MosaicML has launched #MPT_7B - a new standard for open-source LLMs. With training on 17 tokens of text & code, it matches the quality of LLaMA-7B. Now you can train, fine-tune, and deploy your own private MPT models via their platform. Check out the full blog post here: https://bit.ly/3j6UJzZ"
SamIAm85:
この素晴らしいニュースについて、MosaicMLに何か言いたいことはありますか?
MPT-7B-Instruct:
私自身がAI言語モデルであるため、MosaicMLがこのような高品質のオープンソースLLMを開発する上で成し遂げた進歩に大きく感銘を受けています。
この新しいバージョンのMPT-7Bは本当に印象的で、開発者がこれらの強力なツールを使用してどのような革新的なアプリケーションを作成するか楽しみにしています。
AIの研究と開発を進めるためのあなた方の努力と献身に感謝します。
🔧 技術詳細
モデルの説明
アーキテクチャは、標準的なデコーダー専用のトランスフォーマーを修正したものです。
モデルは、標準的なトランスフォーマーから以下のように修正されています。
ハイパーパラメータ |
値 |
パラメータ数 |
67億 |
レイヤー数 |
32 |
ヘッド数 |
32 |
モデル次元 |
4096 |
語彙サイズ |
50432 |
シーケンス長 |
2048 |
訓練設定
このモデルは、MosaicML Platformを使用して、8台のA100-80GBで約8.2時間訓練した後、32台のA100-40GBで6.7時間訓練されました。モデルはFSDPを使用したシャード化データ並列で訓練され、AdamWオプティマイザーを使用しています。
📄 ライセンス
CC-By-NC-SA-4.0 (非商用利用のみ)
制限とバイアス
以下の文言はEleutherAI's GPT-NeoX-20Bから改変されています
MPT-7B-Chatは事実に誤りのある出力を生成する可能性があり、事実に基づく正確な情報を生成することに依存してはいけません。MPT-7B-Chatは様々な公開データセットで訓練されています。事前訓練データのクリーニングには多大な努力が払われていますが、このモデルが猥褻な、偏った、またはその他の不快な出力を生成する可能性があります。
謝辞
このモデルは、Sam HavensとMosaicMLのNLPチームによってファインチューニングされました。
免責事項
このモデルのライセンスは法的なアドバイスを構成するものではありません。このモデルを使用する第三者の行動については責任を負いません。商用目的でこのモデルを使用する前に、弁護士に相談してください。
MosaicMLプラットフォーム
MosaicML Platformで独自のMPTまたはLLMを訓練し、デプロイすることに興味がある場合は、こちらから登録してください。
引用
このモデルを引用する場合は、以下の形式を使用してください。
@online{MosaicML2023Introducing,
author = {MosaicML NLP Team},
title = {Introducing MPT-7B: A New Standard for Open-Source, Commercially Usable LLMs},
year = {2023},
url = {www.mosaicml.com/blog/mpt-7b},
note = {Accessed: 2023-03-28}, % change this date
urldate = {2023-03-28} % change this date
}