Skip to content
Closed
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
1 change: 1 addition & 0 deletions .github/scripts/unittest-linux/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fi
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true
cd test
pytest torchaudio_unittest -k "not torchscript and not fairseq and not demucs ${PYTEST_K_EXTRA}"
)
8 changes: 4 additions & 4 deletions .github/workflows/build-wheels-m1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ permissions:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.10
with:
package-type: wheel
os: macos-arm64
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
build:
needs: generate-matrix
strategy:
Expand All @@ -39,12 +39,12 @@ jobs:
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main
uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@release/2.10
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
smoke-test-script: ${{ matrix.smoke-test-script }}
runner-type: macos-m1-stable
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_wheels_aarch64_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ permissions:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.10
with:
package-type: wheel
os: linux-aarch64
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
with-cuda: enable
build:
needs: generate-matrix
Expand All @@ -40,12 +40,12 @@ jobs:
smoke-test-script: test/smoke_test/smoke_test.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@release/2.10
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
pre-script: ${{ matrix.pre-script }}
post-script: ${{ matrix.post-script }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ permissions:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.10
with:
package-type: wheel
os: linux
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
with-xpu: enable
build:
needs: generate-matrix
Expand All @@ -40,12 +40,12 @@ jobs:
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@release/2.10
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
smoke-test-script: ${{ matrix.smoke-test-script }}
package-name: ${{ matrix.package-name }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_wheels_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ permissions:

jobs:
generate-matrix:
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@release/2.10
with:
package-type: wheel
os: windows
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
with-xpu: enable
build:
needs: generate-matrix
Expand All @@ -38,12 +38,12 @@ jobs:
smoke-test-script: test/smoke_test/smoke_test_no_ffmpeg.py
package-name: torchaudio
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@release/2.10
with:
repository: ${{ matrix.repository }}
ref: ""
test-infra-repository: pytorch/test-infra
test-infra-ref: main
test-infra-ref: release/2.10
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
env-script: ${{ matrix.env-script }}
package-name: ${{ matrix.package-name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
python-version: ["3.11"]
ffmpeg-version: ["7"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.10
permissions:
id-token: write
contents: read
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/unittest-linux-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: ["3.11"]
ffmpeg-version: ["7"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.10
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -92,5 +92,7 @@ jobs:
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_DECODER=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true

pytest test/torchaudio_unittest -k "not torchscript and not fairseq and not demucs" -x
echo "::endgroup::"
4 changes: 3 additions & 1 deletion .github/workflows/unittest-linux-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
cuda-version: ["12.8"]
ffmpeg-version: ["7"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@release/2.10
permissions:
id-token: write
contents: read
Expand All @@ -44,6 +44,8 @@ jobs:
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX_ENCODER=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_FFMPEG=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_demucs=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true

export CUBLAS_WORKSPACE_CONFIG=:16:8

# Set UPLOAD_CHANNEL
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/unittest-macos-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: ["3.11"]
ffmpeg-version: ["7"]
fail-fast: false
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
uses: pytorch/test-infra/.github/workflows/macos_job.yml@release/2.10
permissions:
id-token: write
contents: read
Expand Down Expand Up @@ -89,6 +89,7 @@ jobs:
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_unidecode=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true

pytest test/torchaudio_unittest -k "not torchscript and not fairseq and not demucs and not librosa" -x
echo "::endgroup::"
3 changes: 2 additions & 1 deletion .github/workflows/unittest-windows-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
uses: pytorch/test-infra/.github/workflows/windows_job.yml@release/2.10
with:
repository: pytorch/audio
runner: windows.4xlarge
Expand Down Expand Up @@ -54,6 +54,7 @@ jobs:
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_sentencepiece=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true

.github/scripts/unittest-windows/setup_env.sh
.github/scripts/unittest-windows/install.sh
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/unittest-windows-gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
build:
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
uses: pytorch/test-infra/.github/workflows/windows_job.yml@release/2.10
with:
repository: pytorch/audio
runner: windows.g5.4xlarge.nvidia.gpu
Expand Down Expand Up @@ -55,6 +55,7 @@ jobs:
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_inflect=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_pytorch_lightning=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_sentencepiece=true
export TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MULTIGPU_CUDA=true

.github/scripts/unittest-windows/setup_env.sh
.github/scripts/unittest-windows/install.sh
Expand Down
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ def _main():
print("-- Git branch:", branch)
print("-- Git SHA:", sha)
print("-- Git tag:", tag)
pytorch_package_dep = _get_pytorch_version()
print("-- PyTorch dependency:", pytorch_package_dep)
# This used to be passed to install_requires
# which would cause pinning against a specific torch version in releases.
# I don't think we want to pin at all?
# TODO: revisit if needed. Maybe it's needed for nightlies. Unsure.
# pytorch_package_dep = _get_pytorch_version()
# print("-- PyTorch dependency:", pytorch_package_dep)
version = _get_version(sha)
print("-- Building version", version)

Expand Down Expand Up @@ -135,7 +139,7 @@ def _main():
"build_ext": setup_helpers.CMakeBuild,
"clean": clean,
},
install_requires=[pytorch_package_dep],
install_requires=[],
zip_safe=False,
)

Expand Down
1 change: 1 addition & 0 deletions src/libtorchaudio/forced_align/gpu/compute.cu
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void forced_align_impl(
const int64_t blank,
Tensor& paths) {
auto device_index = logProbs.get_device_index();
const torch::stable::accelerator::DeviceGuard device_guard(device_index);
auto defaultStream = libtorchaudio::cuda::getCurrentCUDAStream(device_index);
auto cpuDataTranferStream = libtorchaudio::cuda::getStreamFromPool(false, device_index);
const scalar_t kNegInfinity = -std::numeric_limits<scalar_t>::infinity();
Expand Down
8 changes: 3 additions & 5 deletions src/libtorchaudio/lfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ void host_lfilter_core_loop(
int64_t n_samples_input = input_signal_windows.size(2);
int64_t n_samples_output = padded_output_waveform.size(2);
int64_t n_order = a_coeff_flipped.size(1);
scalar_t* output_data =
reinterpret_cast<scalar_t*>(padded_output_waveform.data_ptr());
const scalar_t* input_data =
reinterpret_cast<scalar_t*>(input_signal_windows.data_ptr());
scalar_t* output_data = padded_output_waveform.mutable_data_ptr<scalar_t>();
const scalar_t* input_data = input_signal_windows.const_data_ptr<scalar_t>();
const scalar_t* a_coeff_flipped_data =
reinterpret_cast<scalar_t*>(a_coeff_flipped.data_ptr());
a_coeff_flipped.const_data_ptr<scalar_t>();

torch::stable::parallel_for(
0, n_channel * n_batch, 1, [&](int64_t begin, int64_t end) {
Expand Down
30 changes: 13 additions & 17 deletions src/libtorchaudio/rnnt/cpu/compute.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <libtorchaudio/rnnt/cpu/cpu_transducer.h>
#include <libtorchaudio/utils.h>

#include <torch/csrc/stable/library.h>
#include <torch/csrc/stable/ops.h>
#include <torch/csrc/stable/tensor.h>
Expand Down Expand Up @@ -73,15 +75,11 @@ std::tuple<Tensor, Tensor> compute(
STD_TORCH_CHECK(
blank >= 0 && blank < logits.size(-1),
"blank must be within [0, logits.shape[-1])");

auto max_ivalue = [](const Tensor& t) {
return reinterpret_cast<int32_t*>(torch::stable::amax(t, {}).data_ptr())[0];
};

STD_TORCH_CHECK(
logits.size(1) == max_ivalue(logit_lengths), "input length mismatch");
logits.size(1) == torchaudio::util::max<int64_t>(logit_lengths),
"input length mismatch");
STD_TORCH_CHECK(
logits.size(2) == max_ivalue(target_lengths) + 1,
logits.size(2) == torchaudio::util::max<int64_t>(target_lengths) + 1,
"output length mismatch");
STD_TORCH_CHECK(
targets.size(1) + 1 == logits.size(2), "target length mismatch");
Expand Down Expand Up @@ -110,14 +108,12 @@ std::tuple<Tensor, Tensor> compute(
{DtypeWorkspace<float>::ComputeSizeFromOptions(options)},
ScalarType::Float);

// TODO: use t.mutable_data_ptr<..>() instead of reinterpret_cast
// when stable ABI Tensor supports mutable_data_ptr templates.
Workspace<float> workspace(
/*options=*/options,
/*dtype_data=*/
reinterpret_cast<float*>(float_workspace.mutable_data_ptr()),
float_workspace.mutable_data_ptr<float>(),
/*dtype_size=*/float_workspace.numel(),
/*int_data=*/reinterpret_cast<int*>(int_workspace.mutable_data_ptr()),
/*int_data=*/int_workspace.mutable_data_ptr<int>(),
/*int_size=*/int_workspace.numel());

THO_DISPATCH_V2(
Expand All @@ -126,12 +122,12 @@ std::tuple<Tensor, Tensor> compute(
AT_WRAP([&] {
(Compute</*DTYPE=*/scalar_t, /*CAST_DTYPE=*/float>(
/*workspace=*/workspace,
/*logits=*/reinterpret_cast<scalar_t*>(logits.data_ptr()),
/*targets=*/reinterpret_cast<int*>(targets.data_ptr()),
/*srcLengths=*/reinterpret_cast<int*>(logit_lengths.data_ptr()),
/*tgtLengths=*/reinterpret_cast<int*>(target_lengths.data_ptr()),
/*costs=*/reinterpret_cast<scalar_t*>(costs.data_ptr()),
/*gradients=*/reinterpret_cast<scalar_t*>(gradients.data_ptr())));
/*logits=*/logits.const_data_ptr<scalar_t>(),
/*targets=*/targets.const_data_ptr<int>(),
/*srcLengths=*/logit_lengths.const_data_ptr<int>(),
/*tgtLengths=*/target_lengths.const_data_ptr<int>(),
/*costs=*/costs.mutable_data_ptr<scalar_t>(),
/*gradients=*/gradients.mutable_data_ptr<scalar_t>()));
}),
ScalarType::Float,
ScalarType::Half);
Expand Down
16 changes: 8 additions & 8 deletions src/libtorchaudio/rnnt/gpu/compute.cu
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ std::tuple<Tensor, Tensor> compute(

Workspace<float> workspace(
/*options=*/options,
/*dtype_data=*/reinterpret_cast<float*>(float_workspace.data_ptr()),
/*dtype_data=*/float_workspace.mutable_data_ptr<float>(),
/*dtype_size=*/float_workspace.numel(),
/*int_data=*/reinterpret_cast<int*>(int_workspace.data_ptr()),
/*int_data=*/int_workspace.mutable_data_ptr<int>(),
/*int_size=*/int_workspace.numel());

THO_DISPATCH_V2(
Expand All @@ -117,12 +117,12 @@ std::tuple<Tensor, Tensor> compute(
AT_WRAP([&] {
(Compute</*DTYPE=*/scalar_t, /*CAST_DTYPE=*/float>(
/*workspace=*/workspace,
/*logits=*/reinterpret_cast<scalar_t*>(logits.data_ptr()),
/*targets=*/reinterpret_cast<int*>(targets.data_ptr()),
/*srcLengths=*/reinterpret_cast<int*>(logit_lengths.data_ptr()),
/*tgtLengths=*/reinterpret_cast<int*>(target_lengths.data_ptr()),
/*costs=*/reinterpret_cast<scalar_t*>(costs.data_ptr()),
/*gradients=*/reinterpret_cast<scalar_t*>(gradients.data_ptr())));
/*logits=*/logits.const_data_ptr<scalar_t>(),
/*targets=*/targets.const_data_ptr<int>(),
/*srcLengths=*/logit_lengths.const_data_ptr<int>(),
/*tgtLengths=*/target_lengths.const_data_ptr<int>(),
/*costs=*/costs.mutable_data_ptr<scalar_t>(),
/*gradients=*/gradients.mutable_data_ptr<scalar_t>()));
}),
ScalarType::Float,
ScalarType::Half);
Expand Down
6 changes: 2 additions & 4 deletions src/torchaudio/datasets/cmuarctic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import csv
import os
from pathlib import Path
from typing import Tuple, Union
Expand Down Expand Up @@ -128,9 +127,8 @@ def __init__(
)
self._text = os.path.join(self._path, self._folder_text, self._file_text)

with open(self._text, "r") as text:
walker = csv.reader(text)
self._walker = list(walker)
with open(self._text, "r", newline=None) as text:
self._walker = [[line.rstrip("\n")] for line in text.readlines()]

def __getitem__(self, n: int) -> Tuple[Tensor, int, str, str]:
"""Load the n-th sample from the dataset.
Expand Down
2 changes: 2 additions & 0 deletions test/torchaudio_unittest/common_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
skipIfNoQengine,
skipIfPy310,
skipIfRocm,
skipIfSingleCuda,
TempDirMixin,
TestBaseMixin,
TorchaudioTestCase,
Expand Down Expand Up @@ -65,6 +66,7 @@ def inject_request(self, request):
"skipIfNoFFmpeg",
"skipIfNoHWAccel",
"skipIfPy310",
"skipIfSingleCuda",
"disabledInCI",
"get_wav_data",
"normalize_wav",
Expand Down
Loading
Loading