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
2e3472a7
"app/vscode:/vscode.git/clone" did not exist on "bddfa2100f9b708c76c99167a180a05da5140e95"
Commit
2e3472a7
authored
Aug 11, 2025
by
gushiqiao
Committed by
GitHub
Aug 11, 2025
Browse files
Update utils.py
parent
d502fab6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
lightx2v/utils/utils.py
lightx2v/utils/utils.py
+1
-8
No files found.
lightx2v/utils/utils.py
View file @
2e3472a7
...
@@ -375,14 +375,7 @@ def load_weights(checkpoint_path, cpu_offload=False, remove_key=None):
...
@@ -375,14 +375,7 @@ def load_weights(checkpoint_path, cpu_offload=False, remove_key=None):
for
key
in
sorted
(
synced_meta_dict
.
keys
()):
for
key
in
sorted
(
synced_meta_dict
.
keys
()):
tensor_to_broadcast
=
distributed_weight_dict
[
key
]
tensor_to_broadcast
=
distributed_weight_dict
[
key
]
if
is_weight_loader
:
if
is_weight_loader
:
# rank0将CPU权重拷贝到目标设备,准备广播
tensor_to_broadcast
.
copy_
(
cpu_weight_dict
[
key
],
non_blocking
=
True
)
if
cpu_offload
:
# CPU模式:直接复制
tensor_to_broadcast
.
copy_
(
cpu_weight_dict
[
key
],
non_blocking
=
True
)
else
:
# GPU模式:先复制到当前GPU,再广播
tensor_to_broadcast
.
copy_
(
cpu_weight_dict
[
key
],
non_blocking
=
True
)
# 广播到所有ranks
# 广播到所有ranks
dist
.
broadcast
(
tensor_to_broadcast
,
src
=
src_global_rank
)
dist
.
broadcast
(
tensor_to_broadcast
,
src
=
src_global_rank
)
...
...
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