Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
H
Hydra Node Http
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Hydra Node Http
Commits
15e1419d
Commit
15e1419d
authored
Sep 14, 2022
by
kurumuz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logging
parent
c0573b3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
hydra_node/models.py
hydra_node/models.py
+7
-1
No files found.
hydra_node/models.py
View file @
15e1419d
...
...
@@ -168,9 +168,11 @@ class StableDiffusionModel(nn.Module):
self
.
config
=
config
self
.
premodules
=
None
if
Path
(
self
.
config
.
model_path
)
.
is_dir
():
config
.
logger
.
info
(
f
"Loading model from folder {self.config.model_path}"
)
model
,
model_config
=
self
.
from_folder
(
config
.
model_path
)
elif
Path
(
self
.
config
.
model_path
)
.
is_file
():
config
.
logger
.
info
(
f
"Loading model from file {self.config.model_path}"
)
model
,
model_config
=
self
.
from_file
(
config
.
model_path
)
else
:
...
...
@@ -195,10 +197,12 @@ class StableDiffusionModel(nn.Module):
model
.
first_stage_model
=
model
.
first_stage_model
.
float
()
del
ckpt
del
loss
config
.
logger
.
info
(
f
"Using VAE from {self.config.vae_path}"
)
if
self
.
config
.
penultimate
==
"1"
:
model
.
cond_stage_model
.
return_layer
=
-
2
model
.
cond_stage_model
.
do_final_ln
=
True
config
.
logger
.
info
(
f
"CLIP: Using penultimate layer"
)
model
.
cond_stage_model
.
inference_mode
=
True
self
.
k_model
=
K
.
external
.
CompVisDenoiser
(
model
)
...
...
@@ -210,6 +214,9 @@ class StableDiffusionModel(nn.Module):
self
.
ema_manager
=
self
.
model
.
ema_scope
if
self
.
config
.
enable_ema
==
"0"
:
self
.
ema_manager
=
contextlib
.
nullcontext
config
.
logger
.
info
(
"Disabling EMA"
)
else
:
config
.
logger
.
info
(
f
"Using EMA"
)
self
.
sampler_map
=
{
'plms'
:
self
.
plms
.
sample
,
'ddim'
:
self
.
ddim
.
sample
,
...
...
@@ -241,7 +248,6 @@ class StableDiffusionModel(nn.Module):
model
=
self
.
load_model_from_config
(
model_config
,
file
)
return
model
,
model_config
def
load_model_from_config
(
self
,
config
,
ckpt
,
verbose
=
False
):
print
(
f
"Loading model from {ckpt}"
)
pl_sd
=
torch
.
load
(
ckpt
,
map_location
=
"cpu"
)
...
...
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