diffusers
diffusers copied to clipboard
[WIP] [LoRA] support omi hidream lora.
What does this PR do?
Check https://github.com/huggingface/diffusers/issues/11653.
This PR isn't at all ready. But opening up to discuss some doubts. Currently, this PR is only aimed at supporting the transformer components of the LoRA state dict (other components will be iterated in this PR itself).
I tried with the following code on top of this PR:
Expand
import torch
from transformers import AutoTokenizer, LlamaForCausalLM
from diffusers import HiDreamImagePipeline
text_encoder_4 = LlamaForCausalLM.from_pretrained(
"terminusresearch/hidream-i1-llama-3.1-8b-instruct",
subfolder="text_encoder_4",
output_hidden_states=True,
output_attentions=True,
torch_dtype=torch.bfloat16,
).to("cuda", dtype=torch.bfloat16)
tokenizer_4 = AutoTokenizer.from_pretrained(
"terminusresearch/hidream-i1-llama-3.1-8b-instruct",
subfolder="tokenizer_4",
)
pipe = HiDreamImagePipeline.from_pretrained(
"HiDream-ai/HiDream-I1-Dev",
text_encoder_4=text_encoder_4,
tokenizer_4 = tokenizer_4,
torch_dtype=torch.bfloat16,
).to("cuda")
pipe.load_lora_weights(f"RhaegarKhan/OMI_LORA")
image = pipe(
'A cat holding a sign that says "Hi-Dreams.ai".',
height=1024,
width=1024,
guidance_scale=5.0,
num_inference_steps=50,
generator=torch.Generator("cuda").manual_seed(0),
).images[0]
image.save("output.png")
However, it currently leads to this problem and I am not sure what those params correspond and how they should be handled in the first place.
Additionally, the LoRA has: https://pastebin.com/diwEwtsS
Could you shed some details @ali-afridi26?