convert : use 'model' value if it exists. This allows karpathy/tinyllamas to load (#4089)

Co-authored-by: Don Mahurin <@>
This commit is contained in:
Don Mahurin 2023-11-17 07:32:34 -08:00 committed by GitHub
parent 11173c92d6
commit 2ab0707acb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -690,6 +690,7 @@ def lazy_load_torch_file(outer_fp: IO[bytes], path: Path) -> ModelPlus:
data_base_path=pickle_paths[0][:-4],
zip_file=zf)
model = unpickler.load()
if 'model' in model: model = model['model']
as_dict = dict(model.items())
return ModelPlus(model=as_dict, paths=[path], format='torch', vocab=None)