qpqpqpqpqpqp commited on
Commit
bf3f0f2
·
verified ·
1 Parent(s): 8455b9b

Delete Junk

Browse files
.ipynb_checkpoints/README-checkpoint.md DELETED
@@ -1,98 +0,0 @@
1
- # Flux Anime Landscape lora Usage
2
- - 🙂 This lora focus light up the anime landscape scene. ☀
3
- - Trigger word: anime style
4
-
5
- ## Installtion
6
- ```bash
7
- pip install -U diffusers transformers torch sentencepiece peft controlnet-aux moviepy protobuf
8
- ```
9
-
10
- ## Demo
11
- ```python
12
- import torch
13
- from diffusers import FluxPipeline
14
-
15
- pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
16
- pipe.load_lora_weights("Flux_Anime_Landscape_Lora/my_first_flux_lora_v1_000001500.safetensors")
17
- pipe.enable_sequential_cpu_offload()
18
-
19
- prompt = "anime style ,high quality nature video featuring a red panda balancing on a bamboo stem while a bird lands on it's head, on the background there is a waterfall"
20
-
21
- image = pipe(prompt,
22
- num_inference_steps=50,
23
- guidance_scale=3.5,
24
- ).images[0]
25
- image.save("ani0.png")
26
- from IPython import display
27
- display.Image("ani0.png", width=512, height=512)
28
- ```
29
-
30
-
31
- ```python
32
- prompt = "anime style, Sunlight filters through clouds onto a cherry blossom-filled meadow, where a blue-haired youth in an indigo coat stands by a vermilion bridge, holding a book as petals drift past his smile. The scene blends dynamic nature with human stillness, using pink, red and blue hues to create harmony, while symbolic elements like blossoms and books add depth."
33
-
34
- image = pipe(prompt,
35
- num_inference_steps=50,
36
- guidance_scale=3.5,
37
- ).images[0]
38
- image.save("ani1.png")
39
- from IPython import display
40
- display.Image("ani1.png", width=512, height=512)
41
- ```
42
-
43
- ## OmniConsistency Demo
44
- - refer to https://github.com/showlab/OmniConsistency
45
-
46
- - Image Input (xiang_image.jpg)
47
-
48
- ```python
49
- import time
50
- import torch
51
- import os
52
- from tqdm import tqdm
53
- from PIL import Image
54
- from src_inference.pipeline import FluxPipeline
55
- from src_inference.lora_helper import set_single_lora
56
-
57
- # 初始化基础模型
58
- base_path = "black-forest-labs/FLUX.1-dev"
59
- pipe = FluxPipeline.from_pretrained(base_path, torch_dtype=torch.bfloat16)
60
-
61
- # 设置OmniConsistency LoRA
62
- set_single_lora(pipe.transformer,
63
- "OmniConsistency/OmniConsistency.safetensors",
64
- lora_weights=[1], cond_size=512)
65
-
66
- pipe.load_lora_weights("Flux_Anime_Landscape_Lora/my_first_flux_lora_v1_000001500.safetensors")
67
-
68
- # 启用CPU offload节省显存
69
- pipe.enable_sequential_cpu_offload()
70
-
71
- image_path1 = "xiang_image.jpg"
72
-
73
- subject_images = []
74
- spatial_image = [Image.open(image_path1).convert("RGB")]
75
-
76
- width, height = 1024, 1024
77
-
78
- style_prompt = "anime style, A young man with black hair and glasses sits outdoors in a white T-shirt, surrounded by lush green foliage. The natural backdrop contrasts with his relaxed posture, creating a serene vibe."
79
-
80
- image = pipe(
81
- style_prompt,
82
- height=height,
83
- width=width,
84
- guidance_scale=3.5,
85
- num_inference_steps=25,
86
- max_sequence_length=512,
87
- generator=torch.Generator("cpu").manual_seed(5),
88
- spatial_images=spatial_image,
89
- subject_images=subject_images,
90
- cond_size=512,
91
- ).images[0]
92
-
93
- image.save("im0.png")
94
- from IPython import display
95
- display.Image("im0.png", width=512, height=512)
96
- ```
97
-
98
-