Skip to content

Use stable ABI for RNNT #3977

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/scripts/unittest-linux/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ fi

(
cd test
pytest torchaudio_unittest -k "not backend and not /io/ and not prototype and not sox and not ffmpeg and not fairseq and not hdemucs"
pytest torchaudio_unittest -k "not backend and not /io/ and not prototype and not sox and not ffmpeg and not fairseq and not hdemucs and not (torchscript and rnnt)"
)
1 change: 0 additions & 1 deletion src/libtorchaudio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ if(BUILD_RNNT)
rnnt/compute_alphas.cpp
rnnt/compute_betas.cpp
rnnt/compute.cpp
rnnt/autograd.cpp
)
if (USE_CUDA)
list(
Expand Down
69 changes: 0 additions & 69 deletions src/libtorchaudio/rnnt/autograd.cpp

This file was deleted.

27 changes: 4 additions & 23 deletions src/libtorchaudio/rnnt/compute.cpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
#include <libtorchaudio/rnnt/compute.h>
#include <torch/csrc/stable/library.h>
#include <torch/csrc/inductor/aoti_torch/c/shim.h>

std::tuple<torch::Tensor, std::optional<torch::Tensor>> rnnt_loss(
torch::Tensor& logits,
const torch::Tensor& targets,
const torch::Tensor& logit_lengths,
const torch::Tensor& target_lengths,
int64_t blank,
double clamp,
bool fused_log_softmax = true) {
static auto op = torch::Dispatcher::singleton()
.findSchemaOrThrow("torchaudio::rnnt_loss", "")
.typed<decltype(rnnt_loss)>();
return op.call(
logits,
targets,
logit_lengths,
target_lengths,
blank,
clamp,
fused_log_softmax);
}

TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
STABLE_TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
m.def(
"rnnt_loss(Tensor logits,"
"Tensor targets,"
"Tensor logit_lengths,"
"Tensor target_lengths,"
"int blank,"
"float clamp,"
"bool fused_log_softmax) -> (Tensor, Tensor?)");
"bool fused_log_softmax) -> (Tensor, Tensor)");
}
12 changes: 0 additions & 12 deletions src/libtorchaudio/rnnt/compute.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/libtorchaudio/rnnt/compute_alphas.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <torch/script.h>
#include <torch/csrc/stable/library.h>

TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
STABLE_TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
m.def(
"rnnt_loss_alphas(Tensor logits,"
"Tensor targets,"
Expand Down
4 changes: 2 additions & 2 deletions src/libtorchaudio/rnnt/compute_betas.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <torch/script.h>
#include <torch/csrc/stable/library.h>

TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
STABLE_TORCH_LIBRARY_FRAGMENT(torchaudio, m) {
m.def(
"rnnt_loss_betas(Tensor logits,"
"Tensor targets,"
Expand Down
Loading
Loading