Skip to content

Commit

Permalink
load safetensors first
Browse files Browse the repository at this point in the history
  • Loading branch information
irexyc committed Sep 26, 2023
1 parent cb82fe3 commit b640544
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lmdeploy/serve/turbomind/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,15 @@ def load_checkpoint(model_path):
Returns:
Dict[str, torch.Tensor]: weight in torch format
"""
files = [
file for file in os.listdir(model_path)
if file.endswith('.bin') or file.endswith('.safetensors')
]
suffixes = ['.safetensors', '.bin']
for suffix in suffixes:
files = [
file for file in os.listdir(model_path) if file.endswith(suffix)
]
if len(files) > 0:
break

assert len(files) > 0, f'could not find checkpoints in {model_path}'
files = sorted(files)
print(files)
params = {}
Expand Down

0 comments on commit b640544

Please sign in to comment.