在家中運行 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
。或者只是在我們的聊天機器人應用程式中嘗試。
?隱私。您的資料將在公眾群體中其他人的幫助下進行處理。在此了解更多有關隱私的資訊。對於敏感數據,您可以在您信任的人之間建立一個私人群組。
有疑問嗎?請在我們的 Discord 中聯絡我們!
Petals 是一個社群運作的系統——我們依賴人們分享他們的 GPU。您可以幫助提供可用模型之一或從 託管新模型?模型中心!
作為範例,以下是如何在 GPU 上託管 Llama 3.1 (405B) Instruct 的一部分:
?想接待駱駝嗎?請求存取其權重,然後在載入模型之前在終端機中執行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
來指定它們。
閱讀論文查看常見問題解答
基礎教學:
有用的工具:
高級指南:
請參閱我們論文的第 3.3 節。
請參閱我們有關貢獻的常見問題。
亞歷山大·博爾祖諾夫、德米特里·巴蘭丘克、提姆·戴特默斯、馬克斯·裡亞賓寧、尤尼斯·貝爾卡達、阿喬姆·丘馬琴科、帕維爾·薩米金和科林·拉斐爾。花瓣:大型模型的協作推理與微調。計算語言學協會第 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 研究研討會的一部分。