From 46ed2b98bc4227f12237f14833380f48c015cf8c Mon Sep 17 00:00:00 2001 From: Caroline Chen Date: Sat, 26 Mar 2022 13:52:39 -0700 Subject: [PATCH] Update decoder pretrained lm docs (#2291) Summary: `build_docs` test is failing on CI with `ImportError: cannot import name 'environmentfilter' from 'jinja2'`, but with local build: Screen Shot 2022-03-25 at 4 02 53 PM Pull Request resolved: https://github.com/pytorch/audio/pull/2291 Reviewed By: mthrok Differential Revision: D35147098 Pulled By: carolineechen fbshipit-source-id: 682b3800d0ed5c56b402d83f221136725051ba7e --- docs/source/prototype.ctc_decoder.rst | 10 +++++++++- torchaudio/prototype/ctc_decoder/ctc_decoder.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docs/source/prototype.ctc_decoder.rst b/docs/source/prototype.ctc_decoder.rst index 24f185fa40..d0b87ae48d 100644 --- a/docs/source/prototype.ctc_decoder.rst +++ b/docs/source/prototype.ctc_decoder.rst @@ -25,10 +25,18 @@ Factory Function ---------------- lexicon_decoder -~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~ .. autoclass:: lexicon_decoder +Utility Function +---------------- + +download_pretrained_files +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autoclass:: download_pretrained_files + References ---------- diff --git a/torchaudio/prototype/ctc_decoder/ctc_decoder.py b/torchaudio/prototype/ctc_decoder/ctc_decoder.py index 36098e46ad..79be44a916 100644 --- a/torchaudio/prototype/ctc_decoder/ctc_decoder.py +++ b/torchaudio/prototype/ctc_decoder/ctc_decoder.py @@ -277,15 +277,17 @@ def download_pretrained_files(model: str) -> _PretrainedFiles: Retrieves pretrained data files used for CTC decoder. Args: - model (str): pretrained language model to download + model (str): pretrained language model to download. Options: ["librispeech-3-gram", "librispeech-4-gram", "librispeech"] Returns: - Object with the following attributes: - lm: path corresponding to downloaded language model, or None if model is not - associated with an lm - lexicon: path corresponding to downloaded lexicon file - tokens: path corresponding to downloaded tokens file + Object with the following attributes + lm: + path corresponding to downloaded language model, or `None` if the model is not associated with an lm + lexicon: + path corresponding to downloaded lexicon file + tokens: + path corresponding to downloaded tokens file """ files = _get_filenames(model)