Unverified Commit d5dd8df3 authored by Sayak Paul's avatar Sayak Paul Committed by GitHub
Browse files

[Chore] perform better deprecation for vqmodeloutput (#8719)

perform better deprecation for vqmodeloutput
parent 3e0d128d
...@@ -166,12 +166,12 @@ class VQModel(ModelMixin, ConfigMixin): ...@@ -166,12 +166,12 @@ class VQModel(ModelMixin, ConfigMixin):
Args: Args:
sample (`torch.Tensor`): Input sample. sample (`torch.Tensor`): Input sample.
return_dict (`bool`, *optional*, defaults to `True`): return_dict (`bool`, *optional*, defaults to `True`):
Whether or not to return a [`models.vq_model.VQEncoderOutput`] instead of a plain tuple. Whether or not to return a [`models.autoencoders.vq_model.VQEncoderOutput`] instead of a plain tuple.
Returns: Returns:
[`~models.vq_model.VQEncoderOutput`] or `tuple`: [`~models.autoencoders.vq_model.VQEncoderOutput`] or `tuple`:
If return_dict is True, a [`~models.vq_model.VQEncoderOutput`] is returned, otherwise a plain `tuple` If return_dict is True, a [`~models.autoencoders.vq_model.VQEncoderOutput`] is returned, otherwise a
is returned. plain `tuple` is returned.
""" """
h = self.encode(sample).latents h = self.encode(sample).latents
......
...@@ -16,10 +16,14 @@ from .autoencoders.vq_model import VQEncoderOutput, VQModel ...@@ -16,10 +16,14 @@ from .autoencoders.vq_model import VQEncoderOutput, VQModel
class VQEncoderOutput(VQEncoderOutput): class VQEncoderOutput(VQEncoderOutput):
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." def __init__(self, *args, **kwargs):
deprecate("VQEncoderOutput", "0.31", deprecation_message) 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."
deprecate("VQEncoderOutput", "0.31", deprecation_message)
super().__init__(*args, **kwargs)
class VQModel(VQModel): class VQModel(VQModel):
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." def __init__(self, *args, **kwargs):
deprecate("VQModel", "0.31", deprecation_message) 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."
deprecate("VQModel", "0.31", deprecation_message)
super().__init__(*args, **kwargs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment