-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example: DeepSpeed deferred init with opt-30b (#2419)
* load from checkpoint * Deepspeed deferred init * DeepSpeed with opt-30b * Update examples/large_models/deepspeed/opt/Readme.md Co-authored-by: Hamid Shojanazeri <[email protected]> * fix lint * fix lint * move files * move files --------- Co-authored-by: Ubuntu <[email protected]> Co-authored-by: Hamid Shojanazeri <[email protected]>
- Loading branch information
1 parent
a77a150
commit 603e89f
Showing
9 changed files
with
90 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Loading large Huggingface models on Multiple GPUs | ||
|
||
This document briefs on serving large HuggingFace (HF) models on multiple GPUs using deepspeed. We are using facebook/opt-30b in this example | ||
|
||
To run this example we need to have deepspeed installed. This has been added to the requirement.txt which can be bundled during model packaging. | ||
|
||
|
||
```bash | ||
pip install deepspeed | ||
|
||
``` | ||
|
||
### Step 1: Download model | ||
|
||
```bash | ||
python ../utils/Download_model.py --model_path model --model_name facebook/opt-30b --revision main | ||
``` | ||
|
||
The script prints the path where the model is downloaded as below. | ||
|
||
`opt/model/models--facebook--opt-30b/snapshots/ceea0a90ac0f6fae7c2c34bcb40477438c152546` | ||
|
||
### Step 2: Generate mar or tgz file | ||
|
||
```bash | ||
torch-model-archiver --model-name opt --version 1.0 --handler custom_handler.py --extra-files ds-config.json -r requirements.txt --config-file opt/model-config.yaml --archive-format tgz | ||
``` | ||
|
||
### Step 3: Add the tgz file to model store | ||
|
||
```bash | ||
mkdir model_store | ||
mv opt.tar.gz model_store | ||
``` | ||
|
||
### Step 4: Start torchserve | ||
|
||
```bash | ||
torchserve --start --ncs --model-store model_store --models opt.tar.gz | ||
``` | ||
|
||
### Step 5: Run inference | ||
|
||
```bash | ||
curl "http://localhost:8080/predictions/opt" -T sample_text.txt | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
transformers>=4.30.1 | ||
deepspeed>=0.9.4 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters