Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions src/torchaudio/models/decoder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from torchaudio._internal.module_utils import dropping_support, dropping_class_support
import inspect
_CTC_DECODERS = [
"CTCHypothesis",
Expand Down Expand Up @@ -35,23 +34,7 @@ def __getattr__(name: str):
"To use CUCTC decoder, please set BUILD_CUDA_CTC_DECODER=1 when building from source."
) from err

# TODO: when all unsupported classes are removed, replace the
# following if-else block with
# item = getattr(_cuda_ctc_decoder, name)
orig_item = getattr(_cuda_ctc_decoder, name)
if (
inspect.isclass(orig_item)
or (
# workaround a failure to detect type instances
# after sphinx autodoc mocking, required for
# building docs
getattr(orig_item, "__sphinx_mock__", False) and inspect.isclass(orig_item.__class__)
)
):
item = dropping_class_support(orig_item)
else:
item = dropping_support(orig_item)

item = getattr(_cuda_ctc_decoder, name)
globals()[name] = item
return item
raise AttributeError(f"module {__name__} has no attribute {name}")
Expand Down
Loading