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
774ccfe7
Commit
774ccfe7
authored
Jun 16, 2025
by
gushiqiao
Browse files
Fix
parent
a92ea6e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
lightx2v/models/networks/wan/distill_model.py
lightx2v/models/networks/wan/distill_model.py
+2
-6
No files found.
lightx2v/models/networks/wan/distill_model.py
View file @
774ccfe7
...
@@ -20,17 +20,13 @@ class WanDistillModel(WanModel):
...
@@ -20,17 +20,13 @@ class WanDistillModel(WanModel):
def
__init__
(
self
,
model_path
,
config
,
device
):
def
__init__
(
self
,
model_path
,
config
,
device
):
super
().
__init__
(
model_path
,
config
,
device
)
super
().
__init__
(
model_path
,
config
,
device
)
def
_load_ckpt
(
self
):
def
_load_ckpt
(
self
,
use_bf16
,
skip_bf16
):
use_bfloat16
=
GET_DTYPE
()
==
"BF16"
ckpt_path
=
os
.
path
.
join
(
self
.
model_path
,
"distill_model.pt"
)
ckpt_path
=
os
.
path
.
join
(
self
.
model_path
,
"distill_model.pt"
)
if
not
os
.
path
.
exists
(
ckpt_path
):
if
not
os
.
path
.
exists
(
ckpt_path
):
# 文件不存在,调用父类的 _load_ckpt 方法
# 文件不存在,调用父类的 _load_ckpt 方法
return
super
().
_load_ckpt
()
return
super
().
_load_ckpt
()
weight_dict
=
torch
.
load
(
ckpt_path
,
map_location
=
"cpu"
,
weights_only
=
True
)
weight_dict
=
torch
.
load
(
ckpt_path
,
map_location
=
"cpu"
,
weights_only
=
True
)
weight_dict
=
{
key
:
(
weight_dict
[
key
].
to
(
torch
.
bfloat16
)
if
use_bf16
or
all
(
s
not
in
key
for
s
in
skip_bf16
)
else
weight_dict
[
key
]).
pin_memory
().
to
(
self
.
device
)
for
key
in
weight_dict
.
keys
()}
dtype
=
torch
.
bfloat16
if
use_bfloat16
else
None
for
key
,
value
in
weight_dict
.
items
():
weight_dict
[
key
]
=
value
.
to
(
device
=
self
.
device
,
dtype
=
dtype
)
return
weight_dict
return
weight_dict
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