Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stable-diffusion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Qin, Jiuming
stable-diffusion
Commits
239ed0fd
Commit
239ed0fd
authored
2 years ago
by
Patrick von Platen
Browse files
Options
Downloads
Patches
Plain Diff
fix more
parent
f3f60fcc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/txt2img.py
+1
-6
1 addition, 6 deletions
scripts/txt2img.py
with
1 addition
and
6 deletions
scripts/txt2img.py
+
1
−
6
View file @
239ed0fd
...
@@ -266,7 +266,7 @@ def main():
...
@@ -266,7 +266,7 @@ def main():
x_samples_ddim
=
model
.
decode_first_stage
(
samples_ddim
)
x_samples_ddim
=
model
.
decode_first_stage
(
samples_ddim
)
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
)
x_samples_ddim
=
x_samples_ddim
.
cpu
().
permute
(
0
,
2
,
3
,
1
)
.
numpy
()
x_samples_ddim
=
x_samples_ddim
.
cpu
().
permute
(
0
,
2
,
3
,
1
)
x_image
=
x_samples_ddim
x_image
=
x_samples_ddim
safety_checker_input
=
safety_feature_extractor
(
numpy_to_pil
(
x_image
),
return_tensors
=
"
pt
"
)
safety_checker_input
=
safety_feature_extractor
(
numpy_to_pil
(
x_image
),
return_tensors
=
"
pt
"
)
...
@@ -295,11 +295,6 @@ def main():
...
@@ -295,11 +295,6 @@ def main():
Image
.
fromarray
(
grid
.
astype
(
np
.
uint8
)).
save
(
os
.
path
.
join
(
outpath
,
f
'
grid-
{
grid_count
:
04
}
.png
'
))
Image
.
fromarray
(
grid
.
astype
(
np
.
uint8
)).
save
(
os
.
path
.
join
(
outpath
,
f
'
grid-
{
grid_count
:
04
}
.png
'
))
grid_count
+=
1
grid_count
+=
1
image
=
x_samples_ddim
.
cpu
().
permute
(
0
,
2
,
3
,
1
).
numpy
()
# run safety checker
safety_checker_input
=
pipe
.
feature_extractor
(
numpy_to_pil
(
image
),
return_tensors
=
"
pt
"
)
image
,
has_nsfw_concept
=
pipe
.
safety_checker
(
images
=
image
,
clip_input
=
safety_checker_input
.
pixel_values
)
toc
=
time
.
time
()
toc
=
time
.
time
()
print
(
f
"
Your samples are ready and waiting for you here:
\n
{
outpath
}
\n
"
print
(
f
"
Your samples are ready and waiting for you here:
\n
{
outpath
}
\n
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment