From b21ebabcdd1d47b23b51249cbc7dba22a9d71eda Mon Sep 17 00:00:00 2001 From: Alahari Prudhvi Akhil Date: Fri, 18 Oct 2024 19:25:15 +0530 Subject: [PATCH] Remove unused imports --- .../qairt_sd_controlnet_pipeline.py | 18 +----------------- .../qairt_accelerate/qairt_sd_pipeline.py | 16 +--------------- .../qairt_sd_unclip_pipeline.py | 16 ++++------------ .../scripts/qairt_accelerate.py | 3 --- 4 files changed, 6 insertions(+), 47 deletions(-) diff --git a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_controlnet_pipeline.py b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_controlnet_pipeline.py index 04e9a3b..f512abd 100644 --- a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_controlnet_pipeline.py +++ b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_controlnet_pipeline.py @@ -6,38 +6,22 @@ # # ============================================================================= -import time from PIL import Image import os -import shutil import cv2 import numpy as np import torch from transformers import CLIPTokenizer -from diffusers import DPMSolverMultistepScheduler -from modules import paths, shared, modelloader +from modules import paths from qai_appbuilder import ( QNNContext, - QNNContextProc, - QNNShareMemory, Runtime, LogLevel, ProfilingLevel, PerfProfile, QNNConfig, - timer, ) -from diffusers import UNet2DConditionModel from diffusers.models.embeddings import get_timestep_embedding, TimestepEmbedding -from diffusers import ( - DDIMScheduler, - DPMSolverMultistepScheduler, - EulerAncestralDiscreteScheduler, - EulerDiscreteScheduler, - HeunDiscreteScheduler, - LMSDiscreteScheduler, - PNDMScheduler, -) import qairt_constants as consts from pipeline_utils import StableDiffusionInput, download_qualcomm_models_hf, UpscalerPipeline, QPipeline, set_scheduler from modules.safe import unsafe_torch_load as load diff --git a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_pipeline.py b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_pipeline.py index 108ecd1..2084858 100644 --- a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_pipeline.py +++ b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_pipeline.py @@ -6,16 +6,12 @@ # # ============================================================================= -import time from PIL import Image import os -import shutil -import cv2 import numpy as np import torch from transformers import CLIPTokenizer -from diffusers import DPMSolverMultistepScheduler -from modules import paths, shared, modelloader +from modules import paths from qai_appbuilder import ( QNNContext, Runtime, @@ -25,17 +21,7 @@ QNNConfig, timer, ) -from diffusers import UNet2DConditionModel from diffusers.models.embeddings import get_timestep_embedding, TimestepEmbedding -from diffusers import ( - DDIMScheduler, - DPMSolverMultistepScheduler, - EulerAncestralDiscreteScheduler, - EulerDiscreteScheduler, - HeunDiscreteScheduler, - LMSDiscreteScheduler, - PNDMScheduler, -) import qairt_constants as consts from pipeline_utils import StableDiffusionInput, UpscalerPipeline, QPipeline, set_scheduler diff --git a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_unclip_pipeline.py b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_unclip_pipeline.py index 67dc6e7..3a798b9 100644 --- a/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_unclip_pipeline.py +++ b/plugins/stable-diffusion-webui/qairt_accelerate/qairt_sd_unclip_pipeline.py @@ -6,23 +6,16 @@ # # ============================================================================= -import time from PIL import Image -import PIL import os -import sys -import shutil -import cv2 import numpy as np import torch from skimage.transform import resize from modules.safe import unsafe_torch_load as load -from transformers import CLIPTokenizer, CLIPImageProcessor, CLIPVisionModelWithProjection, CLIPTextModel +from transformers import CLIPTokenizer, CLIPImageProcessor # from modules import paths, shared, modelloader from qai_appbuilder import ( QNNContext, - QNNContextProc, - QNNShareMemory, Runtime, LogLevel, ProfilingLevel, @@ -30,13 +23,12 @@ QNNConfig, timer, ) -from diffusers import UNet2DConditionModel, DDPMScheduler -from diffusers.pipelines.stable_diffusion.stable_unclip_image_normalizer import StableUnCLIPImageNormalizer -from diffusers.models.embeddings import get_timestep_embedding, TimestepEmbedding, Timesteps +from diffusers import DDPMScheduler +from diffusers.models.embeddings import get_timestep_embedding, TimestepEmbedding import install import common_utils as utils import qairt_constants as consts -from pipeline_utils import StableDiffusionInput, download_qualcomm_models_hf, UpscalerPipeline, QPipeline, set_scheduler +from pipeline_utils import StableDiffusionInput, UpscalerPipeline, QPipeline, set_scheduler class TextEncoder(QNNContext): diff --git a/plugins/stable-diffusion-webui/qairt_accelerate/scripts/qairt_accelerate.py b/plugins/stable-diffusion-webui/qairt_accelerate/scripts/qairt_accelerate.py index b011538..e99de81 100644 --- a/plugins/stable-diffusion-webui/qairt_accelerate/scripts/qairt_accelerate.py +++ b/plugins/stable-diffusion-webui/qairt_accelerate/scripts/qairt_accelerate.py @@ -97,9 +97,6 @@ def run(self, p: StableDiffusionProcessing, qnn_model_name, enable_upscale, upsc time_start = time.time() user_seed = get_fixed_seed(p.seed) - supported_samplers = ["DPM++ 2M"] - # if p.sampler_name not in supported_samplers: - # p.sampler_name = "DPM++ 2M" sd_input = StableDiffusionInput( self.is_txt2img,