Skip to content

Commit 2b8a15c

Browse files
MekkCyberSunMarc
andauthored
Disallow Offload to disk for gguf files (#36933)
update Co-authored-by: Marc Sun <[email protected]>
1 parent 91455c1 commit 2b8a15c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/transformers/modeling_utils.py

+6
Original file line numberDiff line numberDiff line change
@@ -4327,6 +4327,12 @@ def from_pretrained(
43274327
"You cannot combine Quantization and loading a model from a GGUF file, try again by making sure you did not passed a `quantization_config` or that you did not load a quantized model from the Hub."
43284328
)
43294329

4330+
if gguf_file and device_map is not None and "disk" in device_map.values():
4331+
raise RuntimeError(
4332+
"One or more modules is configured to be mapped to disk. Disk offload is not supported for models "
4333+
"loaded from GGUF files."
4334+
)
4335+
43304336
checkpoint_files, sharded_metadata = _get_resolved_checkpoint_files(
43314337
pretrained_model_name_or_path=pretrained_model_name_or_path,
43324338
subfolder=subfolder,

0 commit comments

Comments
 (0)