Views
No views yet
a man to trigger the image generation.1 >>> import torch
2 >>> from transformers import PreTrainedTokenizerFast, LlamaForCausalLM
3 >>> from diffusers import HiDreamImagePipeline
4
5 >>> tokenizer_4 = PreTrainedTokenizerFast.from_pretrained("meta-llama/Meta-Llama-3.1-8B-Instruct")
6 >>> text_encoder_4 = LlamaForCausalLM.from_pretrained(
7 ... "meta-llama/Meta-Llama-3.1-8B-Instruct",
8 ... output_hidden_states=True,
9 ... output_attentions=True,
10 ... torch_dtype=torch.bfloat16,
11 ... )
12
13 >>> pipe = HiDreamImagePipeline.from_pretrained(
14 ... "HiDream-ai/HiDream-I1-Full",
15 ... tokenizer_4=tokenizer_4,
16 ... text_encoder_4=text_encoder_4,
17 ... torch_dtype=torch.bfloat16,
18 ... )
19 >>> pipe.enable_model_cpu_offload()
20 >>> pipe.load_lora_weights(f"Nomnoos/trained-hidream-lora-pickle")
21 >>> image = pipe(f"a man").images[0]
22
23# TODO: add an example code snippet for running this diffusion pipeline