Views
No views yet

1- OMSPipeline.from_pretrained('h1t/oms_b_openclip_xl', ...)
2+ OMSPipeline.from_pretrained('kaeru-shigure/oms_b_openclip_xl', ...)1--- a/diffusers_patch/models/unet_2d_condition_woct.py
2+++ b/diffusers_patch/models/unet_2d_condition_woct.py
3@@ -35,7 +35,7 @@ from diffusers.models.embeddings import (
4 Timesteps,
5 )
6 from diffusers.models.modeling_utils import ModelMixin
7-from diffusers.models.unet_2d_blocks import (
8+from diffusers.models.unets.unet_2d_blocks import (
9 CrossAttnDownBlock2D,
10 CrossAttnUpBlock2D,
11 DownBlock2D,
12@@ -159,6 +159,7 @@ class UNet2DConditionWoCTModel(ModelMixin, ConfigMixin, UNet2DConditionLoadersMi
13 conv_out_kernel: int = 3,
14 mid_block_only_cross_attention: Optional[bool] = None,
15 cross_attention_norm: Optional[str] = None,
16+ subfolder: Optional[str] = None,
17 ):
18 super().__init__()1--- a/diffusers_patch/pipelines/oms/pipeline_oms.py
2+++ b/diffusers_patch/pipelines/oms/pipeline_oms.py
3@@ -8,6 +8,7 @@ from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokeniz
4
5 from diffusers.loaders import FromSingleFileMixin
6
7+from huggingface_hub.constants import HF_HUB_CACHE, HF_HUB_OFFLINE
8 from diffusers.utils import (
9 USE_PEFT_BACKEND,
10 deprecate,
11@@ -17,6 +18,7 @@ from diffusers.utils.torch_utils import randn_tensor
12 from diffusers.pipelines.pipeline_utils import DiffusionPipeline
13 from diffusers.pipelines.pipeline_utils import *
14 from diffusers.pipelines.pipeline_utils import _get_pipeline_class
15+from diffusers.pipelines.pipeline_loading_utils import *
16 from diffusers.models.modeling_utils import _LOW_CPU_MEM_USAGE_DEFAULT
17
18 from diffusers_patch.models.unet_2d_condition_woct import UNet2DConditionWoCTModel
19@@ -164,7 +166,8 @@ class OMSPipeline(DiffusionPipeline, FromSingleFileMixin):
20 sd_pipeline: DiffusionPipeline,
21 oms_text_encoder:Optional[Union[CLIPTextModel, SDXLTextEncoder]],
22 oms_tokenizer:Optional[Union[CLIPTokenizer, SDXLTokenizer]],
23- sd_scheduler = None
24+ sd_scheduler = None,
25+ trust_remote_code: bool = False,
26 ):
27 # assert sd_pipeline is not None
28
29@@ -279,7 +282,7 @@ class OMSPipeline(DiffusionPipeline, FromSingleFileMixin):
30
31 @classmethod
32 os.PathLike]], **kwargs):
33- cache_dir = kwargs.pop("cache_dir", DIFFUSERS_CACHE)
34+ cache_dir = kwargs.pop("cache_dir", HF_HUB_CACHE)
35 resume_download = kwargs.pop("resume_download", False)
36 force_download = kwargs.pop("force_download", False)
37 proxies = kwargs.pop("proxies", None)diffusers with a customized pipeline github. To run the model (especially with LCM variant), first install the latest version of diffusers library as well as accelerate and transformers.1pip install --upgrade pip
2pip install --upgrade diffusers transformers accelerate1git clone https://github.com/mhh0318/OneMoreStep.git
2cd OneMoreStepstabilityai/stable-diffusion-xl-base-1.0.
And all the SDXL based model and its LoRA can share the same OMS h1t/oms_b_openclip_xl.1import torch
2from diffusers import StableDiffusionXLPipeline, LCMScheduler
3
4sd_pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16, variant="fp16", add_watermarker=False).to('cuda')
5
6sd_scheduler = LCMScheduler.from_config(sd_pipe.scheduler.config)
7sd_pipe.load_lora_weights('latent-consistency/lcm-lora-sdxl', variant="fp16").safetensors to HuggingFace Hub. There are 2 choices for SDXL backbone currently, one is base OMS module with OpenCLIP text encoder h1t/oms_b_openclip_xl) and the other is large OMS module with two text encoder followed by SDXL architecture h1t/oms_l_mixclip_xl).1from diffusers_patch import OMSPipeline
2
3pipe = OMSPipeline.from_pretrained('h1t/oms_b_openclip_xl', sd_pipeline = sd_pipe, torch_dtype=torch.float16, variant="fp16", trust_remote_code=True, sd_scheduler=sd_scheduler)
4pipe.to('cuda')1prompt = 'close-up photography of old man standing in the rain at night, in a street lit by lamps, leica 35mm summilux'
2generator = torch.Generator(device=pipe.device).manual_seed(1024)
3
4image = pipe(prompt, guidance_scale=1, num_inference_steps=4, generator=generator)
5image['images'][0]
1image = pipe(prompt, guidance_scale=1, num_inference_steps=4, generator=generator, oms_flag=False)
2image['images'][0]