Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
5164c9fa
Unverified
Commit
5164c9fa
authored
Sep 01, 2022
by
Santiago Víquez
Committed by
GitHub
Sep 01, 2022
Browse files
[Type hint] Score SDE VE pipeline (#325)
parent
93debd30
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py
...diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py
+17
-2
No files found.
src/diffusers/pipelines/score_sde_ve/pipeline_score_sde_ve.py
View file @
5164c9fa
#!/usr/bin/env python3
#!/usr/bin/env python3
import
warnings
import
warnings
from
typing
import
Optional
import
torch
import
torch
from
diffusers
import
DiffusionPipeline
from
diffusers
import
DiffusionPipeline
from
...models
import
UNet2DModel
from
...schedulers
import
ScoreSdeVeScheduler
class
ScoreSdeVePipeline
(
DiffusionPipeline
):
class
ScoreSdeVePipeline
(
DiffusionPipeline
):
def
__init__
(
self
,
unet
,
scheduler
):
unet
:
UNet2DModel
scheduler
:
ScoreSdeVeScheduler
def
__init__
(
self
,
unet
:
UNet2DModel
,
scheduler
:
DiffusionPipeline
):
super
().
__init__
()
super
().
__init__
()
self
.
register_modules
(
unet
=
unet
,
scheduler
=
scheduler
)
self
.
register_modules
(
unet
=
unet
,
scheduler
=
scheduler
)
@
torch
.
no_grad
()
@
torch
.
no_grad
()
def
__call__
(
self
,
batch_size
=
1
,
num_inference_steps
=
2000
,
generator
=
None
,
output_type
=
"pil"
,
**
kwargs
):
def
__call__
(
self
,
batch_size
:
int
=
1
,
num_inference_steps
:
int
=
2000
,
generator
:
Optional
[
torch
.
Generator
]
=
None
,
output_type
:
Optional
[
str
]
=
"pil"
,
**
kwargs
,
):
if
"torch_device"
in
kwargs
:
if
"torch_device"
in
kwargs
:
device
=
kwargs
.
pop
(
"torch_device"
)
device
=
kwargs
.
pop
(
"torch_device"
)
warnings
.
warn
(
warnings
.
warn
(
...
...
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