|
58 | 58 | PushToHubMixin, |
59 | 59 | _get_detailed_type, |
60 | 60 | _is_valid_type, |
| 61 | + deprecate, |
61 | 62 | is_accelerate_available, |
62 | 63 | is_accelerate_version, |
63 | 64 | is_bitsandbytes_version, |
|
114 | 115 |
|
115 | 116 | SUPPORTED_DEVICE_MAP = ["balanced"] + [get_device(), "cpu"] |
116 | 117 |
|
| 118 | +_DDUF_DEPRECATION_MESSAGE = ( |
| 119 | + "Loading pipelines from DDUF files is deprecated and DDUF support will be removed entirely. " |
| 120 | + "Please save and load your pipelines using the standard Diffusers directory format instead." |
| 121 | +) |
| 122 | + |
117 | 123 | logger = logging.get_logger(__name__) |
118 | 124 |
|
119 | 125 |
|
@@ -730,7 +736,8 @@ def from_pretrained(cls, pretrained_model_name_or_path: str | os.PathLike, **kwa |
730 | 736 | Load weights from a specified variant filename such as `"fp16"` or `"ema"`. This is ignored when |
731 | 737 | loading `from_flax`. |
732 | 738 | dduf_file(`str`, *optional*): |
733 | | - Load weights from the specified dduf file. |
| 739 | + Load weights from the specified dduf file. <Deprecated> This argument is deprecated and will be removed |
| 740 | + in version 0.41.0. </Deprecated> |
734 | 741 | disable_mmap ('bool', *optional*, defaults to 'False'): |
735 | 742 | Whether to disable mmap when loading a Safetensors model. This option can perform better when the model |
736 | 743 | is on a network mount or hard drive, which may not handle the seeky-ness of mmap very well. |
@@ -843,6 +850,7 @@ def from_pretrained(cls, pretrained_model_name_or_path: str | os.PathLike, **kwa |
843 | 850 | ) |
844 | 851 |
|
845 | 852 | if dduf_file: |
| 853 | + deprecate("dduf_file", "0.41.0", _DDUF_DEPRECATION_MESSAGE) |
846 | 854 | if custom_pipeline: |
847 | 855 | raise NotImplementedError("Custom pipelines are not supported with DDUF at the moment.") |
848 | 856 | if load_connected_pipeline: |
@@ -1572,7 +1580,8 @@ def download(cls, pretrained_model_name, **kwargs) -> str | os.PathLike: |
1572 | 1580 | Load weights from a specified variant filename such as `"fp16"` or `"ema"`. This is ignored when |
1573 | 1581 | loading `from_flax`. |
1574 | 1582 | dduf_file(`str`, *optional*): |
1575 | | - Load weights from the specified DDUF file. |
| 1583 | + Load weights from the specified DDUF file. <Deprecated> This argument is deprecated and will be removed |
| 1584 | + in version 0.41.0. </Deprecated> |
1576 | 1585 | use_safetensors (`bool`, *optional*, defaults to `None`): |
1577 | 1586 | If set to `None`, the safetensors weights are downloaded if they're available **and** if the |
1578 | 1587 | safetensors library is installed. If set to `True`, the model is forcibly loaded from safetensors |
@@ -1616,6 +1625,7 @@ def download(cls, pretrained_model_name, **kwargs) -> str | os.PathLike: |
1616 | 1625 | use_flashpack = kwargs.pop("use_flashpack", False) |
1617 | 1626 |
|
1618 | 1627 | if dduf_file: |
| 1628 | + deprecate("dduf_file", "0.41.0", _DDUF_DEPRECATION_MESSAGE) |
1619 | 1629 | if custom_pipeline: |
1620 | 1630 | raise NotImplementedError("Custom pipelines are not supported with DDUF at the moment.") |
1621 | 1631 | if load_connected_pipeline: |
|
0 commit comments