Skip to content

Commit b757cc6

Browse files
Rename download_asset to _download_asset (#3998)
* Rename download_asset to _download_asset * Remove download_asset from exported utils_ --------- Co-authored-by: Sam Anklesaria <[email protected]>
1 parent 6519052 commit b757cc6

19 files changed

+48
-50
lines changed

examples/tutorials/asr_inference_with_ctc_decoder_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
import IPython
6565
import matplotlib.pyplot as plt
6666
from torchaudio.models.decoder import ctc_decoder
67-
from torchaudio.utils import download_asset
67+
from torchaudio.utils import _download_asset
6868

6969
######################################################################
7070
#
@@ -85,7 +85,7 @@
8585
# We will load a sample from the LibriSpeech test-other dataset.
8686
#
8787

88-
speech_file = download_asset("tutorial-assets/ctc-decoding/1688-142285-0007.wav")
88+
speech_file = _download_asset("tutorial-assets/ctc-decoding/1688-142285-0007.wav")
8989

9090
IPython.display.Audio(speech_file)
9191

examples/tutorials/asr_inference_with_cuda_ctc_decoder_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
import IPython
6868
import sentencepiece as spm
6969
from torchaudio.models.decoder import cuda_ctc_decoder
70-
from torchaudio.utils import download_asset
70+
from torchaudio.utils import _download_asset
7171

7272
######################################################################
7373
#
@@ -95,7 +95,7 @@ def download_asset_external(url, key):
9595
# We will load a sample from the LibriSpeech test-other dataset.
9696
#
9797

98-
speech_file = download_asset("tutorial-assets/ctc-decoding/1688-142285-0007.wav")
98+
speech_file = _download_asset("tutorial-assets/ctc-decoding/1688-142285-0007.wav")
9999
waveform, sample_rate = torchaudio.load(speech_file)
100100
assert sample_rate == 16000
101101
IPython.display.Audio(speech_file)

examples/tutorials/audio_data_augmentation_tutorial.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131

3232
from IPython.display import Audio
3333

34-
from torchaudio.utils import download_asset
34+
from torchaudio.utils import _download_asset
3535

36-
SAMPLE_WAV = download_asset("tutorial-assets/steam-train-whistle-daniel_simon.wav")
37-
SAMPLE_RIR = download_asset("tutorial-assets/Lab41-SRI-VOiCES-rm1-impulse-mc01-stu-clo-8000hz.wav")
38-
SAMPLE_SPEECH = download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042-8000hz.wav")
39-
SAMPLE_NOISE = download_asset("tutorial-assets/Lab41-SRI-VOiCES-rm1-babb-mc01-stu-clo-8000hz.wav")
36+
SAMPLE_WAV = _download_asset("tutorial-assets/steam-train-whistle-daniel_simon.wav")
37+
SAMPLE_RIR = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-rm1-impulse-mc01-stu-clo-8000hz.wav")
38+
SAMPLE_SPEECH = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042-8000hz.wav")
39+
SAMPLE_NOISE = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-rm1-babb-mc01-stu-clo-8000hz.wav")
4040

4141

4242
######################################################################

examples/tutorials/audio_feature_augmentation_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222

2323
import matplotlib.pyplot as plt
2424
from IPython.display import Audio
25-
from torchaudio.utils import download_asset
25+
from torchaudio.utils import _download_asset
2626
import torchaudio
2727

2828
######################################################################
2929
# In this tutorial, we will use a speech data from
3030
# `VOiCES dataset <https://iqtlabs.github.io/voices/>`__,
3131
# which is licensed under Creative Commos BY 4.0.
3232

33-
SAMPLE_WAV_SPEECH_PATH = download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
33+
SAMPLE_WAV_SPEECH_PATH = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
3434

3535

3636
def _get_sample(path):

examples/tutorials/audio_feature_extractions_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848

4949
from IPython.display import Audio
5050
from matplotlib.patches import Rectangle
51-
from torchaudio.utils import download_asset
51+
from torchaudio.utils import _download_asset
5252

5353
torch.random.manual_seed(0)
5454

55-
SAMPLE_SPEECH = download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
55+
SAMPLE_SPEECH = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
5656

5757

5858
def plot_waveform(waveform, sr, title="Waveform", ax=None):

examples/tutorials/ctc_forced_alignment_api_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
# to use.
6363
#
6464

65-
SPEECH_FILE = torchaudio.utils.download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
65+
SPEECH_FILE = torchaudio.utils._download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
6666
waveform, _ = torchaudio.load(SPEECH_FILE)
6767
TRANSCRIPT = "i had that curiosity beside me at this moment".split()
6868

examples/tutorials/forced_alignment_tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181

8282
torch.random.manual_seed(0)
8383

84-
SPEECH_FILE = torchaudio.utils.download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
84+
SPEECH_FILE = torchaudio.utils._download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
8585

8686

8787
######################################################################

examples/tutorials/hybrid_demucs_tutorial.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
from IPython.display import Audio
5353
from torchaudio.pipelines import HDEMUCS_HIGH_MUSDB_PLUS
54-
from torchaudio.utils import download_asset
54+
from torchaudio.utils import _download_asset
5555

5656
######################################################################
5757
# 3. Construct the pipeline
@@ -181,7 +181,7 @@ def plot_spectrogram(stft, title="Spectrogram"):
181181
#
182182

183183
# We download the audio file from our storage. Feel free to download another file and use audio from a specific path
184-
SAMPLE_SONG = download_asset("tutorial-assets/hdemucs_mix.wav")
184+
SAMPLE_SONG = _download_asset("tutorial-assets/hdemucs_mix.wav")
185185
waveform, sample_rate = torchaudio.load(SAMPLE_SONG) # replace SAMPLE_SONG with desired path for different song
186186
waveform = waveform.to(device)
187187
mixture = waveform
@@ -254,10 +254,10 @@ def output_results(original_source: torch.Tensor, predicted_source: torch.Tensor
254254
frame_start = segment_start * sample_rate
255255
frame_end = segment_end * sample_rate
256256

257-
drums_original = download_asset("tutorial-assets/hdemucs_drums_segment.wav")
258-
bass_original = download_asset("tutorial-assets/hdemucs_bass_segment.wav")
259-
vocals_original = download_asset("tutorial-assets/hdemucs_vocals_segment.wav")
260-
other_original = download_asset("tutorial-assets/hdemucs_other_segment.wav")
257+
drums_original = _download_asset("tutorial-assets/hdemucs_drums_segment.wav")
258+
bass_original = _download_asset("tutorial-assets/hdemucs_bass_segment.wav")
259+
vocals_original = _download_asset("tutorial-assets/hdemucs_vocals_segment.wav")
260+
other_original = _download_asset("tutorial-assets/hdemucs_other_segment.wav")
261261

262262
drums_spec = audios["drums"][:, frame_start:frame_end].cpu()
263263
drums, sample_rate = torchaudio.load(drums_original)

examples/tutorials/mvdr_tutorial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
# 2.1. Import the packages
5050
#
5151

52-
from torchaudio.utils import download_asset
52+
from torchaudio.utils import _download_asset
5353

5454
######################################################################
5555
# 2.2. Download audio data
@@ -74,8 +74,8 @@
7474
#
7575

7676
SAMPLE_RATE = 16000
77-
SAMPLE_CLEAN = download_asset("tutorial-assets/mvdr/clean_speech.wav")
78-
SAMPLE_NOISE = download_asset("tutorial-assets/mvdr/noise.wav")
77+
SAMPLE_CLEAN = _download_asset("tutorial-assets/mvdr/clean_speech.wav")
78+
SAMPLE_NOISE = _download_asset("tutorial-assets/mvdr/noise.wav")
7979

8080

8181
######################################################################

examples/tutorials/speech_recognition_pipeline_tutorial.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151

5252
import IPython
5353
import matplotlib.pyplot as plt
54-
from torchaudio.utils import download_asset
54+
from torchaudio.utils import _download_asset
5555

56-
SPEECH_FILE = download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
56+
SPEECH_FILE = _download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav")
5757

5858

5959
######################################################################

0 commit comments

Comments
 (0)