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
5a3467e6
Commit
5a3467e6
authored
Jun 16, 2022
by
patil-suraj
Browse files
add default params for GradTTS
parent
e2678275
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
src/diffusers/pipelines/pipeline_grad_tts.py
src/diffusers/pipelines/pipeline_grad_tts.py
+1
-2
No files found.
src/diffusers/pipelines/pipeline_grad_tts.py
View file @
5a3467e6
...
@@ -396,7 +396,7 @@ class GradTTS(DiffusionPipeline):
...
@@ -396,7 +396,7 @@ class GradTTS(DiffusionPipeline):
self
.
register_modules
(
unet
=
unet
,
text_encoder
=
text_encoder
,
noise_scheduler
=
noise_scheduler
,
tokenizer
=
tokenizer
)
self
.
register_modules
(
unet
=
unet
,
text_encoder
=
text_encoder
,
noise_scheduler
=
noise_scheduler
,
tokenizer
=
tokenizer
)
@
torch
.
no_grad
()
@
torch
.
no_grad
()
def
__call__
(
self
,
text
,
num_inference_steps
,
generator
,
temperature
,
length_scale
,
speaker_id
=
None
,
torch_device
=
None
):
def
__call__
(
self
,
text
,
num_inference_steps
=
50
,
temperature
=
1.3
,
length_scale
=
0.91
,
speaker_id
=
15
,
torch_device
=
None
):
if
torch_device
is
None
:
if
torch_device
is
None
:
torch_device
=
torch
.
device
(
"cuda:0"
if
torch
.
cuda
.
is_available
()
else
"cpu"
)
torch_device
=
torch
.
device
(
"cuda:0"
if
torch
.
cuda
.
is_available
()
else
"cpu"
)
...
@@ -427,7 +427,6 @@ class GradTTS(DiffusionPipeline):
...
@@ -427,7 +427,6 @@ class GradTTS(DiffusionPipeline):
# Align encoded text and get mu_y
# Align encoded text and get mu_y
mu_y
=
torch
.
matmul
(
attn
.
squeeze
(
1
).
transpose
(
1
,
2
),
mu_x
.
transpose
(
1
,
2
))
mu_y
=
torch
.
matmul
(
attn
.
squeeze
(
1
).
transpose
(
1
,
2
),
mu_x
.
transpose
(
1
,
2
))
mu_y
=
mu_y
.
transpose
(
1
,
2
)
mu_y
=
mu_y
.
transpose
(
1
,
2
)
encoder_outputs
=
mu_y
[:,
:,
:
y_max_length
]
# Sample latent representation from terminal distribution N(mu_y, I)
# Sample latent representation from terminal distribution N(mu_y, I)
z
=
mu_y
+
torch
.
randn_like
(
mu_y
,
device
=
mu_y
.
device
)
/
temperature
z
=
mu_y
+
torch
.
randn_like
(
mu_y
,
device
=
mu_y
.
device
)
/
temperature
...
...
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