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
c7f41661
Commit
c7f41661
authored
Feb 19, 2025
by
muyangli
Browse files
[minor] fix a bug when converting loras
parent
c03abb58
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
nunchaku/__version__.py
nunchaku/__version__.py
+1
-1
nunchaku/lora/flux/convert.py
nunchaku/lora/flux/convert.py
+2
-2
nunchaku/utils.py
nunchaku/utils.py
+1
-1
No files found.
nunchaku/__version__.py
View file @
c7f41661
__version__
=
"0.0.2beta
5
"
__version__
=
"0.0.2beta
6
"
nunchaku/lora/flux/convert.py
View file @
c7f41661
...
@@ -54,7 +54,7 @@ if __name__ == "__main__":
...
@@ -54,7 +54,7 @@ if __name__ == "__main__":
lora_format
=
args
.
lora_format
lora_format
=
args
.
lora_format
if
lora_format
==
"diffusers"
:
if
lora_format
==
"diffusers"
:
extra_lora_dict
=
load_state_dict_in_safetensors
(
args
.
lora_path
,
filter_prefix
=
"transformer."
)
extra_lora_dict
=
load_state_dict_in_safetensors
(
args
.
lora_path
)
else
:
else
:
if
lora_format
==
"comfyui"
:
if
lora_format
==
"comfyui"
:
extra_lora_dict
=
comfyui2diffusers
(
args
.
lora_path
)
extra_lora_dict
=
comfyui2diffusers
(
args
.
lora_path
)
...
@@ -62,7 +62,7 @@ if __name__ == "__main__":
...
@@ -62,7 +62,7 @@ if __name__ == "__main__":
extra_lora_dict
=
xlab2diffusers
(
args
.
lora_path
)
extra_lora_dict
=
xlab2diffusers
(
args
.
lora_path
)
else
:
else
:
raise
NotImplementedError
(
f
"LoRA format
{
lora_format
}
is not supported."
)
raise
NotImplementedError
(
f
"LoRA format
{
lora_format
}
is not supported."
)
extra_lora_dict
=
filter_state_dict
(
extra_lora_dict
,
filter_prefix
=
"transformer."
)
extra_lora_dict
=
filter_state_dict
(
extra_lora_dict
)
converted
=
convert_to_nunchaku_flux_lowrank_dict
(
converted
=
convert_to_nunchaku_flux_lowrank_dict
(
base_model
=
orig_state_dict
,
base_model
=
orig_state_dict
,
...
...
nunchaku/utils.py
View file @
c7f41661
...
@@ -55,7 +55,7 @@ def load_state_dict_in_safetensors(
...
@@ -55,7 +55,7 @@ def load_state_dict_in_safetensors(
return
state_dict
return
state_dict
def
filter_state_dict
(
state_dict
:
dict
[
str
,
torch
.
Tensor
],
filter_prefix
:
str
)
->
dict
[
str
,
torch
.
Tensor
]:
def
filter_state_dict
(
state_dict
:
dict
[
str
,
torch
.
Tensor
],
filter_prefix
:
str
=
""
)
->
dict
[
str
,
torch
.
Tensor
]:
"""Filter state dict.
"""Filter state dict.
Args:
Args:
...
...
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