Skip to content
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

[CI] Use a torch-nightly-compatible version of torchaudio #3644

Merged
merged 16 commits into from
Sep 21, 2023
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ jobs:

if [ "$PYTORCH" == "nightly" ]; then
extra_index_url=https://download.pytorch.org/whl/nightly/cpu
torchaudio_wheel="https://download.pytorch.org/whl/nightly/cpu/torchaudio-2.1.0.dev20230727%2Bcpu-cp310-cp310-linux_x86_64.whl"
pip install --pre torch torchtext torchvision torchaudio --index-url $extra_index_url
wget $torchaudio_wheel
pip install --no-deps $torchaudio_wheel

else
extra_index_url=https://download.pytorch.org/whl/cpu
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
env*
build/
develop-eggs/
dist/
Expand Down
1 change: 1 addition & 0 deletions ludwig/data/dataset_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def generate_audio(feature, outdir: str) -> str:

try:
torchaudio.save(audio_dest_path, audio_tensor, sampling_rate)

except OSError as e:
raise OSError(f"Unable to save audio to disk: {e}")

Expand Down
8 changes: 8 additions & 0 deletions tests/ludwig/data/test_dataset_synthesizer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import pytest
import torch
from packaging import version

from ludwig.data import dataset_synthesizer


@pytest.mark.skipif(
version.parse(torch.__version__).base_version >= version.parse("2.2.0").base_version,
reason="Fails with torch 2.2.0. https://github.com/ludwig-ai/ludwig/issues/3645",
)
def test_build_synthetic_dataset(tmpdir):
features = [
{"name": "text", "type": "text"},
Expand Down
5 changes: 5 additions & 0 deletions tests/ludwig/features/test_audio_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pandas as pd
import pytest
import torch
from packaging import version

from ludwig.backend import LOCAL_BACKEND
from ludwig.constants import BFILL, ENCODER_OUTPUT, PROC_COLUMN
Expand Down Expand Up @@ -52,6 +53,10 @@ def test_audio_input_feature(encoder: str) -> None:
assert encoder_output[ENCODER_OUTPUT].shape[1:] == audio_input_feature.output_shape


@pytest.mark.skipif(
version.parse(torch.__version__).base_version >= version.parse("2.2.0").base_version,
reason="Fails with torch 2.2.0. https://github.com/ludwig-ai/ludwig/issues/3645",
)
@pytest.mark.parametrize("feature_type", ["raw", "stft", "stft_phase", "group_delay", "fbank"])
def test_add_feature_data(feature_type, tmpdir):
preprocessing_params = {
Expand Down
6 changes: 6 additions & 0 deletions tests/ludwig/models/test_training_determinism.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import numpy as np
import pytest
import torch
from packaging import version

from ludwig.api import LudwigModel
from ludwig.constants import BATCH_SIZE, EVAL_BATCH_SIZE, TRAINER
Expand Down Expand Up @@ -42,6 +44,10 @@ def test_training_determinism_ray_backend(csv_filename, tmpdir, ray_cluster_4cpu
np.testing.assert_equal(train_stats_1, train_stats_2)


@pytest.mark.skipif(
version.parse(torch.__version__).base_version >= version.parse("2.2.0").base_version,
reason="Fails with torch 2.2.0. https://github.com/ludwig-ai/ludwig/issues/3645",
)
def test_training_determinism_local_backend(csv_filename, tmpdir):
experiment_output_1, experiment_output_2 = train_twice("local", csv_filename, tmpdir)

Expand Down
8 changes: 6 additions & 2 deletions tests/regression_tests/model/test_old_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ def test_model_loaded_from_old_config_prediction_works(tmpdir):
[
"https://predibase-public-us-west-2.s3.us-west-2.amazonaws.com/ludwig_unit_tests/titanic_v07.zip",
"https://predibase-public-us-west-2.s3.us-west-2.amazonaws.com/ludwig_unit_tests/twitter_bots_v05_1.zip",
"https://predibase-public-us-west-2.s3.us-west-2.amazonaws.com/ludwig_unit_tests/respiratory_v05.zip",
# TODO(Justin): Audio features are broken for torch 2.2.
# "https://predibase-public-us-west-2.s3.us-west-2.amazonaws.com/ludwig_unit_tests/respiratory_v05.zip",
# TODO(Arnav): Re-enable once https://github.com/ludwig-ai/ludwig/issues/3150 is resolved since the GBM
# model uses the PassthroughDecoder for the category output feature.
# "https://predibase-public-us-west-2.s3.us-west-2.amazonaws.com/ludwig_unit_tests/gbm_adult_census_income_v061.zip", # noqa: E501
],
ids=["titanic", "twitter_bots", "respiratory"], # , "gbm_adult_census_income"],
ids=[
"titanic",
"twitter_bots",
], # "respiratory"], # , "gbm_adult_census_income"],
)
def test_predict_deprecated_model(model_url, tmpdir):
model_dir = os.path.join(tmpdir, "model")
Expand Down