mistralai / mistral-inference

Official inference library for Mistral models

Home Page:https://mistral.ai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while running tutorial: TypeError: 'mmap' is an invalid keyword argument for Unpickler()

aurotripathy opened this issue · comments

I get this error:
TypeError: 'mmap' is an invalid keyword argument for Unpickler()
while loading the model
model = Transformer.from_folder(model_path, dtype=torch.bfloat16)

Model folder looks fine

image

Here's the entire backtrace


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_2233/3294509442.py in <module>
----> 1 model = Transformer.from_folder(model_path, dtype=torch.bfloat16)
      2 tokenizer = Tokenizer(str(model_path / "tokenizer.model"))

~/./mistral-src/mistral/model.py in from_folder(folder, max_batch_size, num_pipeline_ranks, device, dtype)
    365                 num_pipeline_ranks=num_pipeline_ranks,
    366             )
--> 367         loaded = torch.load(str(folder / "consolidated.00.pth"), mmap=True)
    368         model.load_state_dict(loaded, assign=True)
    369         return model.to(device=device, dtype=dtype)

/usr/lib/python3/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, weights_only, **pickle_load_args)
    807                     except RuntimeError as e:
    808                         raise pickle.UnpicklingError(UNSAFE_MESSAGE + str(e)) from None
--> 809                 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
    810         if weights_only:
    811             try:

/usr/lib/python3/dist-packages/torch/serialization.py in _load(zip_file, map_location, pickle_module, pickle_file, **pickle_load_args)
   1168     data_file = io.BytesIO(zip_file.get_record(pickle_file))
   1169 
-> 1170     unpickler = UnpicklerWrapper(data_file, **pickle_load_args)
   1171     unpickler.persistent_load = persistent_load
   1172     result = unpickler.load()

TypeError: 'mmap' is an invalid keyword argument for Unpickler()

encounter with the same problem. Do you have any progress?