Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
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
Stable Diffusion Webui
Commits
87b50397
Commit
87b50397
authored
Sep 30, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing import, simplify code, use patches module for #13276
parent
e309583f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
modules/sd_models.py
modules/sd_models.py
+12
-7
No files found.
modules/sd_models.py
View file @
87b50397
...
...
@@ -14,7 +14,7 @@ import ldm.modules.midas as midas
from
ldm.util
import
instantiate_from_config
from
modules
import
paths
,
shared
,
modelloader
,
devices
,
script_callbacks
,
sd_vae
,
sd_disable_initialization
,
errors
,
hashes
,
sd_models_config
,
sd_unet
,
sd_models_xl
,
cache
,
extra_networks
,
processing
,
lowvram
,
sd_hijack
from
modules
import
paths
,
shared
,
modelloader
,
devices
,
script_callbacks
,
sd_vae
,
sd_disable_initialization
,
errors
,
hashes
,
sd_models_config
,
sd_unet
,
sd_models_xl
,
cache
,
extra_networks
,
processing
,
lowvram
,
sd_hijack
,
patches
from
modules.timer
import
Timer
import
tomesd
import
numpy
as
np
...
...
@@ -130,6 +130,8 @@ except Exception:
def
setup_model
():
"""called once at startup to do various one-time tasks related to SD models"""
os
.
makedirs
(
model_path
,
exist_ok
=
True
)
enable_midas_autodownload
()
...
...
@@ -458,14 +460,17 @@ def enable_midas_autodownload():
def
patch_given_betas
():
original_register_schedule
=
ldm
.
models
.
diffusion
.
ddpm
.
DDPM
.
register_schedule
import
ldm.models.diffusion.ddpm
def
patched_register_schedule
(
*
args
,
**
kwargs
):
if
args
[
1
]
is
not
None
and
isinstance
(
args
[
1
],
ListConfig
):
modified_args
=
list
(
args
)
# Convert args tuple to a list
modified_args
[
1
]
=
np
.
array
(
args
[
1
])
# Modify the desired element
args
=
tuple
(
modified_args
)
# Convert the list back to a tuple
"""a modified version of register_schedule function that converts plain list from Omegaconf into numpy"""
if
isinstance
(
args
[
1
],
ListConfig
):
args
=
(
args
[
0
],
np
.
array
(
args
[
1
]),
*
args
[
2
:])
original_register_schedule
(
*
args
,
**
kwargs
)
ldm
.
models
.
diffusion
.
ddpm
.
DDPM
.
register_schedule
=
patched_register_schedule
original_register_schedule
=
patches
.
patch
(
__name__
,
ldm
.
models
.
diffusion
.
ddpm
.
DDPM
,
'register_schedule'
,
patched_register_schedule
)
def
repair_config
(
sd_config
):
...
...
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