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
73c3e11e
Commit
73c3e11e
authored
Apr 15, 2023
by
comfyanonymous
Browse files
Fix model_management import so it doesn't get executed twice.
parent
81d1f00d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
14 deletions
+14
-14
comfy/ldm/modules/attention.py
comfy/ldm/modules/attention.py
+1
-1
comfy/ldm/modules/diffusionmodules/model.py
comfy/ldm/modules/diffusionmodules/model.py
+1
-1
comfy/ldm/modules/sub_quadratic_attention.py
comfy/ldm/modules/sub_quadratic_attention.py
+1
-1
comfy/samplers.py
comfy/samplers.py
+1
-1
comfy/sd.py
comfy/sd.py
+2
-2
comfy_extras/nodes_upscale_model.py
comfy_extras/nodes_upscale_model.py
+1
-1
nodes.py
nodes.py
+7
-7
No files found.
comfy/ldm/modules/attention.py
View file @
73c3e11e
...
...
@@ -9,7 +9,7 @@ from typing import Optional, Any
from
ldm.modules.diffusionmodules.util
import
checkpoint
from
.sub_quadratic_attention
import
efficient_dot_product_attention
import
model_management
from
comfy
import
model_management
from
.
import
tomesd
...
...
comfy/ldm/modules/diffusionmodules/model.py
View file @
73c3e11e
...
...
@@ -7,7 +7,7 @@ from einops import rearrange
from
typing
import
Optional
,
Any
from
ldm.modules.attention
import
MemoryEfficientCrossAttention
import
model_management
from
comfy
import
model_management
if
model_management
.
xformers_enabled_vae
():
import
xformers
...
...
comfy/ldm/modules/sub_quadratic_attention.py
View file @
73c3e11e
...
...
@@ -24,7 +24,7 @@ except ImportError:
from
torch
import
Tensor
from
typing
import
List
import
model_management
from
comfy
import
model_management
def
dynamic_slice
(
x
:
Tensor
,
...
...
comfy/samplers.py
View file @
73c3e11e
...
...
@@ -3,7 +3,7 @@ from .k_diffusion import external as k_diffusion_external
from
.extra_samplers
import
uni_pc
import
torch
import
contextlib
import
model_management
from
comfy
import
model_management
from
.ldm.models.diffusion.ddim
import
DDIMSampler
from
.ldm.modules.diffusionmodules.util
import
make_ddim_timesteps
...
...
comfy/sd.py
View file @
73c3e11e
...
...
@@ -4,7 +4,7 @@ import copy
import
sd1_clip
import
sd2_clip
import
model_management
from
comfy
import
model_management
from
.ldm.util
import
instantiate_from_config
from
.ldm.models.autoencoder
import
AutoencoderKL
import
yaml
...
...
@@ -388,7 +388,7 @@ class CLIP:
return
cond
def
encode
(
self
,
text
):
tokens
=
self
.
tokenize
r
.
tokenize_with_weights
(
text
)
tokens
=
self
.
tokenize
(
text
)
return
self
.
encode_from_tokens
(
tokens
)
class
VAE
:
...
...
comfy_extras/nodes_upscale_model.py
View file @
73c3e11e
import
os
from
comfy_extras.chainner_models
import
model_loading
import
model_management
from
comfy
import
model_management
import
torch
import
comfy.utils
import
folder_paths
...
...
nodes.py
View file @
73c3e11e
...
...
@@ -21,16 +21,16 @@ import comfy.utils
import
comfy.clip_vision
import
model_management
import
comfy.
model_management
import
importlib
import
folder_paths
def
before_node_execution
():
model_management
.
throw_exception_if_processing_interrupted
()
comfy
.
model_management
.
throw_exception_if_processing_interrupted
()
def
interrupt_processing
(
value
=
True
):
model_management
.
interrupt_current_processing
(
value
)
comfy
.
model_management
.
interrupt_current_processing
(
value
)
MAX_RESOLUTION
=
8192
...
...
@@ -241,7 +241,7 @@ class DiffusersLoader:
model_path
=
os
.
path
.
join
(
search_path
,
model_path
)
break
return
comfy
.
diffusers_convert
.
load_diffusers
(
model_path
,
fp16
=
model_management
.
should_use_fp16
(),
output_vae
=
output_vae
,
output_clip
=
output_clip
,
embedding_directory
=
folder_paths
.
get_folder_paths
(
"embeddings"
))
return
comfy
.
diffusers_convert
.
load_diffusers
(
model_path
,
fp16
=
comfy
.
model_management
.
should_use_fp16
(),
output_vae
=
output_vae
,
output_clip
=
output_clip
,
embedding_directory
=
folder_paths
.
get_folder_paths
(
"embeddings"
))
class
unCLIPCheckpointLoader
:
...
...
@@ -680,7 +680,7 @@ class SetLatentNoiseMask:
def
common_ksampler
(
model
,
seed
,
steps
,
cfg
,
sampler_name
,
scheduler
,
positive
,
negative
,
latent
,
denoise
=
1.0
,
disable_noise
=
False
,
start_step
=
None
,
last_step
=
None
,
force_full_denoise
=
False
):
latent_image
=
latent
[
"samples"
]
noise_mask
=
None
device
=
model_management
.
get_torch_device
()
device
=
comfy
.
model_management
.
get_torch_device
()
if
disable_noise
:
noise
=
torch
.
zeros
(
latent_image
.
size
(),
dtype
=
latent_image
.
dtype
,
layout
=
latent_image
.
layout
,
device
=
"cpu"
)
...
...
@@ -696,7 +696,7 @@ def common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive,
noise_mask
=
noise_mask
.
to
(
device
)
real_model
=
None
model_management
.
load_model_gpu
(
model
)
comfy
.
model_management
.
load_model_gpu
(
model
)
real_model
=
model
.
model
noise
=
noise
.
to
(
device
)
...
...
@@ -726,7 +726,7 @@ def common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive,
control_net_models
=
[]
for
x
in
control_nets
:
control_net_models
+=
x
.
get_control_models
()
model_management
.
load_controlnet_gpu
(
control_net_models
)
comfy
.
model_management
.
load_controlnet_gpu
(
control_net_models
)
if
sampler_name
in
comfy
.
samplers
.
KSampler
.
SAMPLERS
:
sampler
=
comfy
.
samplers
.
KSampler
(
real_model
,
steps
=
steps
,
device
=
device
,
sampler
=
sampler_name
,
scheduler
=
scheduler
,
denoise
=
denoise
,
model_options
=
model
.
model_options
)
...
...
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