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
a7375103
Commit
a7375103
authored
May 17, 2023
by
comfyanonymous
Browse files
Some small changes to Load/SaveLatent.
parent
e7f2816c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
nodes.py
nodes.py
+8
-4
No files found.
nodes.py
View file @
a7375103
...
@@ -11,6 +11,7 @@ import time
...
@@ -11,6 +11,7 @@ import time
from
PIL
import
Image
from
PIL
import
Image
from
PIL.PngImagePlugin
import
PngInfo
from
PIL.PngImagePlugin
import
PngInfo
import
numpy
as
np
import
numpy
as
np
import
safetensors.torch
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"comfy"
))
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"comfy"
))
...
@@ -29,7 +30,6 @@ import importlib
...
@@ -29,7 +30,6 @@ import importlib
import
folder_paths
import
folder_paths
import
safetensors.torch
as
sft
def
before_node_execution
():
def
before_node_execution
():
comfy
.
model_management
.
throw_exception_if_processing_interrupted
()
comfy
.
model_management
.
throw_exception_if_processing_interrupted
()
...
@@ -307,7 +307,10 @@ class SaveLatent:
...
@@ -307,7 +307,10 @@ class SaveLatent:
file
=
f
"
{
filename
}
_
{
counter
:
05
}
_.latent"
file
=
f
"
{
filename
}
_
{
counter
:
05
}
_.latent"
file
=
os
.
path
.
join
(
full_output_folder
,
file
)
file
=
os
.
path
.
join
(
full_output_folder
,
file
)
sft
.
save_file
(
samples
,
file
,
metadata
=
metadata
)
output
=
{}
output
[
"latent_tensor"
]
=
samples
[
"samples"
]
safetensors
.
torch
.
save_file
(
output
,
file
,
metadata
=
metadata
)
return
{}
return
{}
...
@@ -328,9 +331,10 @@ class LoadLatent:
...
@@ -328,9 +331,10 @@ class LoadLatent:
def
load
(
self
,
latent
):
def
load
(
self
,
latent
):
file
=
folder_paths
.
get_annotated_filepath
(
latent
,
self
.
input_dir
)
file
=
folder_paths
.
get_annotated_filepath
(
latent
,
self
.
input_dir
)
latent
=
sft
.
load_file
(
file
,
device
=
"cpu"
)
latent
=
safetensors
.
torch
.
load_file
(
file
,
device
=
"cpu"
)
samples
=
{
"samples"
:
latent
[
"latent_tensor"
]}
return
(
latent
,
)
return
(
samples
,
)
class
CheckpointLoader
:
class
CheckpointLoader
:
...
...
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