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
8d606451
Commit
8d606451
authored
Sep 30, 2022
by
d8ahazard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix model paths, ensure we have the right files.
Also, clean up logging in the ldsr arch file.
parent
64c6b133
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
modules/ldsr_model.py
modules/ldsr_model.py
+7
-2
modules/ldsr_model_arch.py
modules/ldsr_model_arch.py
+1
-2
No files found.
modules/ldsr_model.py
View file @
8d606451
...
@@ -24,13 +24,18 @@ class UpscalerLDSR(Upscaler):
...
@@ -24,13 +24,18 @@ class UpscalerLDSR(Upscaler):
def
load_model
(
self
,
path
:
str
):
def
load_model
(
self
,
path
:
str
):
# Remove incorrect project.yaml file if too big
# Remove incorrect project.yaml file if too big
yaml_path
=
os
.
path
.
join
(
self
.
model_path
,
"project.yaml"
)
yaml_path
=
os
.
path
.
join
(
self
.
model_path
,
"project.yaml"
)
old_model_path
=
os
.
path
.
join
(
self
.
model_path
,
"model.pth"
)
new_model_path
=
os
.
path
.
join
(
self
.
model_path
,
"model.ckpt"
)
if
os
.
path
.
exists
(
yaml_path
):
if
os
.
path
.
exists
(
yaml_path
):
statinfo
=
os
.
stat
(
yaml_path
)
statinfo
=
os
.
stat
(
yaml_path
)
if
statinfo
.
st_size
<
=
10485760
:
if
statinfo
.
st_size
>
=
10485760
:
print
(
"Removing invalid LDSR YAML file."
)
print
(
"Removing invalid LDSR YAML file."
)
os
.
remove
(
yaml_path
)
os
.
remove
(
yaml_path
)
if
os
.
path
.
exists
(
old_model_path
):
print
(
"Renaming model from model.pth to model.ckpt"
)
os
.
rename
(
old_model_path
,
new_model_path
)
model
=
load_file_from_url
(
url
=
self
.
model_url
,
model_dir
=
self
.
model_path
,
model
=
load_file_from_url
(
url
=
self
.
model_url
,
model_dir
=
self
.
model_path
,
file_name
=
"model.
pth
"
,
progress
=
True
)
file_name
=
"model.
ckpt
"
,
progress
=
True
)
yaml
=
load_file_from_url
(
url
=
self
.
yaml_url
,
model_dir
=
self
.
model_path
,
yaml
=
load_file_from_url
(
url
=
self
.
yaml_url
,
model_dir
=
self
.
model_path
,
file_name
=
"project.yaml"
,
progress
=
True
)
file_name
=
"project.yaml"
,
progress
=
True
)
...
...
modules/ldsr_model_arch.py
View file @
8d606451
...
@@ -100,7 +100,6 @@ class LDSR:
...
@@ -100,7 +100,6 @@ class LDSR:
# If we can adjust the max upscale size, then the 4 below should be our variable
# If we can adjust the max upscale size, then the 4 below should be our variable
print
(
"Foo"
)
print
(
"Foo"
)
down_sample_rate
=
target_scale
/
4
down_sample_rate
=
target_scale
/
4
print
(
f
"Downsample rate is {down_sample_rate}"
)
wd
=
width_og
*
down_sample_rate
wd
=
width_og
*
down_sample_rate
hd
=
height_og
*
down_sample_rate
hd
=
height_og
*
down_sample_rate
width_downsampled_pre
=
int
(
wd
)
width_downsampled_pre
=
int
(
wd
)
...
@@ -111,7 +110,7 @@ class LDSR:
...
@@ -111,7 +110,7 @@ class LDSR:
f
'Downsampling from [{width_og}, {height_og}] to [{width_downsampled_pre}, {height_downsampled_pre}]'
)
f
'Downsampling from [{width_og}, {height_og}] to [{width_downsampled_pre}, {height_downsampled_pre}]'
)
im_og
=
im_og
.
resize
((
width_downsampled_pre
,
height_downsampled_pre
),
Image
.
LANCZOS
)
im_og
=
im_og
.
resize
((
width_downsampled_pre
,
height_downsampled_pre
),
Image
.
LANCZOS
)
else
:
else
:
print
(
f
"Down sample rate is 1 from {target_scale} / 4"
)
print
(
f
"Down sample rate is 1 from {target_scale} / 4
(Not downsampling)
"
)
logs
=
self
.
run
(
model
[
"model"
],
im_og
,
diffusion_steps
,
eta
)
logs
=
self
.
run
(
model
[
"model"
],
im_og
,
diffusion_steps
,
eta
)
sample
=
logs
[
"sample"
]
sample
=
logs
[
"sample"
]
...
...
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