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
c2f2d263
Commit
c2f2d263
authored
Sep 18, 2025
by
gushiqiao
Committed by
GitHub
Sep 18, 2025
Browse files
[Fix] Fix bugs (#318)
parent
ed1a937b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lightx2v/utils/utils.py
lightx2v/utils/utils.py
+4
-4
No files found.
lightx2v/utils/utils.py
View file @
c2f2d263
...
@@ -364,17 +364,17 @@ def load_pt_safetensors(in_path, remove_key):
...
@@ -364,17 +364,17 @@ def load_pt_safetensors(in_path, remove_key):
def
load_weights
(
checkpoint_path
,
cpu_offload
=
False
,
remove_key
=
None
,
load_from_rank0
=
False
):
def
load_weights
(
checkpoint_path
,
cpu_offload
=
False
,
remove_key
=
None
,
load_from_rank0
=
False
):
if
not
dist
.
is_initialized
():
if
not
dist
.
is_initialized
()
or
not
load_from_rank0
:
# Single GPU mode
# Single GPU mode
logger
.
info
(
f
"Loading weights from
{
checkpoint_path
}
"
)
logger
.
info
(
f
"Loading weights from
{
checkpoint_path
}
"
)
cpu_weight_dict
=
load_pt_safetensors
(
checkpoint_path
,
remove_key
)
cpu_weight_dict
=
load_pt_safetensors
(
checkpoint_path
,
remove_key
)
return
cpu_weight_dict
return
cpu_weight_dict
# Multi-GPU mode
# Multi-GPU mode
is_weight_loader
=
Tru
e
is_weight_loader
=
Fals
e
current_rank
=
dist
.
get_rank
()
current_rank
=
dist
.
get_rank
()
if
load_from_rank0
and
current_rank
!
=
0
:
if
current_rank
=
=
0
:
is_weight_loader
=
Fals
e
is_weight_loader
=
Tru
e
cpu_weight_dict
=
{}
cpu_weight_dict
=
{}
if
is_weight_loader
:
if
is_weight_loader
:
...
...
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