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
chenpangpang
ComfyUI
Commits
21f04fe6
Commit
21f04fe6
authored
Jun 14, 2023
by
comfyanonymous
Browse files
Disable default weight values in unet conv2d for faster loading.
parent
9d54066e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
comfy/ldm/modules/diffusionmodules/util.py
comfy/ldm/modules/diffusionmodules/util.py
+3
-3
comfy/ops.py
comfy/ops.py
+4
-0
No files found.
comfy/ldm/modules/diffusionmodules/util.py
View file @
21f04fe6
...
@@ -16,7 +16,7 @@ import numpy as np
...
@@ -16,7 +16,7 @@ import numpy as np
from
einops
import
repeat
from
einops
import
repeat
from
comfy.ldm.util
import
instantiate_from_config
from
comfy.ldm.util
import
instantiate_from_config
import
comfy.ops
def
make_beta_schedule
(
schedule
,
n_timestep
,
linear_start
=
1e-4
,
linear_end
=
2e-2
,
cosine_s
=
8e-3
):
def
make_beta_schedule
(
schedule
,
n_timestep
,
linear_start
=
1e-4
,
linear_end
=
2e-2
,
cosine_s
=
8e-3
):
if
schedule
==
"linear"
:
if
schedule
==
"linear"
:
...
@@ -233,7 +233,7 @@ def conv_nd(dims, *args, **kwargs):
...
@@ -233,7 +233,7 @@ def conv_nd(dims, *args, **kwargs):
if
dims
==
1
:
if
dims
==
1
:
return
nn
.
Conv1d
(
*
args
,
**
kwargs
)
return
nn
.
Conv1d
(
*
args
,
**
kwargs
)
elif
dims
==
2
:
elif
dims
==
2
:
return
nn
.
Conv2d
(
*
args
,
**
kwargs
)
return
comfy
.
ops
.
Conv2d
(
*
args
,
**
kwargs
)
elif
dims
==
3
:
elif
dims
==
3
:
return
nn
.
Conv3d
(
*
args
,
**
kwargs
)
return
nn
.
Conv3d
(
*
args
,
**
kwargs
)
raise
ValueError
(
f
"unsupported dimensions:
{
dims
}
"
)
raise
ValueError
(
f
"unsupported dimensions:
{
dims
}
"
)
...
@@ -243,7 +243,7 @@ def linear(*args, **kwargs):
...
@@ -243,7 +243,7 @@ def linear(*args, **kwargs):
"""
"""
Create a linear module.
Create a linear module.
"""
"""
return
nn
.
Linear
(
*
args
,
**
kwargs
)
return
comfy
.
ops
.
Linear
(
*
args
,
**
kwargs
)
def
avg_pool_nd
(
dims
,
*
args
,
**
kwargs
):
def
avg_pool_nd
(
dims
,
*
args
,
**
kwargs
):
...
...
comfy/ops.py
View file @
21f04fe6
...
@@ -15,3 +15,7 @@ class Linear(torch.nn.Module):
...
@@ -15,3 +15,7 @@ class Linear(torch.nn.Module):
def
forward
(
self
,
input
):
def
forward
(
self
,
input
):
return
torch
.
nn
.
functional
.
linear
(
input
,
self
.
weight
,
self
.
bias
)
return
torch
.
nn
.
functional
.
linear
(
input
,
self
.
weight
,
self
.
bias
)
class
Conv2d
(
torch
.
nn
.
Conv2d
):
def
reset_parameters
(
self
):
return
None
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