mirror of
https://github.com/huggingface/diffusers.git
synced 2025-12-06 20:44:33 +08:00
Compare commits
2 Commits
custom-cod
...
single-fil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c558e170 | ||
|
|
f07479997b |
@@ -5,6 +5,7 @@ import requests
|
||||
import torch
|
||||
from huggingface_hub import hf_hub_download, snapshot_download
|
||||
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.models.attention_processor import AttnProcessor
|
||||
from diffusers.utils.testing_utils import (
|
||||
numpy_cosine_similarity_distance,
|
||||
@@ -98,8 +99,8 @@ class SDSingleFileTesterMixin:
|
||||
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, safety_checker=None, local_files_only=True
|
||||
@@ -138,8 +139,8 @@ class SDSingleFileTesterMixin:
|
||||
upcast_attention = pipe.unet.config.upcast_attention
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
@@ -191,8 +192,8 @@ class SDSingleFileTesterMixin:
|
||||
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
@@ -286,8 +287,8 @@ class SDXLSingleFileTesterMixin:
|
||||
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, safety_checker=None, local_files_only=True
|
||||
@@ -327,8 +328,8 @@ class SDXLSingleFileTesterMixin:
|
||||
upcast_attention = pipe.unet.config.upcast_attention
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
@@ -364,8 +365,8 @@ class SDXLSingleFileTesterMixin:
|
||||
pipe = pipe or self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
single_file_pipe = single_file_pipe or self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -5,6 +5,7 @@ import unittest
|
||||
import torch
|
||||
|
||||
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils import load_image
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
@@ -29,11 +30,11 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionControlNetPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_pruned.safetensors"
|
||||
original_config = (
|
||||
"https://raw.githubusercontent.com/CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml"
|
||||
)
|
||||
repo_id = "runwayml/stable-diffusion-v1-5"
|
||||
repo_id = "Lykon/dreamshaper-8"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -108,8 +109,8 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
pipe = self.pipeline_class.from_pretrained(self.repo_id, controlnet=controlnet)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weights_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weights_name, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, controlnet=controlnet, safety_checker=None, local_files_only=True
|
||||
@@ -136,8 +137,9 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weights_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weights_name, tmpdir)
|
||||
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
@@ -168,8 +170,9 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weights_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weights_name, tmpdir)
|
||||
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -5,6 +5,7 @@ import unittest
|
||||
import torch
|
||||
|
||||
from diffusers import ControlNetModel, StableDiffusionControlNetInpaintPipeline
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils import load_image
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
@@ -28,9 +29,9 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionControlNetInpaintPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-inpainting/blob/main/sd-v1-5-inpainting.ckpt"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_INPAINTING.inpainting.safetensors"
|
||||
original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml"
|
||||
repo_id = "runwayml/stable-diffusion-inpainting"
|
||||
repo_id = "Lykon/dreamshaper-8-inpainting"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -83,7 +84,7 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
output_sf = pipe_sf(**inputs).images[0]
|
||||
|
||||
max_diff = numpy_cosine_similarity_distance(output_sf.flatten(), output.flatten())
|
||||
assert max_diff < 1e-3
|
||||
assert max_diff < 2e-3
|
||||
|
||||
def test_single_file_components(self):
|
||||
controlnet = ControlNetModel.from_pretrained("lllyasviel/control_v11p_sd15_canny")
|
||||
@@ -103,8 +104,8 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
pipe = self.pipeline_class.from_pretrained(self.repo_id, safety_checker=None, controlnet=controlnet)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, controlnet=controlnet, safety_checker=None, local_files_only=True
|
||||
@@ -112,6 +113,7 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
|
||||
super()._compare_component_configs(pipe, pipe_single_file)
|
||||
|
||||
@unittest.skip("runwayml original config repo does not exist")
|
||||
def test_single_file_components_with_original_config(self):
|
||||
controlnet = ControlNetModel.from_pretrained("lllyasviel/control_v11p_sd15_canny", variant="fp16")
|
||||
pipe = self.pipeline_class.from_pretrained(self.repo_id, controlnet=controlnet)
|
||||
@@ -121,6 +123,7 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
|
||||
super()._compare_component_configs(pipe, pipe_single_file)
|
||||
|
||||
@unittest.skip("runwayml original config repo does not exist")
|
||||
def test_single_file_components_with_original_config_local_files_only(self):
|
||||
controlnet = ControlNetModel.from_pretrained(
|
||||
"lllyasviel/control_v11p_sd15_canny", torch_dtype=torch.float16, variant="fp16"
|
||||
@@ -132,8 +135,8 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
@@ -169,8 +172,8 @@ class StableDiffusionControlNetInpaintPipelineSingleFileSlowTests(unittest.TestC
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -5,6 +5,7 @@ import unittest
|
||||
import torch
|
||||
|
||||
from diffusers import ControlNetModel, StableDiffusionControlNetPipeline
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils import load_image
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
@@ -28,11 +29,11 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionControlNetPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_pruned.safetensors"
|
||||
original_config = (
|
||||
"https://raw.githubusercontent.com/CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml"
|
||||
)
|
||||
repo_id = "runwayml/stable-diffusion-v1-5"
|
||||
repo_id = "Lykon/dreamshaper-8"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -98,8 +99,8 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
pipe = self.pipeline_class.from_pretrained(self.repo_id, controlnet=controlnet)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, controlnet=controlnet, local_files_only=True
|
||||
@@ -126,8 +127,8 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
@@ -157,8 +158,8 @@ class StableDiffusionControlNetPipelineSingleFileSlowTests(unittest.TestCase, SD
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -23,11 +23,11 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionImg2ImgPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionImg2ImgPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_pruned.safetensors"
|
||||
original_config = (
|
||||
"https://raw.githubusercontent.com/CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml"
|
||||
)
|
||||
repo_id = "runwayml/stable-diffusion-v1-5"
|
||||
repo_id = "Lykon/dreamshaper-8"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
@@ -23,9 +23,9 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionInpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionInpaintPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-inpainting/blob/main/sd-v1-5-inpainting.ckpt"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_INPAINTING.inpainting.safetensors"
|
||||
original_config = "https://raw.githubusercontent.com/runwayml/stable-diffusion/main/configs/stable-diffusion/v1-inpainting-inference.yaml"
|
||||
repo_id = "runwayml/stable-diffusion-inpainting"
|
||||
repo_id = "Lykon/dreamshaper-8-inpainting"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -63,11 +63,19 @@ class StableDiffusionInpaintPipelineSingleFileSlowTests(unittest.TestCase, SDSin
|
||||
|
||||
def test_single_file_loading_4_channel_unet(self):
|
||||
# Test loading single file inpaint with a 4 channel UNet
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_pruned.safetensors"
|
||||
pipe = self.pipeline_class.from_single_file(ckpt_path)
|
||||
|
||||
assert pipe.unet.config.in_channels == 4
|
||||
|
||||
@unittest.skip("runwayml original config has been removed")
|
||||
def test_single_file_components_with_original_config(self):
|
||||
return
|
||||
|
||||
@unittest.skip("runwayml original config has been removed")
|
||||
def test_single_file_components_with_original_config_local_files_only(self):
|
||||
return
|
||||
|
||||
|
||||
@slow
|
||||
@require_torch_gpu
|
||||
|
||||
@@ -5,6 +5,7 @@ import unittest
|
||||
import torch
|
||||
|
||||
from diffusers import EulerDiscreteScheduler, StableDiffusionPipeline
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
require_torch_gpu,
|
||||
@@ -25,11 +26,11 @@ enable_full_determinism()
|
||||
@require_torch_gpu
|
||||
class StableDiffusionPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFileTesterMixin):
|
||||
pipeline_class = StableDiffusionPipeline
|
||||
ckpt_path = "https://huggingface.co/runwayml/stable-diffusion-v1-5/blob/main/v1-5-pruned-emaonly.safetensors"
|
||||
ckpt_path = "https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_8_pruned.safetensors"
|
||||
original_config = (
|
||||
"https://raw.githubusercontent.com/CompVis/stable-diffusion/main/configs/stable-diffusion/v1-inference.yaml"
|
||||
)
|
||||
repo_id = "runwayml/stable-diffusion-v1-5"
|
||||
repo_id = "Lykon/dreamshaper-8"
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
@@ -58,8 +59,8 @@ class StableDiffusionPipelineSingleFileSlowTests(unittest.TestCase, SDSingleFile
|
||||
|
||||
def test_single_file_legacy_scheduler_loading(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
pipe = self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -8,6 +8,7 @@ from diffusers import (
|
||||
StableDiffusionXLAdapterPipeline,
|
||||
T2IAdapter,
|
||||
)
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils import load_image
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
@@ -118,8 +119,8 @@ class StableDiffusionXLAdapterPipelineSingleFileSlowTests(unittest.TestCase, SDX
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
single_file_pipe = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, adapter=adapter, safety_checker=None, local_files_only=True
|
||||
@@ -150,8 +151,8 @@ class StableDiffusionXLAdapterPipelineSingleFileSlowTests(unittest.TestCase, SDX
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
@@ -188,8 +189,8 @@ class StableDiffusionXLAdapterPipelineSingleFileSlowTests(unittest.TestCase, SDX
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_original_config = download_original_config(self.original_config, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
|
||||
@@ -5,6 +5,7 @@ import unittest
|
||||
import torch
|
||||
|
||||
from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline
|
||||
from diffusers.loaders.single_file_utils import _extract_repo_id_and_weights_name
|
||||
from diffusers.utils import load_image
|
||||
from diffusers.utils.testing_utils import (
|
||||
enable_full_determinism,
|
||||
@@ -112,8 +113,8 @@ class StableDiffusionXLControlNetPipelineSingleFileSlowTests(unittest.TestCase,
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
single_file_pipe = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path, controlnet=controlnet, safety_checker=None, local_files_only=True
|
||||
@@ -151,8 +152,8 @@ class StableDiffusionXLControlNetPipelineSingleFileSlowTests(unittest.TestCase,
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
local_ckpt_path,
|
||||
@@ -183,8 +184,8 @@ class StableDiffusionXLControlNetPipelineSingleFileSlowTests(unittest.TestCase,
|
||||
)
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
ckpt_filename = self.ckpt_path.split("/")[-1]
|
||||
local_ckpt_path = download_single_file_checkpoint(self.repo_id, ckpt_filename, tmpdir)
|
||||
repo_id, weight_name = _extract_repo_id_and_weights_name(self.ckpt_path)
|
||||
local_ckpt_path = download_single_file_checkpoint(repo_id, weight_name, tmpdir)
|
||||
local_diffusers_config = download_diffusers_config(self.repo_id, tmpdir)
|
||||
|
||||
pipe_single_file = self.pipeline_class.from_single_file(
|
||||
|
||||
Reference in New Issue
Block a user