Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
7caa3682
Unverified
Commit
7caa3682
authored
Aug 31, 2023
by
Patrick von Platen
Committed by
GitHub
Aug 31, 2023
Browse files
Remove warn with deprecate (#4850)
* Remove warn with deprecate * Fix typo with 1.0,0
parent
0edb4cac
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
43 additions
and
84 deletions
+43
-84
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_model_editing.py
...able_diffusion/pipeline_stable_diffusion_model_editing.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py
...es/stable_diffusion/pipeline_stable_diffusion_panorama.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py
...table_diffusion/pipeline_stable_diffusion_pix2pix_zero.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_sag.py
...pelines/stable_diffusion/pipeline_stable_diffusion_sag.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
...nes/stable_diffusion/pipeline_stable_diffusion_upscale.py
+3
-5
src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py
...sers/pipelines/stable_diffusion/pipeline_stable_unclip.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py
...elines/stable_diffusion/pipeline_stable_unclip_img2img.py
+3
-6
src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py
...s/stable_diffusion_safe/pipeline_stable_diffusion_safe.py
+3
-5
src/diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py
...ipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py
+3
-6
src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py
src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py
+2
-6
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py
...ile_diffusion/pipeline_versatile_diffusion_dual_guided.py
+4
-7
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py
...diffusion/pipeline_versatile_diffusion_image_variation.py
+4
-7
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py
...e_diffusion/pipeline_versatile_diffusion_text_to_image.py
+4
-7
No files found.
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_model_editing.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
import
copy
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
import
torch
...
...
@@ -365,11 +364,9 @@ class StableDiffusionModelEditingPipeline(DiffusionPipeline, TextualInversionLoa
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_panorama.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
import
copy
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
import
torch
...
...
@@ -342,11 +341,9 @@ class StableDiffusionPanoramaPipeline(DiffusionPipeline, TextualInversionLoaderM
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_pix2pix_zero.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
dataclasses
import
dataclass
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
...
...
@@ -177,11 +176,8 @@ EXAMPLE_INVERT_DOC_STRING = """
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess
def
preprocess
(
image
):
warnings
.
warn
(
"The preprocess method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor.preprocess instead"
,
FutureWarning
,
)
deprecation_message
=
"The preprocess method is deprecated and will be removed in diffusers 1.0.0. Please use VaeImageProcessor.preprocess(...) instead"
deprecate
(
"preprocess"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
if
isinstance
(
image
,
torch
.
Tensor
):
return
image
elif
isinstance
(
image
,
PIL
.
Image
.
Image
):
...
...
@@ -597,11 +593,9 @@ class StableDiffusionPix2PixZeroPipeline(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_sag.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
import
torch
...
...
@@ -365,11 +364,9 @@ class StableDiffusionSAGPipeline(DiffusionPipeline, TextualInversionLoaderMixin)
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_upscale.py
View file @
7caa3682
...
...
@@ -389,11 +389,9 @@ class StableDiffusionUpscalePipeline(DiffusionPipeline, TextualInversionLoaderMi
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Tuple
,
Union
import
torch
...
...
@@ -481,11 +480,9 @@ class StableUnCLIPPipeline(DiffusionPipeline, TextualInversionLoaderMixin, LoraL
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion/pipeline_stable_unclip_img2img.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
import
PIL
...
...
@@ -430,11 +429,9 @@ class StableUnCLIPImg2ImgPipeline(DiffusionPipeline, TextualInversionLoaderMixin
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/stable_diffusion_safe/pipeline_stable_diffusion_safe.py
View file @
7caa3682
...
...
@@ -324,11 +324,9 @@ class StableDiffusionPipelineSafe(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/t2i_adapter/pipeline_stable_diffusion_adapter.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
dataclasses
import
dataclass
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
...
...
@@ -450,11 +449,9 @@ class StableDiffusionAdapterPipeline(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/unidiffuser/pipeline_unidiffuser.py
View file @
7caa3682
import
inspect
import
warnings
from
dataclasses
import
dataclass
from
typing
import
Callable
,
List
,
Optional
,
Union
...
...
@@ -35,11 +34,8 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess
def
preprocess
(
image
):
warnings
.
warn
(
"The preprocess method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor.preprocess instead"
,
FutureWarning
,
)
deprecation_message
=
"The preprocess method is deprecated and will be removed in diffusers 1.0.0. Please use VaeImageProcessor.preprocess(...) instead"
deprecate
(
"preprocess"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
if
isinstance
(
image
,
torch
.
Tensor
):
return
image
elif
isinstance
(
image
,
PIL
.
Image
.
Image
):
...
...
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_dual_guided.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Callable
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -30,7 +29,7 @@ from transformers import (
from
...image_processor
import
VaeImageProcessor
from
...models
import
AutoencoderKL
,
DualTransformer2DModel
,
Transformer2DModel
,
UNet2DConditionModel
from
...schedulers
import
KarrasDiffusionSchedulers
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
,
ImagePipelineOutput
from
.modeling_text_unet
import
UNetFlatConditionModel
...
...
@@ -298,11 +297,9 @@ class VersatileDiffusionDualGuidedPipeline(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_image_variation.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Callable
,
List
,
Optional
,
Union
import
numpy
as
np
...
...
@@ -25,7 +24,7 @@ from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection
from
...image_processor
import
VaeImageProcessor
from
...models
import
AutoencoderKL
,
UNet2DConditionModel
from
...schedulers
import
KarrasDiffusionSchedulers
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
,
ImagePipelineOutput
...
...
@@ -158,11 +157,9 @@ class VersatileDiffusionImageVariationPipeline(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
src/diffusers/pipelines/versatile_diffusion/pipeline_versatile_diffusion_text_to_image.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
inspect
import
warnings
from
typing
import
Callable
,
List
,
Optional
,
Union
import
torch
...
...
@@ -23,7 +22,7 @@ from transformers import CLIPImageProcessor, CLIPTextModelWithProjection, CLIPTo
from
...image_processor
import
VaeImageProcessor
from
...models
import
AutoencoderKL
,
Transformer2DModel
,
UNet2DConditionModel
from
...schedulers
import
KarrasDiffusionSchedulers
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
,
ImagePipelineOutput
from
.modeling_text_unet
import
UNetFlatConditionModel
...
...
@@ -215,11 +214,9 @@ class VersatileDiffusionTextToImagePipeline(DiffusionPipeline):
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline.decode_latents
def
decode_latents
(
self
,
latents
):
warnings
.
warn
(
"The decode_latents method is deprecated and will be removed in a future version. Please"
" use VaeImageProcessor instead"
,
FutureWarning
,
)
deprecation_message
=
"The decode_latents method is deprecated and will be removed in 1.0.0. Please use VaeImageProcessor.postprocess(...) instead"
deprecate
(
"decode_latents"
,
"1.0.0"
,
deprecation_message
,
standard_warn
=
False
)
latents
=
1
/
self
.
vae
.
config
.
scaling_factor
*
latents
image
=
self
.
vae
.
decode
(
latents
,
return_dict
=
False
)[
0
]
image
=
(
image
/
2
+
0.5
).
clamp
(
0
,
1
)
...
...
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment