forked from microsoft/DeepSpeed-MII
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi-batch support for text-generation (microsoft#40)
Co-authored-by: Michael Wyatt <[email protected]>
- Loading branch information
Showing
12 changed files
with
167 additions
and
36 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
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 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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
#!/bin/bash | ||
python3 -m grpc_tools.protoc -I./ --python_out=. --grpc_python_out=. ./modelresponse.proto | ||
|
||
# update import to be global wrt mii | ||
sed -i 's/modelresponse_pb2/mii.grpc_related.proto.modelresponse_pb2/g' modelresponse_pb2_grpc.py |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 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 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
asyncio | ||
deepspeed | ||
deepspeed>=0.6.7 | ||
grpcio | ||
grpcio-tools | ||
pydantic | ||
|
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,38 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
import argparse | ||
|
||
from huggingface_hub import HfApi | ||
from transformers import AutoConfig, AutoTokenizer, AutoModel | ||
|
||
def dir_path(path_str): | ||
if os.path.isdir(path_str): | ||
return path_str | ||
elif input(f"{path_str} does not exist, create directory? [y/n]").lower() == "y": | ||
os.makedirs(path_str) | ||
return path_str | ||
else: | ||
raise NotADirectoryError(path_str) | ||
|
||
class HFModelNotFoundError(Exception): | ||
def __init__(self, model_str): | ||
super().__init__(f"HuggingFace model not found: '{model_str}'") | ||
|
||
def hf_model(model_str): | ||
api = HfApi() | ||
models = [m.modelId for m in api.list_models()] | ||
if model_str in models: | ||
return model_str | ||
else: | ||
raise HFModelNotFoundError(model_str) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--model_path", '-o', type=dir_path, required=True, help="Output directory for downloaded model files") | ||
parser.add_argument("--model_name", '-m', type=hf_model, required=True, help="HuggingFace model name") | ||
args = parser.parse_args() | ||
|
||
for auto_func in [AutoConfig, AutoTokenizer, AutoModel]: | ||
auto_func.from_pretrained(args.model_name, cache_dir=args.model_path) | ||
|
||
print(f"Cached files for '{args.model_name}' downloaded to '{args.model_path}'") | ||
|
Oops, something went wrong.