Skip to content

Commit d5dd8df

Browse files
authored
[Chore] perform better deprecation for vqmodeloutput (#8719)
perform better deprecation for vqmodeloutput
1 parent 3e0d128 commit d5dd8df

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/diffusers/models/autoencoders/vq_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ def forward(
166166
Args:
167167
sample (`torch.Tensor`): Input sample.
168168
return_dict (`bool`, *optional*, defaults to `True`):
169-
Whether or not to return a [`models.vq_model.VQEncoderOutput`] instead of a plain tuple.
169+
Whether or not to return a [`models.autoencoders.vq_model.VQEncoderOutput`] instead of a plain tuple.
170170
171171
Returns:
172-
[`~models.vq_model.VQEncoderOutput`] or `tuple`:
173-
If return_dict is True, a [`~models.vq_model.VQEncoderOutput`] is returned, otherwise a plain `tuple`
174-
is returned.
172+
[`~models.autoencoders.vq_model.VQEncoderOutput`] or `tuple`:
173+
If return_dict is True, a [`~models.autoencoders.vq_model.VQEncoderOutput`] is returned, otherwise a
174+
plain `tuple` is returned.
175175
"""
176176

177177
h = self.encode(sample).latents

src/diffusers/models/vq_model.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616

1717

1818
class VQEncoderOutput(VQEncoderOutput):
19-
deprecation_message = "Importing `VQEncoderOutput` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQEncoderOutput`, instead."
20-
deprecate("VQEncoderOutput", "0.31", deprecation_message)
19+
def __init__(self, *args, **kwargs):
20+
deprecation_message = "Importing `VQEncoderOutput` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQEncoderOutput`, instead."
21+
deprecate("VQEncoderOutput", "0.31", deprecation_message)
22+
super().__init__(*args, **kwargs)
2123

2224

2325
class VQModel(VQModel):
24-
deprecation_message = "Importing `VQModel` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQModel`, instead."
25-
deprecate("VQModel", "0.31", deprecation_message)
26+
def __init__(self, *args, **kwargs):
27+
deprecation_message = "Importing `VQModel` from `diffusers.models.vq_model` is deprecated and this will be removed in a future version. Please use `from diffusers.models.autoencoders.vq_model import VQModel`, instead."
28+
deprecate("VQModel", "0.31", deprecation_message)
29+
super().__init__(*args, **kwargs)

0 commit comments

Comments
 (0)