BitTorrent スタイルで大規模な言語モデルを自宅で実行します。
オフロードよりも最大 10 倍高速な微調整と推論
分散型Llama 3.1 (最大 405B)、 Mixtral (8x22B)、 Falcon (40B+)、またはBLOOM (176B) を使用してテキストを生成し、デスクトップ コンピューターまたは Google Colab から直接、独自のタスクに合わせてテキストを微調整します。
from transformers import AutoTokenizer
from petals import AutoDistributedModelForCausalLM
# Choose any model available at https://health.petals.dev
model_name = "meta-llama/Meta-Llama-3.1-405B-Instruct"
# Connect to a distributed network hosting model layers
tokenizer = AutoTokenizer . from_pretrained ( model_name )
model = AutoDistributedModelForCausalLM . from_pretrained ( model_name )
# Run the model as if it were on your computer
inputs = tokenizer ( "A cat sat" , return_tensors = "pt" )[ "input_ids" ]
outputs = model . generate ( inputs , max_new_tokens = 5 )
print ( tokenizer . decode ( outputs [ 0 ])) # A cat sat on a mat...
Colab で今すぐ試してみる
?ラマを走らせたいですか?重みへのアクセスをリクエストし、モデルをロードする前にターミナルでhuggingface-cli login
実行します。または、チャットボット アプリで試してみてください。
?プライバシー。あなたのデータは、パブリックスウォーム内の他の人々の助けを借りて処理されます。プライバシーについて詳しくは、こちらをご覧ください。機密データの場合は、信頼できる人々の間でプライベート Swarm を設定できます。
何か質問はありますか? Discord で連絡してください。
Petals はコミュニティによって運営されているシステムです。私たちは人々が GPU を共有していることに依存しています。利用可能なモデルの 1 つを提供したり、新しいモデルをホストしたりできます。モデルハブ!
例として、Llama 3.1 (405B) 命令の一部を GPU でホストする方法を次に示します。
?ラマをホストしてみませんか?重みへのアクセスをリクエストし、モデルをロードする前にターミナルでhuggingface-cli login
実行します。
? Linux + アナコンダ。 NVIDIA GPU の場合は次のコマンドを実行します (AMD の場合はこれに従います)。
conda install pytorch pytorch-cuda=11.7 -c pytorch -c nvidia
pip install git+https://github.com/bigscience-workshop/petals
python -m petals.cli.run_server meta-llama/Meta-Llama-3.1-405B-Instruct
? Windows + WSL。 Wiki のこのガイドに従ってください。
?ドッカー。 NVIDIA GPU の場合は Docker イメージを実行します (AMD の場合はこれに従います)。
sudo docker run -p 31330:31330 --ipc host --gpus all --volume petals-cache:/cache --rm
learningathome/petals:main
python -m petals.cli.run_server --port 31330 meta-llama/Meta-Llama-3.1-405B-Instruct
? macOS + Apple M1/M2 GPU。 Homebrew をインストールし、次のコマンドを実行します。
brew install python
python3 -m pip install git+https://github.com/bigscience-workshop/petals
python3 -m petals.cli.run_server meta-llama/Meta-Llama-3.1-405B-Instruct
詳細(複数の GPU の使用方法、ブート時にサーバーを起動する方法など)
安全。サーバーをホストすると、他の人があなたのコンピュータ上でカスタム コードを実行することはできなくなります。詳細については、こちらをご覧ください。
何か質問はありますか? Discord で連絡してください。
?ありがとう! 10 個以上のブロックをロードしてホストすると、感謝の気持ちを込めて、あなたの名前またはリンクが群モニターに表示されます。 --public_name YOUR_NAME
を使用して指定できます。
論文を読むFAQ を見る
基本的なチュートリアル:
便利なツール:
上級ガイド:
私たちの論文のセクション 3.3 を参照してください。
貢献に関するよくある質問をご覧ください。
アレクサンダー・ボルズノフ、ドミトリー・バランチュク、ティム・デットマース、マックス・リャビニン、ユネス・ベルカダ、アルテム・チュマチェンコ、パベル・サマイギン、コリン・ラフェル。 Petals: 大規模モデルの共同推論と微調整。計算言語学協会の第 61 回年次総会の議事録 (第 3 巻: システムのデモンストレーション)。 2023年。
@inproceedings { borzunov2023petals ,
title = { Petals: Collaborative Inference and Fine-tuning of Large Models } ,
author = { Borzunov, Alexander and Baranchuk, Dmitry and Dettmers, Tim and Riabinin, Maksim and Belkada, Younes and Chumachenko, Artem and Samygin, Pavel and Raffel, Colin } ,
booktitle = { Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 3: System Demonstrations) } ,
pages = { 558--568 } ,
year = { 2023 } ,
url = { https://arxiv.org/abs/2209.01188 }
}
アレクサンダー・ボルズノフ、マックス・リャビニン、アルチョム・チュマチェンコ、ドミトリー・バランチュク、ティム・デットマース、ユーネス・ベルカダ、パベル・サマイギン、コリン・ラフェル。インターネットを介した大規模な言語モデルの分散推論と微調整。神経情報処理システムの進歩36 (2023)。
@inproceedings { borzunov2023distributed ,
title = { Distributed inference and fine-tuning of large language models over the {I}nternet } ,
author = { Borzunov, Alexander and Ryabinin, Max and Chumachenko, Artem and Baranchuk, Dmitry and Dettmers, Tim and Belkada, Younes and Samygin, Pavel and Raffel, Colin } ,
booktitle = { Advances in Neural Information Processing Systems } ,
volume = { 36 } ,
pages = { 12312--12331 } ,
year = { 2023 } ,
url = { https://arxiv.org/abs/2312.08361 }
}
このプロジェクトは、BigScience 研究ワークショップの一部です。