Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fengzch-das
nunchaku
Commits
0f24fcdf
Commit
0f24fcdf
authored
Apr 17, 2025
by
Muyang Li
Committed by
muyangli
Apr 19, 2025
Browse files
Merge pull request #82 from mit-han-lab/dev/muyang
Fix some tests and manually trigger the CI
parent
e129f2fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
dev-scripts/flux_depth_lora.py
dev-scripts/flux_depth_lora.py
+26
-0
No files found.
dev-scripts/flux_depth_lora.py
0 → 100644
View file @
0f24fcdf
import
torch
from
diffusers
import
FluxControlPipeline
from
diffusers.utils
import
load_image
from
image_gen_aux
import
DepthPreprocessor
pipe
=
FluxControlPipeline
.
from_pretrained
(
"black-forest-labs/FLUX.1-dev"
,
torch_dtype
=
torch
.
bfloat16
)
pipe
.
load_lora_weights
(
"black-forest-labs/FLUX.1-Depth-dev-lora"
,
adapter_name
=
"depth"
)
pipe
.
set_adapters
(
"depth"
,
0.85
)
pipe
.
enable_sequential_cpu_offload
()
prompt
=
"A robot made of exotic candies and chocolates of different kinds. The background is filled with confetti and celebratory gifts."
control_image
=
load_image
(
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/robot.png"
)
processor
=
DepthPreprocessor
.
from_pretrained
(
"LiheYoung/depth-anything-large-hf"
)
control_image
=
processor
(
control_image
)[
0
].
convert
(
"RGB"
)
image
=
pipe
(
prompt
=
prompt
,
control_image
=
control_image
,
height
=
1024
,
width
=
1024
,
num_inference_steps
=
30
,
guidance_scale
=
10.0
,
generator
=
torch
.
Generator
().
manual_seed
(
42
),
).
images
[
0
]
image
.
save
(
"output.png"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment