Unverified Commit a9623854 authored by Caroline Chen's avatar Caroline Chen Committed by GitHub
Browse files

Rename transducer to RNNT (#1603)

parent 76314a4b
...@@ -67,5 +67,5 @@ build_master() { ...@@ -67,5 +67,5 @@ build_master() {
printf "* Installing torchaudio\n" printf "* Installing torchaudio\n"
cd "${_root_dir}" || exit 1 cd "${_root_dir}" || exit 1
git submodule update --init --recursive git submodule update --init --recursive
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py clean install BUILD_RNNT=1 BUILD_SOX=1 python setup.py clean install
} }
...@@ -42,7 +42,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}" ...@@ -42,7 +42,7 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
# 2. Install torchaudio # 2. Install torchaudio
printf "* Installing torchaudio\n" printf "* Installing torchaudio\n"
git submodule update --init --recursive git submodule update --init --recursive
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py install BUILD_RNNT=1 BUILD_SOX=1 python setup.py install
# 3. Install Test tools # 3. Install Test tools
printf "* Installing test tools\n" printf "* Installing test tools\n"
......
...@@ -56,7 +56,7 @@ endif() ...@@ -56,7 +56,7 @@ endif()
# Options # Options
option(BUILD_SOX "Build libsox statically" OFF) option(BUILD_SOX "Build libsox statically" OFF)
option(BUILD_KALDI "Build kaldi statically" ON) option(BUILD_KALDI "Build kaldi statically" ON)
option(BUILD_TRANSDUCER "Enable transducer" OFF) option(BUILD_RNNT "Enable RNN transducer" OFF)
option(BUILD_LIBTORCHAUDIO "Build C++ Library" ON) option(BUILD_LIBTORCHAUDIO "Build C++ Library" ON)
option(BUILD_TORCHAUDIO_PYTHON_EXTENSION "Build Python extension" OFF) option(BUILD_TORCHAUDIO_PYTHON_EXTENSION "Build Python extension" OFF)
option(USE_CUDA "Enable CUDA support" OFF) option(USE_CUDA "Enable CUDA support" OFF)
......
...@@ -36,7 +36,7 @@ def _get_build(var, default=False): ...@@ -36,7 +36,7 @@ def _get_build(var, default=False):
_BUILD_SOX = False if platform.system() == 'Windows' else _get_build("BUILD_SOX") _BUILD_SOX = False if platform.system() == 'Windows' else _get_build("BUILD_SOX")
_BUILD_KALDI = False if platform.system() == 'Windows' else _get_build("BUILD_KALDI", True) _BUILD_KALDI = False if platform.system() == 'Windows' else _get_build("BUILD_KALDI", True)
_BUILD_TRANSDUCER = _get_build("BUILD_TRANSDUCER") _BUILD_RNNT = _get_build("BUILD_RNNT")
_USE_ROCM = _get_build("USE_ROCM") _USE_ROCM = _get_build("USE_ROCM")
_USE_CUDA = _get_build("USE_CUDA", torch.cuda.is_available()) _USE_CUDA = _get_build("USE_CUDA", torch.cuda.is_available())
...@@ -73,7 +73,7 @@ class CMakeBuild(build_ext): ...@@ -73,7 +73,7 @@ class CMakeBuild(build_ext):
f"-DPython_INCLUDE_DIR={distutils.sysconfig.get_python_inc()}", f"-DPython_INCLUDE_DIR={distutils.sysconfig.get_python_inc()}",
f"-DBUILD_SOX:BOOL={'ON' if _BUILD_SOX else 'OFF'}", f"-DBUILD_SOX:BOOL={'ON' if _BUILD_SOX else 'OFF'}",
f"-DBUILD_KALDI:BOOL={'ON' if _BUILD_KALDI else 'OFF'}", f"-DBUILD_KALDI:BOOL={'ON' if _BUILD_KALDI else 'OFF'}",
f"-DBUILD_TRANSDUCER:BOOL={'ON' if _BUILD_TRANSDUCER else 'OFF'}", f"-DBUILD_RNNT:BOOL={'ON' if _BUILD_RNNT else 'OFF'}",
"-DBUILD_TORCHAUDIO_PYTHON_EXTENSION:BOOL=ON", "-DBUILD_TORCHAUDIO_PYTHON_EXTENSION:BOOL=ON",
"-DBUILD_LIBTORCHAUDIO:BOOL=OFF", "-DBUILD_LIBTORCHAUDIO:BOOL=OFF",
f"-DUSE_ROCM:BOOL={'ON' if _USE_ROCM else 'OFF'}", f"-DUSE_ROCM:BOOL={'ON' if _USE_ROCM else 'OFF'}",
......
...@@ -6,7 +6,7 @@ SET(BUILD_LIBTORCHAUDIO ON CACHE BOOL "Build libtorchaudio") ...@@ -6,7 +6,7 @@ SET(BUILD_LIBTORCHAUDIO ON CACHE BOOL "Build libtorchaudio")
SET(BUILD_SOX ON CACHE BOOL "Build libsox into libtorchaudio") SET(BUILD_SOX ON CACHE BOOL "Build libsox into libtorchaudio")
SET(BUILD_KALDI OFF CACHE BOOL "Build Kaldi into libtorchaudio") SET(BUILD_KALDI OFF CACHE BOOL "Build Kaldi into libtorchaudio")
SET(BUILD_TRANSDUCER OFF CACHE BOOL "Build transducer into libtorchaudio") SET(BUILD_RNNT OFF CACHE BOOL "Build RNN transducer into libtorchaudio")
SET(BUILD_TORCHAUDIO_PYTHON_EXTENSION OFF CACHE BOOL "Build Python binding") SET(BUILD_TORCHAUDIO_PYTHON_EXTENSION OFF CACHE BOOL "Build Python binding")
find_package(Torch REQUIRED) find_package(Torch REQUIRED)
......
...@@ -15,5 +15,5 @@ if [[ "$OSTYPE" == "msys" ]]; then ...@@ -15,5 +15,5 @@ if [[ "$OSTYPE" == "msys" ]]; then
python_tag="$(echo "cp$PYTHON_VERSION" | tr -d '.')" python_tag="$(echo "cp$PYTHON_VERSION" | tr -d '.')"
"$script_dir/vc_env_helper.bat" python setup.py bdist_wheel --plat-name win_amd64 --python-tag $python_tag "$script_dir/vc_env_helper.bat" python setup.py bdist_wheel --plat-name win_amd64 --python-tag $python_tag
else else
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py bdist_wheel BUILD_RNNT=1 BUILD_SOX=1 python setup.py bdist_wheel
fi fi
#!/usr/bin/env bash #!/usr/bin/env bash
set -ex set -ex
BUILD_TRANSDUCER=1 BUILD_SOX=1 python setup.py install --single-version-externally-managed --record=record.txt BUILD_RNNT=1 BUILD_SOX=1 python setup.py install --single-version-externally-managed --record=record.txt
import torch import torch
from .autograd_impl import Autograd from .autograd_impl import Autograd
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
@skipIfNoTransducer @skipIfNoRNNT
class TestAutograd(Autograd, common_utils.PytorchTestCase): class TestAutograd(Autograd, common_utils.PytorchTestCase):
dtype = torch.float32 dtype = torch.float32
device = torch.device('cpu') device = torch.device('cpu')
import torch import torch
from .autograd_impl import Autograd from .autograd_impl import Autograd
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
@skipIfNoTransducer @skipIfNoRNNT
@common_utils.skipIfNoCuda @common_utils.skipIfNoCuda
class TestAutograd(Autograd, common_utils.PytorchTestCase): class TestAutograd(Autograd, common_utils.PytorchTestCase):
dtype = torch.float32 dtype = torch.float32
......
import torch import torch
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
from .rnnt_loss_impl import RNNTLossTest from .rnnt_loss_impl import RNNTLossTest
@skipIfNoTransducer @skipIfNoRNNT
class TestRNNTLoss(RNNTLossTest, common_utils.PytorchTestCase): class TestRNNTLoss(RNNTLossTest, common_utils.PytorchTestCase):
device = torch.device('cpu') device = torch.device('cpu')
import torch import torch
from .rnnt_loss_impl import RNNTLossTest from .rnnt_loss_impl import RNNTLossTest
from torchaudio_unittest import common_utils from torchaudio_unittest import common_utils
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
@skipIfNoTransducer @skipIfNoRNNT
@common_utils.skipIfNoCuda @common_utils.skipIfNoCuda
class TestRNNTLoss(RNNTLossTest, common_utils.PytorchTestCase): class TestRNNTLoss(RNNTLossTest, common_utils.PytorchTestCase):
device = torch.device('cuda') device = torch.device('cuda')
import torch import torch
from torchaudio_unittest.common_utils import PytorchTestCase from torchaudio_unittest.common_utils import PytorchTestCase
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
from .torchscript_consistency_impl import RNNTLossTorchscript from .torchscript_consistency_impl import RNNTLossTorchscript
@skipIfNoTransducer @skipIfNoRNNT
class TestRNNTLoss(RNNTLossTorchscript, PytorchTestCase): class TestRNNTLoss(RNNTLossTorchscript, PytorchTestCase):
device = torch.device('cpu') device = torch.device('cpu')
import torch import torch
from torchaudio_unittest.common_utils import PytorchTestCase, skipIfNoCuda from torchaudio_unittest.common_utils import PytorchTestCase, skipIfNoCuda
from .utils import skipIfNoTransducer from .utils import skipIfNoRNNT
from .torchscript_consistency_impl import RNNTLossTorchscript from .torchscript_consistency_impl import RNNTLossTorchscript
@skipIfNoTransducer @skipIfNoRNNT
@skipIfNoCuda @skipIfNoCuda
class TestRNNTLoss(RNNTLossTorchscript, PytorchTestCase): class TestRNNTLoss(RNNTLossTorchscript, PytorchTestCase):
device = torch.device('cuda') device = torch.device('cuda')
...@@ -443,7 +443,7 @@ def numpy_to_torch(data, device, requires_grad=True): ...@@ -443,7 +443,7 @@ def numpy_to_torch(data, device, requires_grad=True):
return data return data
def skipIfNoTransducer(test_item): def skipIfNoRNNT(test_item):
try: try:
torch.ops.torchaudio.rnnt_loss torch.ops.torchaudio.rnnt_loss
return test_item return test_item
......
...@@ -10,9 +10,9 @@ set( ...@@ -10,9 +10,9 @@ set(
utils.cpp utils.cpp
) )
if(BUILD_TRANSDUCER) if(BUILD_RNNT)
set( set(
TRANSDUCER_SOURCES RNNT_SOURCES
rnnt/cpu/compute_alphas.cpp rnnt/cpu/compute_alphas.cpp
rnnt/cpu/compute_betas.cpp rnnt/cpu/compute_betas.cpp
rnnt/cpu/compute.cpp rnnt/cpu/compute.cpp
...@@ -24,15 +24,15 @@ if(BUILD_TRANSDUCER) ...@@ -24,15 +24,15 @@ if(BUILD_TRANSDUCER)
if (USE_CUDA) if (USE_CUDA)
set( set(
CUDA_TRANSDUCER_SOURCES CUDA_RNNT_SOURCES
rnnt/gpu/compute_alphas.cu rnnt/gpu/compute_alphas.cu
rnnt/gpu/compute_betas.cu rnnt/gpu/compute_betas.cu
rnnt/gpu/compute.cu rnnt/gpu/compute.cu
) )
list(APPEND TRANSDUCER_SOURCES ${CUDA_TRANSDUCER_SOURCES}) list(APPEND RNNT_SOURCES ${CUDA_RNNT_SOURCES})
endif() endif()
list(APPEND LIBTORCHAUDIO_SOURCES ${TRANSDUCER_SOURCES}) list(APPEND LIBTORCHAUDIO_SOURCES ${RNNT_SOURCES})
endif() endif()
if(BUILD_KALDI) if(BUILD_KALDI)
......
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