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
121ed7d3
Commit
121ed7d3
authored
Oct 01, 2022
by
Alexandre Simard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add progress bar for SwinIR in cmd
I do not know how to add them to the UI...
parent
3f417566
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
13 deletions
+16
-13
modules/swinir_model.py
modules/swinir_model.py
+15
-12
webui-user.bat
webui-user.bat
+1
-1
No files found.
modules/swinir_model.py
View file @
121ed7d3
...
@@ -5,6 +5,7 @@ import numpy as np
...
@@ -5,6 +5,7 @@ import numpy as np
import
torch
import
torch
from
PIL
import
Image
from
PIL
import
Image
from
basicsr.utils.download_util
import
load_file_from_url
from
basicsr.utils.download_util
import
load_file_from_url
from
tqdm
import
tqdm
from
modules
import
modelloader
from
modules
import
modelloader
from
modules.paths
import
models_path
from
modules.paths
import
models_path
...
@@ -122,18 +123,20 @@ def inference(img, model, tile, tile_overlap, window_size, scale):
...
@@ -122,18 +123,20 @@ def inference(img, model, tile, tile_overlap, window_size, scale):
E
=
torch
.
zeros
(
b
,
c
,
h
*
sf
,
w
*
sf
,
dtype
=
torch
.
half
,
device
=
device
)
.
type_as
(
img
)
E
=
torch
.
zeros
(
b
,
c
,
h
*
sf
,
w
*
sf
,
dtype
=
torch
.
half
,
device
=
device
)
.
type_as
(
img
)
W
=
torch
.
zeros_like
(
E
,
dtype
=
torch
.
half
,
device
=
device
)
W
=
torch
.
zeros_like
(
E
,
dtype
=
torch
.
half
,
device
=
device
)
for
h_idx
in
h_idx_list
:
with
tqdm
(
total
=
len
(
h_idx_list
)
*
len
(
w_idx_list
),
desc
=
"SwinIR tiles"
)
as
pbar
:
for
w_idx
in
w_idx_list
:
for
h_idx
in
h_idx_list
:
in_patch
=
img
[
...
,
h_idx
:
h_idx
+
tile
,
w_idx
:
w_idx
+
tile
]
for
w_idx
in
w_idx_list
:
out_patch
=
model
(
in_patch
)
in_patch
=
img
[
...
,
h_idx
:
h_idx
+
tile
,
w_idx
:
w_idx
+
tile
]
out_patch_mask
=
torch
.
ones_like
(
out_patch
)
out_patch
=
model
(
in_patch
)
out_patch_mask
=
torch
.
ones_like
(
out_patch
)
E
[
...
,
h_idx
*
sf
:
(
h_idx
+
tile
)
*
sf
,
w_idx
*
sf
:
(
w_idx
+
tile
)
*
sf
E
[
]
.
add_
(
out_patch
)
...
,
h_idx
*
sf
:
(
h_idx
+
tile
)
*
sf
,
w_idx
*
sf
:
(
w_idx
+
tile
)
*
sf
W
[
]
.
add_
(
out_patch
)
...
,
h_idx
*
sf
:
(
h_idx
+
tile
)
*
sf
,
w_idx
*
sf
:
(
w_idx
+
tile
)
*
sf
W
[
]
.
add_
(
out_patch_mask
)
...
,
h_idx
*
sf
:
(
h_idx
+
tile
)
*
sf
,
w_idx
*
sf
:
(
w_idx
+
tile
)
*
sf
]
.
add_
(
out_patch_mask
)
pbar
.
update
(
1
)
output
=
E
.
div_
(
W
)
output
=
E
.
div_
(
W
)
return
output
return
output
webui-user.bat
View file @
121ed7d3
...
@@ -3,6 +3,6 @@
...
@@ -3,6 +3,6 @@
set
PYTHON
=
set
PYTHON
=
set
GIT
=
set
GIT
=
set
VENV_DIR
=
set
VENV_DIR
=
set
COMMANDLINE_ARGS
=
set
COMMANDLINE_ARGS
=
-
-autolaunch
call
webui
.bat
call
webui
.bat
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