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
66b6bb09
Commit
66b6bb09
authored
Aug 06, 2022
by
novelailab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error handling
parent
4c358ee7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
hydra_node/models.py
hydra_node/models.py
+2
-2
No files found.
hydra_node/models.py
View file @
66b6bb09
...
@@ -18,7 +18,6 @@ from PIL import Image
...
@@ -18,7 +18,6 @@ from PIL import Image
def
pil_upscale
(
image
,
scale
=
1
):
def
pil_upscale
(
image
,
scale
=
1
):
device
=
image
.
device
device
=
image
.
device
dtype
=
image
.
dtype
dtype
=
image
.
dtype
#image = Image.open("bob_Ross_as_captain_America__oil_on_canvas_artstation_by_J._C._Leyendecker_and_Edmund_Blair_Leighton_and_Charlie_Bowater_octane_render-0.jpg").convert("RGB") #image = Image.load("./Untitle524245425d.png")#
image
=
Image
.
fromarray
((
image
.
cpu
()
.
permute
(
1
,
2
,
0
)
.
numpy
()
.
astype
(
np
.
float32
)
*
255.
)
.
astype
(
np
.
uint8
))
image
=
Image
.
fromarray
((
image
.
cpu
()
.
permute
(
1
,
2
,
0
)
.
numpy
()
.
astype
(
np
.
float32
)
*
255.
)
.
astype
(
np
.
uint8
))
if
scale
>
1
:
if
scale
>
1
:
image
=
image
.
resize
((
int
(
image
.
width
*
scale
),
int
(
image
.
height
*
scale
)),
resample
=
Image
.
LANCZOS
)
image
=
image
.
resize
((
int
(
image
.
width
*
scale
),
int
(
image
.
height
*
scale
)),
resample
=
Image
.
LANCZOS
)
...
@@ -211,7 +210,8 @@ class StableDiffusionModel(nn.Module):
...
@@ -211,7 +210,8 @@ class StableDiffusionModel(nn.Module):
)
)
x_samples_ddim
=
self
.
model
.
decode_first_stage
(
samples
)
x_samples_ddim
=
self
.
model
.
decode_first_stage
(
samples
)
x_samples_ddim
=
torch
.
clamp
((
x_samples_ddim
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
x_samples_ddim
=
torch
.
clamp
((
x_samples_ddim
+
1.0
)
/
2.0
,
min
=
0.0
,
max
=
1.0
)
.
squeeze
(
0
)
x_samples_ddim
=
pil_upscale
(
x_samples_ddim
,
scale
=
2
)
with
torch
.
autocast
(
"cuda"
,
enabled
=
self
.
config
.
amp
):
with
torch
.
autocast
(
"cuda"
,
enabled
=
self
.
config
.
amp
):
with
self
.
model
.
ema_scope
():
with
self
.
model
.
ema_scope
():
...
...
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