-
Couldn't load subscription status.
- Fork 6.5k
Don't override torch_dtype and don't use when quantization_config is set
#11039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -870,7 +870,7 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P | |
| local_files_only = kwargs.pop("local_files_only", None) | ||
| token = kwargs.pop("token", None) | ||
| revision = kwargs.pop("revision", None) | ||
| torch_dtype = kwargs.pop("torch_dtype", torch.float32) | ||
| torch_dtype = kwargs.pop("torch_dtype", None) | ||
| subfolder = kwargs.pop("subfolder", None) | ||
| device_map = kwargs.pop("device_map", None) | ||
| max_memory = kwargs.pop("max_memory", None) | ||
|
|
@@ -883,12 +883,15 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P | |
| dduf_entries: Optional[Dict[str, DDUFEntry]] = kwargs.pop("dduf_entries", None) | ||
| disable_mmap = kwargs.pop("disable_mmap", False) | ||
|
|
||
| if not isinstance(torch_dtype, torch.dtype): | ||
| if torch_dtype is not None and not isinstance(torch_dtype, torch.dtype): | ||
| torch_dtype = torch.float32 | ||
| logger.warning( | ||
| f"Passed `torch_dtype` {torch_dtype} is not a `torch.dtype`. Defaulting to `torch.float32`." | ||
| ) | ||
|
|
||
| if quantization_config is not None and torch_dtype is not None: | ||
|
||
| torch_dtype = None | ||
|
|
||
hlky marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| allow_pickle = False | ||
| if use_safetensors is None: | ||
| use_safetensors = True | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.