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
chenpangpang
parler-tts
Commits
daca5721
Commit
daca5721
authored
Mar 08, 2024
by
yoach@huggingface.co
Browse files
improve modeling code and logging
parent
b7f5febc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
run_stable_speech_training.py
run_stable_speech_training.py
+19
-3
setup.py
setup.py
+5
-0
stable_speech/modeling_stable_speech.py
stable_speech/modeling_stable_speech.py
+2
-2
No files found.
run_stable_speech_training.py
View file @
daca5721
...
...
@@ -258,7 +258,7 @@ class ModelArguments:
metadata
=
{
"help"
:
"Whether to do sampling or greedy decoding."
},
)
max_length
:
int
=
field
(
default
=
4
00
,
# TODO
default
=
15
00
,
# TODO
metadata
=
{
"help"
:
"Whether to do sampling or greedy decoding."
},
)
bandwidth
:
float
=
field
(
...
...
@@ -741,7 +741,22 @@ def main():
project_dir
=
training_args
.
output_dir
,
)
accelerator
.
init_trackers
(
project_name
=
data_args
.
wandb_project
)
accelerator
.
init_trackers
(
project_name
=
data_args
.
wandb_project
,
config
=
{
"learning_rate"
:
training_args
.
learning_rate
,
"model_name_or_path"
:
model_args
.
model_name_or_path
,
"num_train_epochs"
:
training_args
.
num_train_epochs
,
"gradient_accumulation_steps"
:
training_args
.
gradient_accumulation_steps
,
"per_device_train_batch_size"
:
training_args
.
per_device_train_batch_size
,
"global_batch_size"
:
training_args
.
per_device_train_batch_size
*
accelerator
.
num_processes
,
"mixed_precision"
:
mixed_precision
,
"lr_scheduler_type"
:
training_args
.
lr_scheduler_type
,
"warmup_steps"
:
training_args
.
warmup_steps
,
"freeze_text_encoder"
:
model_args
.
freeze_text_encoder
,
"max_duration_in_seconds"
:
data_args
.
max_duration_in_seconds
,
"weight_decay"
:
training_args
.
weight_decay
,
"adam_beta1"
:
training_args
.
adam_beta1
,
"adam_beta2"
:
training_args
.
adam_beta2
,
})
# Detecting last checkpoint and eventually continue from last checkpoint
...
...
@@ -1073,7 +1088,7 @@ def main():
input_columns
=
[
"input_ids"
,
"prompt_input_ids"
],
desc
=
"Postprocessing labeling"
,
with_indices
=
True
,
writer_batch_size
=
2
00
,
writer_batch_size
=
1
00
,
)
...
...
@@ -1181,6 +1196,7 @@ def main():
lr
=
training_args
.
learning_rate
,
betas
=
(
training_args
.
adam_beta1
,
training_args
.
adam_beta2
),
eps
=
training_args
.
adam_epsilon
,
weight_decay
=
training_args
.
weight_decay
,
)
# LR scheduler gets stepped by `num_processes` each time -> account for this in warmup / total steps
...
...
setup.py
View file @
daca5721
...
...
@@ -22,6 +22,11 @@ _deps = [
"transformers>=4.34.0"
,
"datasets[audio]>=2.14.5"
,
"torch"
,
"accelerate"
,
"evaluate"
,
"sentencepiece"
,
"descript-audio-codec"
,
"jiwer"
,
]
_extras_dev_deps
=
[
...
...
stable_speech/modeling_stable_speech.py
View file @
daca5721
...
...
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
import
torch
import
torch.nn
as
nn
from
torch.nn
import
CrossEntropyLoss
from
transformers
import
AutoConfig
,
AutoModel
from
transformers
import
AutoConfig
,
AutoModel
,
AutoModelForTextEncoding
from
transformers.activations
import
ACT2FN
from
transformers.generation.configuration_utils
import
GenerationConfig
from
transformers.generation.logits_process
import
ClassifierFreeGuidanceLogitsProcessor
,
LogitsProcessorList
...
...
@@ -1792,7 +1792,7 @@ class StableSpeechForConditionalGeneration(PreTrainedModel):
kwargs_text_encoder
[
"config"
]
=
encoder_config
text_encoder
=
AutoModel
.
from_pretrained
(
text_encoder
=
AutoModel
ForTextEncoding
.
from_pretrained
(
text_encoder_pretrained_model_name_or_path
,
*
model_args
,
**
kwargs_text_encoder
)
...
...
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