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
OpenDAS
diffusers
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
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
80 additions
and
156 deletions
+80
-156
src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py
...ffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.py
+5
-7
src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py
...pipelines/alt_diffusion/pipeline_alt_diffusion_img2img.py
+7
-12
src/diffusers/pipelines/controlnet/pipeline_controlnet.py
src/diffusers/pipelines/controlnet/pipeline_controlnet.py
+3
-6
src/diffusers/pipelines/controlnet/pipeline_controlnet_img2img.py
...users/pipelines/controlnet/pipeline_controlnet_img2img.py
+3
-6
src/diffusers/pipelines/controlnet/pipeline_controlnet_inpaint.py
...users/pipelines/controlnet/pipeline_controlnet_inpaint.py
+3
-6
src/diffusers/pipelines/paint_by_example/pipeline_paint_by_example.py
...s/pipelines/paint_by_example/pipeline_paint_by_example.py
+4
-7
src/diffusers/pipelines/repaint/pipeline_repaint.py
src/diffusers/pipelines/repaint/pipeline_repaint.py
+3
-7
src/diffusers/pipelines/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py
...ic_stable_diffusion/pipeline_semantic_stable_diffusion.py
+4
-7
src/diffusers/pipelines/stable_diffusion/pipeline_cycle_diffusion.py
...rs/pipelines/stable_diffusion/pipeline_cycle_diffusion.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_onnx_stable_diffusion_img2img.py
...table_diffusion/pipeline_onnx_stable_diffusion_img2img.py
+4
-7
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py
...s/pipelines/stable_diffusion/pipeline_stable_diffusion.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_attend_and_excite.py
..._diffusion/pipeline_stable_diffusion_attend_and_excite.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_depth2img.py
...s/stable_diffusion/pipeline_stable_diffusion_depth2img.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_diffedit.py
...es/stable_diffusion/pipeline_stable_diffusion_diffedit.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_image_variation.py
...le_diffusion/pipeline_stable_diffusion_image_variation.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_img2img.py
...nes/stable_diffusion/pipeline_stable_diffusion_img2img.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
...ble_diffusion/pipeline_stable_diffusion_inpaint_legacy.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py
...e_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py
+5
-11
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_k_diffusion.py
...stable_diffusion/pipeline_stable_diffusion_k_diffusion.py
+3
-6
src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_latent_upscale.py
...ble_diffusion/pipeline_stable_diffusion_latent_upscale.py
+4
-6
No files found.
src/diffusers/pipelines/alt_diffusion/pipeline_alt_diffusion.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
...
...
@@ -452,13 +451,12 @@ class AltDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, LoraL
return
image
,
has_nsfw_concept
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/alt_diffusion/pipeline_alt_diffusion_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
numpy
as
np
...
...
@@ -69,11 +68,8 @@ EXAMPLE_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
):
...
...
@@ -453,13 +449,12 @@ class AltDiffusionImg2ImgPipeline(
return
image
,
has_nsfw_concept
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/controlnet/pipeline_controlnet.py
View file @
7caa3682
...
...
@@ -14,7 +14,6 @@
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -445,11 +444,9 @@ class StableDiffusionControlNetPipeline(
# 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/controlnet/pipeline_controlnet_img2img.py
View file @
7caa3682
...
...
@@ -14,7 +14,6 @@
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -470,11 +469,9 @@ class StableDiffusionControlNetImg2ImgPipeline(
# 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/controlnet/pipeline_controlnet_inpaint.py
View file @
7caa3682
...
...
@@ -15,7 +15,6 @@
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -596,11 +595,9 @@ class StableDiffusionControlNetInpaintPipeline(
# 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/paint_by_example/pipeline_paint_by_example.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
...
...
@@ -24,7 +23,7 @@ from transformers import CLIPImageProcessor
from
...image_processor
import
VaeImageProcessor
from
...models
import
AutoencoderKL
,
UNet2DConditionModel
from
...schedulers
import
DDIMScheduler
,
LMSDiscreteScheduler
,
PNDMScheduler
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
from
..stable_diffusion
import
StableDiffusionPipelineOutput
from
..stable_diffusion.safety_checker
import
StableDiffusionSafetyChecker
...
...
@@ -230,11 +229,9 @@ class PaintByExamplePipeline(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/repaint/pipeline_repaint.py
View file @
7caa3682
...
...
@@ -13,7 +13,6 @@
# limitations under the License.
import
warnings
from
typing
import
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -22,7 +21,7 @@ import torch
from
...models
import
UNet2DModel
from
...schedulers
import
RePaintScheduler
from
...utils
import
PIL_INTERPOLATION
,
logging
,
randn_tensor
from
...utils
import
PIL_INTERPOLATION
,
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
,
ImagePipelineOutput
...
...
@@ -31,11 +30,8 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess
def
_preprocess_image
(
image
:
Union
[
List
,
PIL
.
Image
.
Image
,
torch
.
Tensor
]):
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/semantic_stable_diffusion/pipeline_semantic_stable_diffusion.py
View file @
7caa3682
import
inspect
import
warnings
from
itertools
import
repeat
from
typing
import
Callable
,
List
,
Optional
,
Union
...
...
@@ -10,7 +9,7 @@ from ...image_processor import VaeImageProcessor
from
...models
import
AutoencoderKL
,
UNet2DConditionModel
from
...pipelines.stable_diffusion.safety_checker
import
StableDiffusionSafetyChecker
from
...schedulers
import
KarrasDiffusionSchedulers
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
from
.
import
SemanticStableDiffusionPipelineOutput
...
...
@@ -107,11 +106,9 @@ class SemanticStableDiffusionPipeline(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_cycle_diffusion.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
numpy
as
np
...
...
@@ -40,11 +39,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
):
...
...
@@ -523,11 +519,9 @@ class CycleDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lor
# 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_onnx_stable_diffusion_img2img.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
...
...
@@ -34,13 +33,11 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
# Copied from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.preprocess with 8->64
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/stable_diffusion/pipeline_stable_diffusion.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
...
...
@@ -451,11 +450,9 @@ class StableDiffusionPipeline(DiffusionPipeline, TextualInversionLoaderMixin, Lo
return
image
,
has_nsfw_concept
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_attend_and_excite.py
View file @
7caa3682
...
...
@@ -14,7 +14,6 @@
import
inspect
import
math
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Tuple
,
Union
import
numpy
as
np
...
...
@@ -453,11 +452,9 @@ class StableDiffusionAttendAndExcitePipeline(DiffusionPipeline, TextualInversion
# 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_depth2img.py
View file @
7caa3682
...
...
@@ -14,7 +14,6 @@
import
contextlib
import
inspect
import
warnings
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
,
Union
import
numpy
as
np
...
...
@@ -37,11 +36,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
):
...
...
@@ -338,11 +334,9 @@ class StableDiffusionDepth2ImgPipeline(DiffusionPipeline, TextualInversionLoader
# 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_diffedit.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
...
...
@@ -159,11 +158,8 @@ def kl_divergence(hidden_states):
# 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
):
...
...
@@ -657,11 +653,9 @@ class StableDiffusionDiffEditPipeline(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_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
PIL
...
...
@@ -169,11 +168,9 @@ class StableDiffusionImageVariationPipeline(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_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
numpy
as
np
...
...
@@ -73,11 +72,8 @@ EXAMPLE_DOC_STRING = """
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
):
...
...
@@ -458,11 +454,9 @@ class StableDiffusionImg2ImgPipeline(
# 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_inpaint_legacy.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
numpy
as
np
...
...
@@ -454,11 +453,9 @@ class StableDiffusionInpaintPipelineLegacy(
# 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_instruct_pix2pix.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
...
...
@@ -43,11 +42,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
):
...
...
@@ -622,11 +618,9 @@ class StableDiffusionInstructPix2PixPipeline(DiffusionPipeline, TextualInversion
# 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_k_diffusion.py
View file @
7caa3682
...
...
@@ -14,7 +14,6 @@
import
importlib
import
inspect
import
warnings
from
typing
import
Callable
,
List
,
Optional
,
Union
import
torch
...
...
@@ -361,11 +360,9 @@ class StableDiffusionKDiffusionPipeline(DiffusionPipeline, TextualInversionLoade
# 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_latent_upscale.py
View file @
7caa3682
...
...
@@ -24,7 +24,7 @@ from transformers import CLIPTextModel, CLIPTokenizer
from
...image_processor
import
PipelineImageInput
,
VaeImageProcessor
from
...models
import
AutoencoderKL
,
UNet2DConditionModel
from
...schedulers
import
EulerDiscreteScheduler
from
...utils
import
logging
,
randn_tensor
from
...utils
import
deprecate
,
logging
,
randn_tensor
from
..pipeline_utils
import
DiffusionPipeline
,
ImagePipelineOutput
...
...
@@ -190,11 +190,9 @@ class StableDiffusionLatentUpscalePipeline(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