How to use the quantized weights?

#1
by teneriffa - opened

I tried to load the quantized weights on oobabooga's text-generation-webui but an error was occured. I downloaded the weights using download-model.py comes with oobabooga's webui. How can I load this weights?

I found that pytorch_model-00001-of-0000?.bin files are not found. Should I download those files?
If pytorch_model.bin.index.json needs to be edited, please let me know how to do, because this file has 410 lines, I guess just substituting with 4bit-128g.safetensors or 4bit.safetensors will not work.

INFO:Loading Aeala_GPT4-x-Alpasta-13b...
Loading checkpoint shards:   0%|                                            | 0/3 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/transformers/modeling_utils.py", line 442, in load_state_dict
    return torch.load(checkpoint_file, map_location="cpu")
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/torch/serialization.py", line 862, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/torch/serialization.py", line 321, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/torch/serialization.py", line 302, in __init__
    super().__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'models/Aeala_GPT4-x-Alpasta-13b/pytorch_model-00001-of-00003.bin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/text-generation-webui/server.py", line 948, in <module>
    shared.model, shared.tokenizer = load_model(shared.model_name)
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/text-generation-webui/modules/models.py", line 85, in load_model
    model = LoaderClass.from_pretrained(Path(f"{shared.args.model_dir}/{model_name}"), low_cpu_mem_usage=True, torch_dtype=torch.bfloat16 if shared.args.bf16 else torch.float16, trust_remote_code=trust_remote_code)
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 471, in from_pretrained
    return model_class.from_pretrained(
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2795, in from_pretrained
    ) = cls._load_pretrained_model(
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3109, in _load_pretrained_model
    state_dict = load_state_dict(shard_file)
  File "/Volumes/cuttingedges/large_lang_models/oobabooga_macos/installer_files/env/lib/python3.10/site-packages/transformers/modeling_utils.py", line 445, in load_state_dict
    with open(checkpoint_file) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'models/Aeala_GPT4-x-Alpasta-13b/pytorch_model-00001-of-00003.bin'

Hi! Thanks for using this ^~^ -- odd, I think that webui likes to have the models named the same as the folder (or if the folder name has something like -4bit-128g at the end? Did you try running with the --wbits 4 and such?). Try renaming the one you'd like to use to something like: GPT4-x-Alpasta-13b-4bit.safetensors (or 4bit-128g if you want to use that!) And it should load! If not, let me know and I'd be happy to help further ^~^ good luck!!

Sign up or log in to comment