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
xuwx1
LightX2V
Commits
3996d421
"src/diffusers/pipelines/flux/pipeline_flux.py" did not exist on "9b8c8605d14b4543db8e0169d4aac97ad95a2a27"
Commit
3996d421
authored
Apr 29, 2025
by
sandy
Committed by
GitHub
Apr 29, 2025
Browse files
Automatically decide whether to do cfg based on guide_scale
parent
11303152
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
lightx2v/models/networks/wan/model.py
lightx2v/models/networks/wan/model.py
+4
-1
No files found.
lightx2v/models/networks/wan/model.py
View file @
3996d421
...
...
@@ -109,6 +109,9 @@ class WanModel:
self
.
post_weight
.
to_cuda
()
self
.
transformer_weights
.
to_cuda
()
def
do_classifier_free_guidance
(
self
)
->
bool
:
return
self
.
config
.
sample_guide_scale
>
1
@
torch
.
no_grad
()
def
infer
(
self
,
inputs
):
if
self
.
config
[
"cpu_offload"
]:
...
...
@@ -125,7 +128,7 @@ class WanModel:
self
.
scheduler
.
cnt
=
0
self
.
scheduler
.
noise_pred
=
noise_pred_cond
if
self
.
config
[
"enable_cfg"
]
:
if
self
.
do_classifier_free_guidance
()
:
embed
,
grid_sizes
,
pre_infer_out
=
self
.
pre_infer
.
infer
(
self
.
pre_weight
,
inputs
,
positive
=
False
)
x
=
self
.
transformer_infer
.
infer
(
self
.
transformer_weights
,
grid_sizes
,
embed
,
*
pre_infer_out
)
noise_pred_uncond
=
self
.
post_infer
.
infer
(
self
.
post_weight
,
x
,
embed
,
grid_sizes
)[
0
]
...
...
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