From 7899261755c0a350987b3e983b56fe609e33684f Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Fri, 31 May 2024 22:24:19 +0200 Subject: [PATCH 1/2] fix: turbo scheduler loading issue (#3065) * fix: correctly load ModelPatcher * feat: do not load model at all, not needed --- ldm_patched/contrib/external_custom_sampler.py | 3 +-- modules/sample_hijack.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ldm_patched/contrib/external_custom_sampler.py b/ldm_patched/contrib/external_custom_sampler.py index 985b03a0..60d5e3bd 100644 --- a/ldm_patched/contrib/external_custom_sampler.py +++ b/ldm_patched/contrib/external_custom_sampler.py @@ -107,8 +107,7 @@ class SDTurboScheduler: def get_sigmas(self, model, steps, denoise): start_step = 10 - int(10 * denoise) timesteps = torch.flip(torch.arange(1, 11) * 100 - 1, (0,))[start_step:start_step + steps] - ldm_patched.modules.model_management.load_models_gpu([model]) - sigmas = model.model.model_sampling.sigma(timesteps) + sigmas = model.model_sampling.sigma(timesteps) sigmas = torch.cat([sigmas, sigmas.new_zeros([1])]) return (sigmas, ) diff --git a/modules/sample_hijack.py b/modules/sample_hijack.py index 4ab3cbbd..84752ede 100644 --- a/modules/sample_hijack.py +++ b/modules/sample_hijack.py @@ -175,7 +175,7 @@ def calculate_sigmas_scheduler_hacked(model, scheduler_name, steps): elif scheduler_name == "sgm_uniform": sigmas = normal_scheduler(model, steps, sgm=True) elif scheduler_name == "turbo": - sigmas = SDTurboScheduler().get_sigmas(namedtuple('Patcher', ['model'])(model=model), steps=steps, denoise=1.0)[0] + sigmas = SDTurboScheduler().get_sigmas(model=model, steps=steps, denoise=1.0)[0] elif scheduler_name == "align_your_steps": model_type = 'SDXL' if isinstance(model.latent_format, ldm_patched.modules.latent_formats.SDXL) else 'SD1' sigmas = AlignYourStepsScheduler().get_sigmas(model_type=model_type, steps=steps, denoise=1.0)[0] From 07c6c89edf34676da86310dc1749db8ce3d082af Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Fri, 31 May 2024 22:41:36 +0200 Subject: [PATCH 2/2] fix: chown files directly at copy (#3066) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1172c795..820ae94a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN chown -R user:user /content WORKDIR /content USER user -COPY . /content/app +COPY --chown=user:user . /content/app RUN mv /content/app/models /content/app/models.org CMD [ "sh", "-c", "/content/entrypoint.sh ${CMDARGS}" ]