Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTS Collection #874

Merged
merged 92 commits into from
Jul 30, 2020
Merged

TTS Collection #874

merged 92 commits into from
Jul 30, 2020

Conversation

blisc
Copy link
Collaborator

@blisc blisc commented Jul 20, 2020

Adds TTS to candidate

Changes outside TTS collection

ASR collection

  • rename _AudioDataset to _AudioTextDataset
  • _AudioTextDataset's signature changed, it no longer accepts featurizer but accepts sample_rate, int_values, and augmentor so that it can instantiate WaveformFeaturizer itself.
  • AudioPreprocessor no longer has a get_seq_len function. get_features is now expected to return processed_signal and processed_length

Core collection

  • Adds LogEpochTimeCallback to nemo.collections.core.callbacks

Core

  • from_config_dict now accepts *args and **kwargs passthroughs to hydra.utils.instantiate
  • Tweaked error messages inside type checking so it is more informative

TODO

  • Add dataclasses to most modules
  • Merge ASR and TTS data pipeline
  • Add unit tests
  • Class and function docstrings
  • Be NeMo 1.0 Class compliant: Broken into more tasks
  • Change loss to inherit from NeMo Loss
  • Add typing to models
  • Figure out typing and validation for WaveGlow
  • Drop experimental decorators
  • Use hydra_runner
  • Maybe move LogEpochTimeCallback to common
  • Merge Flatten pl.trainer to trainer #895

blisc added 30 commits July 1, 2020 12:06
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
blisc added 3 commits July 28, 2020 13:33
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
Signed-off-by: Jason <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Jul 28, 2020

This pull request introduces 1 alert when merging e173943 into b883b31 - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Jason <[email protected]>
@lgtm-com
Copy link

lgtm-com bot commented Jul 28, 2020

This pull request introduces 1 alert when merging 3f48fac into 054cc02 - view on LGTM.com

new alerts:

  • 1 for Unused import

Copy link
Member

@okuchaiev okuchaiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good, but there are few small issues here and there - please see comments.

return mel_loss + gate_loss


@experimental # TODO: Need to implement abstract methods: list_available_models, from_pretrained, export but how?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll only need to implement "list_available_model()" once you have cloud locations

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I get TypeError: Can't instantiate abstract class Tacotron2Model with abstract methods export

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And hydra.errors.HydraException: Error calling 'nemo.collections.tts.modules.tacotron2.Encoder' : Can't instantiate abstract class Encoder with abstract methods restore_from, save_to

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Can't instantiate abstract class Tacotron2Model with abstract method" this should not happen if you merge/rebase latest candidate into your branch

validation_ds: Optional[Dict] = None


class Tacotron2Loss(Loss):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this class should go to nemo/collections/tts/losses/* or to nemo/collections/common/losses/* and also get some docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move it? This loss is only ever going to be used in this model. It is so redundant that I have to define it as it's own separate class rather than a function of Tacotron2Model.

Copy link
Collaborator Author

@blisc blisc Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new function-level override of typecheck(), it doesn't even need to inherit from Typing to use NeMo's typing. Tacotron2Loss doesn't have an init nor does it use self, it's a function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency. We put all losses other losses under collections/collection_name/losses/* . why make exception here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.
I maintain that collections/collection_name/losses/* shouldn't exist apart from losses inside common. NLP's losses is empty and ASR only has CTC that is only used in CTC models so it should be moved there and losses folder should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me qualify my above statement. If a loss is only ever going to be used in a single model, it should not be in the losses folder. And if the losses folder is empty, it should be deleted.

Copy link
Collaborator

@titu1994 titu1994 Jul 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, It is incorrect that the class does not need to implement Typing. All of the actual tests lie inside the Typing class, and the decorator simply dispatches these checks. This is by design to support graph level checks. The decor will raise Runtime error if placed on a class that doesn't implement Typing.


@experimental # TODO: Need to implement abstract methods: list_available_models, from_pretrained, export but how?
class Tacotron2Model(ModelPT):
# TODO: tensorboard for training
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the problem with TB for training?

nemo/collections/tts/models/tacotron2.py Outdated Show resolved Hide resolved
nemo/collections/tts/models/tacotron2.py Outdated Show resolved Hide resolved
nemo/collections/tts/modules/tacotron2.py Outdated Show resolved Hide resolved
nemo/collections/tts/modules/tacotron2.py Outdated Show resolved Hide resolved
nemo/collections/tts/modules/tacotron2.py Outdated Show resolved Hide resolved
nemo/collections/tts/modules/tacotron2.py Show resolved Hide resolved
nemo/collections/tts/modules/tacotron2.py Show resolved Hide resolved
elif not isinstance(cfg, DictConfig):
raise ValueError(f"cfg was type: {type(cfg)}. Expected either a dict or a DictConfig")
# Ensure passed cfg is compliant with schema
OmegaConf.merge(cfg, schema)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@titu1994 @ericharper @tkornuta-nvidia - let's chat (outside of this PR) if we'd like to adapt something like this in general for Models

@@ -77,7 +77,7 @@ def __init__(self, cfg: DictConfig, trainer: Trainer = None):
self._scheduler = None
self._trainer = trainer

if self._cfg is not None:
if self._cfg is not None: # TODO: This check is redundant since we know cfg is an instance of DictConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true - feel free to remove

Copy link
Collaborator

@titu1994 titu1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments regarding possible refactor, but overall not necessary to merge. LGTM

raise ValueError(f"No dataset for {name}") # TODO
if "dataloader_params" not in cfg or not isinstance(cfg["dataloader_params"], (dict, DictConfig)):
raise ValueError(f"No dataloder_params for {name}") # TODO
if shuffle_should_be:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "should_shuffle_train_val"

from nemo.utils.decorators import experimental


class OperationMode(Enum):
Copy link
Collaborator

@titu1994 titu1994 Jul 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mode should be unnecessary after the function override of typecheck if you would like to refactor, but this is fine too.

@blisc blisc merged commit 50cbeec into NVIDIA:candidate Jul 30, 2020
@blisc blisc deleted the candidate_tts_v2 branch July 30, 2020 17:47
redoctopus pushed a commit that referenced this pull request Jul 31, 2020
* add structure

Signed-off-by: Jason <[email protected]>

* add files

Signed-off-by: Jason <[email protected]>

* add init

Signed-off-by: Jason <[email protected]>

* fix init

Signed-off-by: Jason <[email protected]>

* update taco

Signed-off-by: Jason <[email protected]>

* format

Signed-off-by: Jason <[email protected]>

* typo

Signed-off-by: Jason <[email protected]>

* val change

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* add header

Signed-off-by: Jason <[email protected]>

* add waveglow

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* add O1

Signed-off-by: Jason <[email protected]>

* add todo

Signed-off-by: Jason <[email protected]>

* change batch sizes

Signed-off-by: Jason <[email protected]>

* move

Signed-off-by: Jason <[email protected]>

* move

Signed-off-by: Jason <[email protected]>

* V1

Signed-off-by: Jason <[email protected]>

* V1

Signed-off-by: Jason <[email protected]>

* structure

Signed-off-by: Jason <[email protected]>

* clean up

Signed-off-by: Jason <[email protected]>

* fix tacotron2

Signed-off-by: Jason <[email protected]>

* add files

Signed-off-by: Jason <[email protected]>

* update yamls

Signed-off-by: Jason <[email protected]>

* fix waveglow 1/2

Signed-off-by: Jason <[email protected]>

* fix waveglow 2/3

Signed-off-by: Jason <[email protected]>

* fix waveglow 3/?

Signed-off-by: Jason <[email protected]>

* merge asr and tts

Signed-off-by: Jason <[email protected]>

* update waveglow

Signed-off-by: Jason <[email protected]>

* isort

Signed-off-by: Jason <[email protected]>

* update configs

Signed-off-by: Jason <[email protected]>

* update waveglow's dataloader

Signed-off-by: Jason <[email protected]>

* update and refactor

Signed-off-by: Jason <[email protected]>

* update t2 and waveglow

Signed-off-by: Jason <[email protected]>

* enforce dictconfig; style

Signed-off-by: Jason <[email protected]>

* add fastdevruns

Signed-off-by: Jason <[email protected]>

* name

Signed-off-by: Jason <[email protected]>

* import

Signed-off-by: Jason <[email protected]>

* update tests

Signed-off-by: Jason <[email protected]>

* yaml

Signed-off-by: Jason <[email protected]>

* use hydra rnner

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* move callback to common

Signed-off-by: Jason <[email protected]>

* fixed tacotron 2; add typing to all neuralmodules

Signed-off-by: Jason <[email protected]>

* flatten

Signed-off-by: Jason <[email protected]>

* Style

Signed-off-by: Jason <[email protected]>

* patch jenkins

Signed-off-by: Jason <[email protected]>

* change typeheck logic

Signed-off-by: Jason <[email protected]>

* fix t2

Signed-off-by: Jason <[email protected]>

* fix wg

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* update configs

Signed-off-by: Jason <[email protected]>

* add num_workers

Signed-off-by: Jason <[email protected]>

* update config

Signed-off-by: Jason <[email protected]>

* update gitignore

Signed-off-by: Jason <[email protected]>

* config

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* fix t2

Signed-off-by: Jason <[email protected]>

* fixes

Signed-off-by: Jason <[email protected]>

* add typing to models; use nemo loss class

Signed-off-by: Jason <[email protected]>

* make wg work

Signed-off-by: Jason <[email protected]>

* make t2 work

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* fix wg

Signed-off-by: Jason <[email protected]>

* add better debug info to shape check

Signed-off-by: Jason <[email protected]>

* lgtm import error

Signed-off-by: Jason <[email protected]>

* lower batch size for testing

Signed-off-by: Jason <[email protected]>

* address comments

Signed-off-by: Jason <[email protected]>

* address comments and remove experimental

Signed-off-by: Jason <[email protected]>

* standardize

Signed-off-by: Jason <[email protected]>

* mark back as experimental

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* experimental

Signed-off-by: Jason <[email protected]>
Signed-off-by: Jocelyn Huang <[email protected]>
sam1373 pushed a commit that referenced this pull request Aug 3, 2020
* add structure

Signed-off-by: Jason <[email protected]>

* add files

Signed-off-by: Jason <[email protected]>

* add init

Signed-off-by: Jason <[email protected]>

* fix init

Signed-off-by: Jason <[email protected]>

* update taco

Signed-off-by: Jason <[email protected]>

* format

Signed-off-by: Jason <[email protected]>

* typo

Signed-off-by: Jason <[email protected]>

* val change

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* update

Signed-off-by: Jason <[email protected]>

* add header

Signed-off-by: Jason <[email protected]>

* add waveglow

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* waveglow fix

Signed-off-by: Jason <[email protected]>

* add O1

Signed-off-by: Jason <[email protected]>

* add todo

Signed-off-by: Jason <[email protected]>

* change batch sizes

Signed-off-by: Jason <[email protected]>

* move

Signed-off-by: Jason <[email protected]>

* move

Signed-off-by: Jason <[email protected]>

* V1

Signed-off-by: Jason <[email protected]>

* V1

Signed-off-by: Jason <[email protected]>

* structure

Signed-off-by: Jason <[email protected]>

* clean up

Signed-off-by: Jason <[email protected]>

* fix tacotron2

Signed-off-by: Jason <[email protected]>

* add files

Signed-off-by: Jason <[email protected]>

* update yamls

Signed-off-by: Jason <[email protected]>

* fix waveglow 1/2

Signed-off-by: Jason <[email protected]>

* fix waveglow 2/3

Signed-off-by: Jason <[email protected]>

* fix waveglow 3/?

Signed-off-by: Jason <[email protected]>

* merge asr and tts

Signed-off-by: Jason <[email protected]>

* update waveglow

Signed-off-by: Jason <[email protected]>

* isort

Signed-off-by: Jason <[email protected]>

* update configs

Signed-off-by: Jason <[email protected]>

* update waveglow's dataloader

Signed-off-by: Jason <[email protected]>

* update and refactor

Signed-off-by: Jason <[email protected]>

* update t2 and waveglow

Signed-off-by: Jason <[email protected]>

* enforce dictconfig; style

Signed-off-by: Jason <[email protected]>

* add fastdevruns

Signed-off-by: Jason <[email protected]>

* name

Signed-off-by: Jason <[email protected]>

* import

Signed-off-by: Jason <[email protected]>

* update tests

Signed-off-by: Jason <[email protected]>

* yaml

Signed-off-by: Jason <[email protected]>

* use hydra rnner

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* move callback to common

Signed-off-by: Jason <[email protected]>

* fixed tacotron 2; add typing to all neuralmodules

Signed-off-by: Jason <[email protected]>

* flatten

Signed-off-by: Jason <[email protected]>

* Style

Signed-off-by: Jason <[email protected]>

* patch jenkins

Signed-off-by: Jason <[email protected]>

* change typeheck logic

Signed-off-by: Jason <[email protected]>

* fix t2

Signed-off-by: Jason <[email protected]>

* fix wg

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* update configs

Signed-off-by: Jason <[email protected]>

* add num_workers

Signed-off-by: Jason <[email protected]>

* update config

Signed-off-by: Jason <[email protected]>

* update gitignore

Signed-off-by: Jason <[email protected]>

* config

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* enable fp16 on t2

Signed-off-by: Jason <[email protected]>

* fix t2

Signed-off-by: Jason <[email protected]>

* fixes

Signed-off-by: Jason <[email protected]>

* add typing to models; use nemo loss class

Signed-off-by: Jason <[email protected]>

* make wg work

Signed-off-by: Jason <[email protected]>

* make t2 work

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* fix wg

Signed-off-by: Jason <[email protected]>

* add better debug info to shape check

Signed-off-by: Jason <[email protected]>

* lgtm import error

Signed-off-by: Jason <[email protected]>

* lower batch size for testing

Signed-off-by: Jason <[email protected]>

* address comments

Signed-off-by: Jason <[email protected]>

* address comments and remove experimental

Signed-off-by: Jason <[email protected]>

* standardize

Signed-off-by: Jason <[email protected]>

* mark back as experimental

Signed-off-by: Jason <[email protected]>

* style

Signed-off-by: Jason <[email protected]>

* experimental

Signed-off-by: Jason <[email protected]>
Signed-off-by: Samuel Kriman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants