Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
ce1c27ad
Unverified
Commit
ce1c27ad
authored
Dec 19, 2022
by
Patrick von Platen
Committed by
GitHub
Dec 19, 2022
Browse files
[Revision] Don't recommend using revision (#1764)
parent
b267d285
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
45 additions
and
84 deletions
+45
-84
docs/source/api/pipelines/overview.mdx
docs/source/api/pipelines/overview.mdx
+3
-4
docs/source/api/pipelines/stable_diffusion_2.mdx
docs/source/api/pipelines/stable_diffusion_2.mdx
+1
-1
docs/source/optimization/fp16.mdx
docs/source/optimization/fp16.mdx
+5
-8
docs/source/using-diffusers/custom_pipeline_examples.mdx
docs/source/using-diffusers/custom_pipeline_examples.mdx
+2
-5
docs/source/using-diffusers/img2img.mdx
docs/source/using-diffusers/img2img.mdx
+3
-3
docs/source/using-diffusers/inpaint.mdx
docs/source/using-diffusers/inpaint.mdx
+0
-1
examples/community/README.md
examples/community/README.md
+6
-6
examples/community/wildcard_stable_diffusion.py
examples/community/wildcard_stable_diffusion.py
+1
-1
src/diffusers/pipelines/README.md
src/diffusers/pipelines/README.md
+0
-2
tests/pipelines/altdiffusion/test_alt_diffusion.py
tests/pipelines/altdiffusion/test_alt_diffusion.py
+1
-3
tests/pipelines/stable_diffusion/test_stable_diffusion.py
tests/pipelines/stable_diffusion/test_stable_diffusion.py
+7
-21
tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py
...pelines/stable_diffusion/test_stable_diffusion_img2img.py
+2
-2
tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py
...pelines/stable_diffusion/test_stable_diffusion_inpaint.py
+2
-2
tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint_legacy.py
.../stable_diffusion/test_stable_diffusion_inpaint_legacy.py
+1
-1
tests/pipelines/stable_diffusion_2/test_stable_diffusion.py
tests/pipelines/stable_diffusion_2/test_stable_diffusion.py
+3
-3
tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py
...pelines/stable_diffusion_2/test_stable_diffusion_depth.py
+2
-2
tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py
...lines/stable_diffusion_2/test_stable_diffusion_inpaint.py
+0
-2
tests/pipelines/stable_diffusion_2/test_stable_diffusion_upscale.py
...lines/stable_diffusion_2/test_stable_diffusion_upscale.py
+0
-2
tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py
...elines/stable_diffusion_2/test_stable_diffusion_v_pred.py
+6
-14
tests/test_pipelines.py
tests/test_pipelines.py
+0
-1
No files found.
docs/source/api/pipelines/overview.mdx
View file @
ce1c27ad
...
@@ -139,9 +139,9 @@ from diffusers import StableDiffusionImg2ImgPipeline
...
@@ -139,9 +139,9 @@ from diffusers import StableDiffusionImg2ImgPipeline
# load the pipeline
# load the pipeline
device = "cuda"
device = "cuda"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16).to(
"runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16
device
)
.to(device)
)
# let's download an initial image
# let's download an initial image
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
...
@@ -189,7 +189,6 @@ mask_image = download_image(mask_url).resize((512, 512))
...
@@ -189,7 +189,6 @@ mask_image = download_image(mask_url).resize((512, 512))
pipe = StableDiffusionInpaintPipeline.from_pretrained(
pipe = StableDiffusionInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting",
"runwayml/stable-diffusion-inpainting",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
...
docs/source/api/pipelines/stable_diffusion_2.mdx
View file @
ce1c27ad
...
@@ -113,7 +113,7 @@ import torch
...
@@ -113,7 +113,7 @@ import torch
# load model and scheduler
# load model and scheduler
model_id = "stabilityai/stable-diffusion-x4-upscaler"
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id,
revision="fp16",
torch_dtype=torch.float16)
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline = pipeline.to("cuda")
pipeline = pipeline.to("cuda")
# let's download an image
# let's download an image
...
...
docs/source/optimization/fp16.mdx
View file @
ce1c27ad
...
@@ -79,7 +79,7 @@ To save more GPU memory and get even more speed, you can load and run the model
...
@@ -79,7 +79,7 @@ To save more GPU memory and get even more speed, you can load and run the model
```Python
```Python
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -107,7 +107,7 @@ from diffusers import StableDiffusionPipeline
...
@@ -107,7 +107,7 @@ from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -134,7 +134,7 @@ from diffusers import StableDiffusionPipeline
...
@@ -134,7 +134,7 @@ from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -159,7 +159,7 @@ from diffusers import StableDiffusionPipeline
...
@@ -159,7 +159,7 @@ from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -179,7 +179,7 @@ from diffusers import StableDiffusionPipeline
...
@@ -179,7 +179,7 @@ from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -234,7 +234,6 @@ def generate_inputs():
...
@@ -234,7 +234,6 @@ def generate_inputs():
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
).to("cuda")
).to("cuda")
unet = pipe.unet
unet = pipe.unet
...
@@ -298,7 +297,6 @@ class UNet2DConditionOutput:
...
@@ -298,7 +297,6 @@ class UNet2DConditionOutput:
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
).to("cuda")
).to("cuda")
...
@@ -349,7 +347,6 @@ import torch
...
@@ -349,7 +347,6 @@ import torch
pipe = StableDiffusionPipeline.from_pretrained(
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
"runwayml/stable-diffusion-v1-5",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
).to("cuda")
).to("cuda")
...
...
docs/source/using-diffusers/custom_pipeline_examples.mdx
View file @
ce1c27ad
...
@@ -58,7 +58,6 @@ guided_pipeline = DiffusionPipeline.from_pretrained(
...
@@ -58,7 +58,6 @@ guided_pipeline = DiffusionPipeline.from_pretrained(
custom_pipeline="clip_guided_stable_diffusion",
custom_pipeline="clip_guided_stable_diffusion",
clip_model=clip_model,
clip_model=clip_model,
feature_extractor=feature_extractor,
feature_extractor=feature_extractor,
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
guided_pipeline.enable_attention_slicing()
guided_pipeline.enable_attention_slicing()
...
@@ -113,7 +112,6 @@ import torch
...
@@ -113,7 +112,6 @@ import torch
pipe = DiffusionPipeline.from_pretrained(
pipe = DiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
"CompVis/stable-diffusion-v1-4",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
safety_checker=None, # Very important for videos...lots of false positives while interpolating
safety_checker=None, # Very important for videos...lots of false positives while interpolating
custom_pipeline="interpolate_stable_diffusion",
custom_pipeline="interpolate_stable_diffusion",
...
@@ -159,7 +157,6 @@ pipe = DiffusionPipeline.from_pretrained(
...
@@ -159,7 +157,6 @@ pipe = DiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
"CompVis/stable-diffusion-v1-4",
custom_pipeline="stable_diffusion_mega",
custom_pipeline="stable_diffusion_mega",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
revision="fp16",
)
)
pipe.to("cuda")
pipe.to("cuda")
pipe.enable_attention_slicing()
pipe.enable_attention_slicing()
...
@@ -204,7 +201,7 @@ from diffusers import DiffusionPipeline
...
@@ -204,7 +201,7 @@ from diffusers import DiffusionPipeline
import torch
import torch
pipe = DiffusionPipeline.from_pretrained(
pipe = DiffusionPipeline.from_pretrained(
"hakurei/waifu-diffusion", custom_pipeline="lpw_stable_diffusion",
revision="fp16",
torch_dtype=torch.float16
"hakurei/waifu-diffusion", custom_pipeline="lpw_stable_diffusion", torch_dtype=torch.float16
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
@@ -268,7 +265,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
...
@@ -268,7 +265,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
custom_pipeline="speech_to_image_diffusion",
custom_pipeline="speech_to_image_diffusion",
speech_model=model,
speech_model=model,
speech_processor=processor,
speech_processor=processor,
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
...
...
docs/source/using-diffusers/img2img.mdx
View file @
ce1c27ad
...
@@ -24,9 +24,9 @@ from diffusers import StableDiffusionImg2ImgPipeline
...
@@ -24,9 +24,9 @@ from diffusers import StableDiffusionImg2ImgPipeline
# load the pipeline
# load the pipeline
device = "cuda"
device = "cuda"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16).to(
"runwayml/stable-diffusion-v1-5", revision="fp16", torch_dtype=torch.float16
device
)
.to(device)
)
# let's download an initial image
# let's download an initial image
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
...
...
docs/source/using-diffusers/inpaint.mdx
View file @
ce1c27ad
...
@@ -42,7 +42,6 @@ mask_image = download_image(mask_url).resize((512, 512))
...
@@ -42,7 +42,6 @@ mask_image = download_image(mask_url).resize((512, 512))
pipe = StableDiffusionInpaintPipeline.from_pretrained(
pipe = StableDiffusionInpaintPipeline.from_pretrained(
"runwayml/stable-diffusion-inpainting",
"runwayml/stable-diffusion-inpainting",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
pipe = pipe.to("cuda")
pipe = pipe.to("cuda")
...
...
examples/community/README.md
View file @
ce1c27ad
...
@@ -57,7 +57,7 @@ guided_pipeline = DiffusionPipeline.from_pretrained(
...
@@ -57,7 +57,7 @@ guided_pipeline = DiffusionPipeline.from_pretrained(
custom_pipeline
=
"clip_guided_stable_diffusion"
,
custom_pipeline
=
"clip_guided_stable_diffusion"
,
clip_model
=
clip_model
,
clip_model
=
clip_model
,
feature_extractor
=
feature_extractor
,
feature_extractor
=
feature_extractor
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
guided_pipeline
.
enable_attention_slicing
()
guided_pipeline
.
enable_attention_slicing
()
...
@@ -208,7 +208,7 @@ import torch
...
@@ -208,7 +208,7 @@ import torch
pipe
=
DiffusionPipeline
.
from_pretrained
(
pipe
=
DiffusionPipeline
.
from_pretrained
(
'hakurei/waifu-diffusion'
,
'hakurei/waifu-diffusion'
,
custom_pipeline
=
"lpw_stable_diffusion"
,
custom_pipeline
=
"lpw_stable_diffusion"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
"cuda"
)
pipe
=
pipe
.
to
(
"cuda"
)
...
@@ -275,7 +275,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
...
@@ -275,7 +275,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
custom_pipeline="speech_to_image_diffusion",
custom_pipeline="speech_to_image_diffusion",
speech_model=model,
speech_model=model,
speech_processor=processor,
speech_processor=processor,
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
...
@@ -333,7 +333,7 @@ import torch
...
@@ -333,7 +333,7 @@ import torch
pipe
=
DiffusionPipeline
.
from_pretrained
(
pipe
=
DiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
"CompVis/stable-diffusion-v1-4"
,
custom_pipeline
=
"wildcard_stable_diffusion"
,
custom_pipeline
=
"wildcard_stable_diffusion"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
prompt
=
"__animal__ sitting on a __object__ wearing a __clothing__"
prompt
=
"__animal__ sitting on a __object__ wearing a __clothing__"
...
@@ -567,7 +567,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
...
@@ -567,7 +567,7 @@ diffuser_pipeline = DiffusionPipeline.from_pretrained(
detection_pipeline
=
language_detection_pipeline
,
detection_pipeline
=
language_detection_pipeline
,
translation_model
=
trans_model
,
translation_model
=
trans_model
,
translation_tokenizer
=
trans_tokenizer
,
translation_tokenizer
=
trans_tokenizer
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
...
@@ -615,7 +615,7 @@ mask_image = PIL.Image.open(mask_path).convert("RGB").resize((512, 512))
...
@@ -615,7 +615,7 @@ mask_image = PIL.Image.open(mask_path).convert("RGB").resize((512, 512))
pipe
=
DiffusionPipeline
.
from_pretrained
(
pipe
=
DiffusionPipeline
.
from_pretrained
(
"runwayml/stable-diffusion-inpainting"
,
"runwayml/stable-diffusion-inpainting"
,
custom_pipeline
=
"img2img_inpainting"
,
custom_pipeline
=
"img2img_inpainting"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
"cuda"
)
pipe
=
pipe
.
to
(
"cuda"
)
...
...
examples/community/wildcard_stable_diffusion.py
View file @
ce1c27ad
...
@@ -68,7 +68,7 @@ class WildcardStableDiffusionPipeline(DiffusionPipeline):
...
@@ -68,7 +68,7 @@ class WildcardStableDiffusionPipeline(DiffusionPipeline):
Example Usage:
Example Usage:
pipe = WildcardStableDiffusionPipeline.from_pretrained(
pipe = WildcardStableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
"CompVis/stable-diffusion-v1-4",
revision="fp16",
torch_dtype=torch.float16,
torch_dtype=torch.float16,
)
)
prompt = "__animal__ sitting on a __object__ wearing a __clothing__"
prompt = "__animal__ sitting on a __object__ wearing a __clothing__"
...
...
src/diffusers/pipelines/README.md
View file @
ce1c27ad
...
@@ -113,7 +113,6 @@ from diffusers import StableDiffusionImg2ImgPipeline
...
@@ -113,7 +113,6 @@ from diffusers import StableDiffusionImg2ImgPipeline
device
=
"cuda"
device
=
"cuda"
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
"runwayml/stable-diffusion-v1-5"
,
"runwayml/stable-diffusion-v1-5"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
).
to
(
device
)
).
to
(
device
)
...
@@ -161,7 +160,6 @@ mask_image = download_image(mask_url).resize((512, 512))
...
@@ -161,7 +160,6 @@ mask_image = download_image(mask_url).resize((512, 512))
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
"runwayml/stable-diffusion-inpainting"
,
"runwayml/stable-diffusion-inpainting"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
pipe
=
pipe
.
to
(
"cuda"
)
pipe
=
pipe
.
to
(
"cuda"
)
...
...
tests/pipelines/altdiffusion/test_alt_diffusion.py
View file @
ce1c27ad
...
@@ -248,9 +248,7 @@ class AltDiffusionPipelineIntegrationTests(unittest.TestCase):
...
@@ -248,9 +248,7 @@ class AltDiffusionPipelineIntegrationTests(unittest.TestCase):
def
test_alt_diffusion_text2img_pipeline_fp16
(
self
):
def
test_alt_diffusion_text2img_pipeline_fp16
(
self
):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
model_id
=
"BAAI/AltDiffusion"
model_id
=
"BAAI/AltDiffusion"
pipe
=
AltDiffusionPipeline
.
from_pretrained
(
pipe
=
AltDiffusionPipeline
.
from_pretrained
(
model_id
,
torch_dtype
=
torch
.
float16
,
safety_checker
=
None
)
model_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
safety_checker
=
None
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion/test_stable_diffusion.py
View file @
ce1c27ad
...
@@ -527,9 +527,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -527,9 +527,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
def
test_stable_diffusion_attention_slicing
(
self
):
def
test_stable_diffusion_attention_slicing
(
self
):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
torch_dtype
=
torch
.
float16
)
"CompVis/stable-diffusion-v1-4"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -555,9 +553,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -555,9 +553,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
def
test_stable_diffusion_vae_slicing
(
self
):
def
test_stable_diffusion_vae_slicing
(
self
):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
torch_dtype
=
torch
.
float16
)
"CompVis/stable-diffusion-v1-4"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
enable_attention_slicing
()
pipe
.
enable_attention_slicing
()
...
@@ -588,9 +584,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -588,9 +584,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
assert
np
.
abs
(
image_sliced
-
image
).
max
()
<
4e-3
assert
np
.
abs
(
image_sliced
-
image
).
max
()
<
4e-3
def
test_stable_diffusion_fp16_vs_autocast
(
self
):
def
test_stable_diffusion_fp16_vs_autocast
(
self
):
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
torch_dtype
=
torch
.
float16
)
"CompVis/stable-diffusion-v1-4"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -629,9 +623,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -629,9 +623,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
callback_fn
.
has_been_called
=
False
callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
torch_dtype
=
torch
.
float16
)
"CompVis/stable-diffusion-v1-4"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
enable_attention_slicing
()
pipe
.
enable_attention_slicing
()
...
@@ -645,16 +637,12 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -645,16 +637,12 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
pipeline_id
=
"CompVis/stable-diffusion-v1-4"
pipeline_id
=
"CompVis/stable-diffusion-v1-4"
start_time
=
time
.
time
()
start_time
=
time
.
time
()
pipeline_low_cpu_mem_usage
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_low_cpu_mem_usage
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
torch_dtype
=
torch
.
float16
)
pipeline_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipeline_low_cpu_mem_usage
.
to
(
torch_device
)
pipeline_low_cpu_mem_usage
.
to
(
torch_device
)
low_cpu_mem_usage_time
=
time
.
time
()
-
start_time
low_cpu_mem_usage_time
=
time
.
time
()
-
start_time
start_time
=
time
.
time
()
start_time
=
time
.
time
()
_
=
StableDiffusionPipeline
.
from_pretrained
(
_
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
torch_dtype
=
torch
.
float16
,
low_cpu_mem_usage
=
False
)
pipeline_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
low_cpu_mem_usage
=
False
)
normal_load_time
=
time
.
time
()
-
start_time
normal_load_time
=
time
.
time
()
-
start_time
assert
2
*
low_cpu_mem_usage_time
<
normal_load_time
assert
2
*
low_cpu_mem_usage_time
<
normal_load_time
...
@@ -664,9 +652,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
...
@@ -664,9 +652,7 @@ class StableDiffusionPipelineSlowTests(unittest.TestCase):
torch
.
cuda
.
reset_max_memory_allocated
()
torch
.
cuda
.
reset_max_memory_allocated
()
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
torch_dtype
=
torch
.
float16
)
"CompVis/stable-diffusion-v1-4"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
enable_attention_slicing
(
1
)
pipe
.
enable_attention_slicing
(
1
)
...
...
tests/pipelines/stable_diffusion/test_stable_diffusion_img2img.py
View file @
ce1c27ad
...
@@ -303,7 +303,7 @@ class StableDiffusionImg2ImgPipelineSlowTests(unittest.TestCase):
...
@@ -303,7 +303,7 @@ class StableDiffusionImg2ImgPipelineSlowTests(unittest.TestCase):
callback_fn
.
has_been_called
=
False
callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -320,7 +320,7 @@ class StableDiffusionImg2ImgPipelineSlowTests(unittest.TestCase):
...
@@ -320,7 +320,7 @@ class StableDiffusionImg2ImgPipelineSlowTests(unittest.TestCase):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
pipe
=
StableDiffusionImg2ImgPipeline
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint.py
View file @
ce1c27ad
...
@@ -212,7 +212,7 @@ class StableDiffusionInpaintPipelineSlowTests(unittest.TestCase):
...
@@ -212,7 +212,7 @@ class StableDiffusionInpaintPipelineSlowTests(unittest.TestCase):
def
test_stable_diffusion_inpaint_fp16
(
self
):
def
test_stable_diffusion_inpaint_fp16
(
self
):
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
"runwayml/stable-diffusion-inpainting"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
safety_checker
=
None
"runwayml/stable-diffusion-inpainting"
,
torch_dtype
=
torch
.
float16
,
safety_checker
=
None
)
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -266,7 +266,7 @@ class StableDiffusionInpaintPipelineSlowTests(unittest.TestCase):
...
@@ -266,7 +266,7 @@ class StableDiffusionInpaintPipelineSlowTests(unittest.TestCase):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
"runwayml/stable-diffusion-inpainting"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"runwayml/stable-diffusion-inpainting"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion/test_stable_diffusion_inpaint_legacy.py
View file @
ce1c27ad
...
@@ -425,7 +425,7 @@ class StableDiffusionInpaintLegacyPipelineSlowTests(unittest.TestCase):
...
@@ -425,7 +425,7 @@ class StableDiffusionInpaintLegacyPipelineSlowTests(unittest.TestCase):
callback_fn
.
has_been_called
=
False
callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionInpaintPipelineLegacy
.
from_pretrained
(
pipe
=
StableDiffusionInpaintPipelineLegacy
.
from_pretrained
(
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"CompVis/stable-diffusion-v1-4"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion.py
View file @
ce1c27ad
...
@@ -304,7 +304,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
...
@@ -304,7 +304,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
def
test_stable_diffusion_attention_slicing
(
self
):
def
test_stable_diffusion_attention_slicing
(
self
):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2-base"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"stabilityai/stable-diffusion-2-base"
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -352,7 +352,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
...
@@ -352,7 +352,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
callback_fn
.
has_been_called
=
False
callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2-base"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"stabilityai/stable-diffusion-2-base"
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -369,7 +369,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
...
@@ -369,7 +369,7 @@ class StableDiffusion2PipelineSlowTests(unittest.TestCase):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2-base"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"stabilityai/stable-diffusion-2-base"
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion_depth.py
View file @
ce1c27ad
...
@@ -484,7 +484,7 @@ class StableDiffusionDepth2ImgPipelineSlowTests(unittest.TestCase):
...
@@ -484,7 +484,7 @@ class StableDiffusionDepth2ImgPipelineSlowTests(unittest.TestCase):
callback_fn
.
has_been_called
=
False
callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionDepth2ImgPipeline
.
from_pretrained
(
pipe
=
StableDiffusionDepth2ImgPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2-depth"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"stabilityai/stable-diffusion-2-depth"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -501,7 +501,7 @@ class StableDiffusionDepth2ImgPipelineSlowTests(unittest.TestCase):
...
@@ -501,7 +501,7 @@ class StableDiffusionDepth2ImgPipelineSlowTests(unittest.TestCase):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
pipe
=
StableDiffusionDepth2ImgPipeline
.
from_pretrained
(
pipe
=
StableDiffusionDepth2ImgPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2-depth"
,
safety_checker
=
None
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
"stabilityai/stable-diffusion-2-depth"
,
safety_checker
=
None
,
torch_dtype
=
torch
.
float16
)
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion_inpaint.py
View file @
ce1c27ad
...
@@ -188,7 +188,6 @@ class StableDiffusionInpaintPipelineIntegrationTests(unittest.TestCase):
...
@@ -188,7 +188,6 @@ class StableDiffusionInpaintPipelineIntegrationTests(unittest.TestCase):
model_id
=
"stabilityai/stable-diffusion-2-inpainting"
model_id
=
"stabilityai/stable-diffusion-2-inpainting"
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
pipe
=
StableDiffusionInpaintPipeline
.
from_pretrained
(
model_id
,
model_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
safety_checker
=
None
,
safety_checker
=
None
,
)
)
...
@@ -231,7 +230,6 @@ class StableDiffusionInpaintPipelineIntegrationTests(unittest.TestCase):
...
@@ -231,7 +230,6 @@ class StableDiffusionInpaintPipelineIntegrationTests(unittest.TestCase):
safety_checker
=
None
,
safety_checker
=
None
,
scheduler
=
pndm
,
scheduler
=
pndm
,
device_map
=
"auto"
,
device_map
=
"auto"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion_upscale.py
View file @
ce1c27ad
...
@@ -306,7 +306,6 @@ class StableDiffusionUpscalePipelineIntegrationTests(unittest.TestCase):
...
@@ -306,7 +306,6 @@ class StableDiffusionUpscalePipelineIntegrationTests(unittest.TestCase):
model_id
=
"stabilityai/stable-diffusion-x4-upscaler"
model_id
=
"stabilityai/stable-diffusion-x4-upscaler"
pipe
=
StableDiffusionUpscalePipeline
.
from_pretrained
(
pipe
=
StableDiffusionUpscalePipeline
.
from_pretrained
(
model_id
,
model_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
...
@@ -340,7 +339,6 @@ class StableDiffusionUpscalePipelineIntegrationTests(unittest.TestCase):
...
@@ -340,7 +339,6 @@ class StableDiffusionUpscalePipelineIntegrationTests(unittest.TestCase):
model_id
=
"stabilityai/stable-diffusion-x4-upscaler"
model_id
=
"stabilityai/stable-diffusion-x4-upscaler"
pipe
=
StableDiffusionUpscalePipeline
.
from_pretrained
(
pipe
=
StableDiffusionUpscalePipeline
.
from_pretrained
(
model_id
,
model_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
)
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
...
...
tests/pipelines/stable_diffusion_2/test_stable_diffusion_v_pred.py
View file @
ce1c27ad
...
@@ -329,7 +329,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
...
@@ -329,7 +329,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
def
test_stable_diffusion_attention_slicing_v_pred
(
self
):
def
test_stable_diffusion_attention_slicing_v_pred
(
self
):
torch
.
cuda
.
reset_peak_memory_stats
()
torch
.
cuda
.
reset_peak_memory_stats
()
model_id
=
"stabilityai/stable-diffusion-2"
model_id
=
"stabilityai/stable-diffusion-2"
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
model_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
model_id
,
torch_dtype
=
torch
.
float16
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -389,9 +389,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
...
@@ -389,9 +389,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
"sd2-text2img/astronaut_riding_a_horse_v_pred_fp16.npy"
"sd2-text2img/astronaut_riding_a_horse_v_pred_fp16.npy"
)
)
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2"
,
torch_dtype
=
torch
.
float16
)
"stabilityai/stable-diffusion-2"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
.
to
(
torch_device
)
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
...
@@ -430,9 +428,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
...
@@ -430,9 +428,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
test_callback_fn
.
has_been_called
=
False
test_callback_fn
.
has_been_called
=
False
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
pipe
=
StableDiffusionPipeline
.
from_pretrained
(
"stabilityai/stable-diffusion-2"
,
torch_dtype
=
torch
.
float16
)
"stabilityai/stable-diffusion-2"
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
=
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
pipe
.
enable_attention_slicing
()
pipe
.
enable_attention_slicing
()
...
@@ -456,16 +452,12 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
...
@@ -456,16 +452,12 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
pipeline_id
=
"stabilityai/stable-diffusion-2"
pipeline_id
=
"stabilityai/stable-diffusion-2"
start_time
=
time
.
time
()
start_time
=
time
.
time
()
pipeline_low_cpu_mem_usage
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_low_cpu_mem_usage
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
torch_dtype
=
torch
.
float16
)
pipeline_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipeline_low_cpu_mem_usage
.
to
(
torch_device
)
pipeline_low_cpu_mem_usage
.
to
(
torch_device
)
low_cpu_mem_usage_time
=
time
.
time
()
-
start_time
low_cpu_mem_usage_time
=
time
.
time
()
-
start_time
start_time
=
time
.
time
()
start_time
=
time
.
time
()
_
=
StableDiffusionPipeline
.
from_pretrained
(
_
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
torch_dtype
=
torch
.
float16
,
low_cpu_mem_usage
=
False
)
pipeline_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
,
low_cpu_mem_usage
=
False
)
normal_load_time
=
time
.
time
()
-
start_time
normal_load_time
=
time
.
time
()
-
start_time
assert
2
*
low_cpu_mem_usage_time
<
normal_load_time
assert
2
*
low_cpu_mem_usage_time
<
normal_load_time
...
@@ -478,7 +470,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
...
@@ -478,7 +470,7 @@ class StableDiffusion2VPredictionPipelineIntegrationTests(unittest.TestCase):
pipeline_id
=
"stabilityai/stable-diffusion-2"
pipeline_id
=
"stabilityai/stable-diffusion-2"
prompt
=
"Andromeda galaxy in a bottle"
prompt
=
"Andromeda galaxy in a bottle"
pipeline
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
revision
=
"fp16"
,
torch_dtype
=
torch
.
float16
)
pipeline
=
StableDiffusionPipeline
.
from_pretrained
(
pipeline_id
,
torch_dtype
=
torch
.
float16
)
pipeline
=
pipeline
.
to
(
torch_device
)
pipeline
=
pipeline
.
to
(
torch_device
)
pipeline
.
enable_attention_slicing
(
1
)
pipeline
.
enable_attention_slicing
(
1
)
pipeline
.
enable_sequential_cpu_offload
()
pipeline
.
enable_sequential_cpu_offload
()
...
...
tests/test_pipelines.py
View file @
ce1c27ad
...
@@ -286,7 +286,6 @@ class CustomPipelineTests(unittest.TestCase):
...
@@ -286,7 +286,6 @@ class CustomPipelineTests(unittest.TestCase):
clip_model
=
clip_model
,
clip_model
=
clip_model
,
feature_extractor
=
feature_extractor
,
feature_extractor
=
feature_extractor
,
torch_dtype
=
torch
.
float16
,
torch_dtype
=
torch
.
float16
,
revision
=
"fp16"
,
)
)
pipeline
.
enable_attention_slicing
()
pipeline
.
enable_attention_slicing
()
pipeline
=
pipeline
.
to
(
torch_device
)
pipeline
=
pipeline
.
to
(
torch_device
)
...
...
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