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
03636760
Commit
03636760
authored
Aug 14, 2022
by
gd1551
Committed by
GitHub
Aug 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: divide resolution by two and fix if advanced sd
parent
e2744fb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
hydra_node/sanitize.py
hydra_node/sanitize.py
+10
-0
No files found.
hydra_node/sanitize.py
View file @
03636760
...
@@ -34,6 +34,12 @@ defaults = {
...
@@ -34,6 +34,12 @@ defaults = {
'dalle-mini'
:
(
dalle_mini_defaults
,
dalle_mini_forced_defaults
),
'dalle-mini'
:
(
dalle_mini_defaults
,
dalle_mini_forced_defaults
),
}
}
def
closest_multiple
(
num
,
mult
):
num_int
=
int
(
num
)
floor
=
math
.
floor
(
num_int
/
mult
)
*
mult
ceil
=
math
.
ceil
(
num_int
/
mult
)
*
mult
return
floor
if
(
num_int
-
floor
)
<
(
ceil
-
num_int
)
else
ceil
def
sanitize_stable_diffusion
(
request
):
def
sanitize_stable_diffusion
(
request
):
if
request
.
width
*
request
.
height
==
0
:
if
request
.
width
*
request
.
height
==
0
:
return
False
,
"width and height must be non-zero"
return
False
,
"width and height must be non-zero"
...
@@ -65,6 +71,10 @@ def sanitize_stable_diffusion(request):
...
@@ -65,6 +71,10 @@ def sanitize_stable_diffusion(request):
if
request
.
noise
<
0.0
or
request
.
noise
>
1.0
:
if
request
.
noise
<
0.0
or
request
.
noise
>
1.0
:
return
False
,
"noise should be more than 0.0 and less than 1.0"
return
False
,
"noise should be more than 0.0 and less than 1.0"
if
request
.
advanced
:
request
.
width
=
closest_multiple
(
request
.
width
//
2
,
64
)
request
.
height
=
closest_multiple
(
request
.
height
//
2
,
64
)
return
True
,
request
return
True
,
request
def
sanitize_dalle_mini
(
request
):
def
sanitize_dalle_mini
(
request
):
...
...
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