Что нужно сделать

{
	"name": "ValueError",
	"message": "Some modules are dispatched on the CPU or the disk. Make sure you have enough GPU RAM to fit the quantized model. If you want to dispatch the model on the CPU or the disk while keeping these modules in 32-bit, you need to set `llm_int8_enable_fp32_cpu_offload=True` and pass a custom `device_map` to `from_pretrained`. Check https://huggingface.co/docs/transformers/main/en/main_classes/quantization#offload-between-cpu-and-gpu for more details. ",
	"stack": "---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[3], line 1
----> 1 model = AutoModelForCausalLM.from_pretrained(
      2     MODEL_NAME,
      3     load_in_4bit=True,
      4     torch_dtype=torch.bfloat16,
      5     device_map=\"auto\",
      6     cache_dir='/mnt/ai_disk/cch/'
      7 )
      8 model.eval()

File /mnt/ai_disk/bitbucket/sc-personal-osipova/myenv/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py:564, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
    562 elif type(config) in cls._model_mapping.keys():
    563     model_class = _get_model_class(config, cls._model_mapping)
--> 564     return model_class.from_pretrained(
    565         pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
    566     )
    567 raise ValueError(
    568     f\"Unrecognized configuration class {config.__class__} for this kind of AutoModel: {cls.__name__}.\
\"
    569     f\"Model type should be one of {', '.join(c.__name__ for c in cls._model_mapping.keys())}.\"
    570 )

File /mnt/ai_disk/bitbucket/sc-personal-osipova/myenv/lib/python3.10/site-packages/transformers/modeling_utils.py:4174, in PreTrainedModel.from_pretrained(cls, pretrained_model_name_or_path, config, cache_dir, ignore_mismatched_sizes, force_download, local_files_only, token, revision, use_safetensors, weights_only, *model_args, **kwargs)
   4171     device_map = infer_auto_device_map(model, dtype=target_dtype, **device_map_kwargs)
   4173     if hf_quantizer is not None:
-> 4174         hf_quantizer.validate_environment(device_map=device_map)
   4176 elif device_map is not None:
   4177     model.tie_weights()

File /mnt/ai_disk/bitbucket/sc-personal-osipova/myenv/lib/python3.10/site-packages/transformers/quantizers/quantizer_bnb_4bit.py:102, in Bnb4BitHfQuantizer.validate_environment(self, *args, **kwargs)
    100         pass
    101     elif \"cpu\" in device_map_without_lm_head.values() or \"disk\" in device_map_without_lm_head.values():
--> 102         raise ValueError(
    103             \"Some modules are dispatched on the CPU or the disk. Make sure you have enough GPU RAM to fit the \"
    104             \"quantized model. If you want to dispatch the model on the CPU or the disk while keeping these modules \"
    105             \"in 32-bit, you need to set `llm_int8_enable_fp32_cpu_offload=True` and pass a custom `device_map` to \"
    106             \"`from_pretrained`. Check \"
    107             \"https://huggingface.co/docs/transformers/main/en/main_classes/quantization#offload-between-cpu-and-gpu \"
    108             \"for more details. \"
    109         )
    111 if version.parse(importlib.metadata.version(\"bitsandbytes\")) < version.parse(\"0.39.0\"):
    112     raise ValueError(
    113         \"You have a version of `bitsandbytes` that is not compatible with 4bit inference and training\"
    114         \" make sure you have the latest version of `bitsandbytes` installed\"
    115     )

ValueError: Some modules are dispatched on the CPU or the disk. Make sure you have enough GPU RAM to fit the quantized model. If you want to dispatch the model on the CPU or the disk while keeping these modules in 32-bit, you need to set `llm_int8_enable_fp32_cpu_offload=True` and pass a custom `device_map` to `from_pretrained`. Check https://huggingface.co/docs/transformers/main/en/main_classes/quantization#offload-between-cpu-and-gpu for more details. "
}