Commit 08395ba6 authored by Vamsi Desu's avatar Vamsi Desu Committed by Facebook GitHub Bot
Browse files

Remove deprecated prototype alias (#2583)

Summary:
CTC decoder and StreamReader are now in the main library.
This commit removes their aliases in `torchaudio.prototypes`

Pull Request resolved: https://github.com/pytorch/audio/pull/2583

Reviewed By: mthrok

Differential Revision: D38189314

fbshipit-source-id: c62209f2ad4f7052c6756a537b6fc509064e428c
parent 0092aa3c
def __getattr__(name: str):
if name in ["ctc_decoder", "lexicon_decoder"]:
import warnings
from torchaudio.models.decoder import ctc_decoder
warnings.warn(
f"{__name__}.{name} has been moved to torchaudio.models.decoder.ctc_decoder",
DeprecationWarning,
)
if name == "lexicon_decoder":
global lexicon_decoder
lexicon_decoder = ctc_decoder
return lexicon_decoder
else:
return ctc_decoder
elif name == "download_pretrained_files":
import warnings
from torchaudio.models.decoder import download_pretrained_files
return download_pretrained_files
raise AttributeError(f"module {__name__} has no attribute {name}")
def __dir__():
return ["ctc_decoder", "lexicon_decoder", "download_pretrained_files"]
def __getattr__(name: str):
if name == "Streamer":
import warnings
from torchaudio.io import StreamReader
warnings.warn(
f"{__name__}.{name} has been moved to torchaudio.io.StreamReader. Please use torchaudio.io.StreamReader",
DeprecationWarning,
)
global Streamer
Streamer = StreamReader
return Streamer
raise AttributeError(f"module {__name__} has no attribute {name}")
def __dir__():
return ["Streamer"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment