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
ad02b249
Commit
ad02b249
authored
Sep 08, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a helpful message when user puts RealESRGAN model into ESRGAN directory.
parent
62ce77e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
modules/esrgan_model.py
modules/esrgan_model.py
+8
-5
No files found.
modules/esrgan_model.py
View file @
ad02b249
...
...
@@ -14,17 +14,20 @@ import modules.images
def
load_model
(
filename
):
# this code is adapted from https://github.com/xinntao/ESRGAN
if
torch
.
has_mps
:
map_l
=
'cpu'
else
:
map_l
=
None
pretrained_net
=
torch
.
load
(
filename
,
map_location
=
map_l
)
pretrained_net
=
torch
.
load
(
filename
,
map_location
=
'cpu'
if
torch
.
has_mps
else
None
)
crt_model
=
arch
.
RRDBNet
(
3
,
3
,
64
,
23
,
gc
=
32
)
if
'conv_first.weight'
in
pretrained_net
:
crt_model
.
load_state_dict
(
pretrained_net
)
return
crt_model
if
'model.0.weight'
not
in
pretrained_net
:
is_realesrgan
=
"params_ema"
in
pretrained_net
and
'body.0.rdb1.conv1.weight'
in
pretrained_net
[
"params_ema"
]
if
is_realesrgan
:
raise
Exception
(
"The file is a RealESRGAN model, it can't be used as a ESRGAN model."
)
else
:
raise
Exception
(
"The file is not a ESRGAN model."
)
crt_net
=
crt_model
.
state_dict
()
load_net_clean
=
{}
for
k
,
v
in
pretrained_net
.
items
():
...
...
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