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

Add nightly build installation code snippet to prototype feature tutorials #2325

Closed
wants to merge 3 commits into from
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
20 changes: 20 additions & 0 deletions examples/tutorials/asr_inference_with_ctc_decoder_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@
import torch
import torchaudio

try:
import torchaudio.prototype.ctc_decoder
except ModuleNotFoundError:
try:
import google.colab

print(
"""
To enable running this notebook in Google Colab, install nightly
torch and torchaudio builds by adding the following code block to the top
of the notebook before running it:

!pip3 uninstall -y torch torchvision torchaudio
!pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
"""
)
except ModuleNotFoundError:
pass
raise


######################################################################
# Acoustic Model and Data
Expand Down
4 changes: 3 additions & 1 deletion examples/tutorials/device_asr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

.. note::

This tutorial requires prototype Streaming API and ffmpeg>=4.1.
This tutorial requires prototype Streaming API, ffmpeg>=4.1, and SentencePiece.

Prototype features are not part of binary releases, but available in
nightly build. Please refer to https://pytorch.org for installing
Expand All @@ -20,6 +20,8 @@
``conda install -c anaconda ffmpeg`` will install
the required libraries.

You can install SentencePiece by running ``pip install sentencepiece``.

.. note::

This tutorial was tested on MacBook Pro and Dynabook with Windows 10.
Expand Down
36 changes: 26 additions & 10 deletions examples/tutorials/online_asr_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#
# .. note::
#
# This tutorial requires torchaudio with prototype features and
# FFmpeg libraries (>=4.1).
# This tutorial requires torchaudio with prototype features,
# FFmpeg libraries (>=4.1), and SentencePiece.
#
# torchaudio prototype features are available on nightly builds.
# Please refer to https://pytorch.org/get-started/locally/
Expand All @@ -30,13 +30,7 @@
# ``conda install -c anaconda ffmpeg`` will install
# the required libraries.
#
# When running this tutorial in Google Colab, the following
# command should do.
#
# .. code::
#
# !add-apt-repository -y ppa:savoury1/ffmpeg4
# !apt-get -qq install -y ffmpeg
# You can install SentencePiece by running ``pip install sentencepiece``.

######################################################################
# 1. Overview
Expand All @@ -59,10 +53,32 @@
import torch
import torchaudio

try:
from torchaudio.prototype.io import Streamer
except ModuleNotFoundError:
try:
import google.colab

print(
"""
To enable running this notebook in Google Colab, install nightly
torch and torchaudio builds and the requisite third party libraries by
adding the following code block to the top of the notebook before running it:

!pip3 uninstall -y torch torchvision torchaudio
!pip3 install --pre torch torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
!pip3 install sentencepiece
!add-apt-repository -y ppa:savoury1/ffmpeg4
!apt-get -qq install -y ffmpeg
"""
)
except ModuleNotFoundError:
pass
raise

print(torch.__version__)
print(torchaudio.__version__)

from torchaudio.prototype.io import Streamer

######################################################################
# 3. Construct the pipeline
Expand Down
30 changes: 22 additions & 8 deletions examples/tutorials/streaming_api_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@
# ``conda install -c anaconda ffmpeg`` will install
# the required libraries.
#
# When running this tutorial in Google Colab, the following
# command should do.
#
# .. code::
#
# !add-apt-repository -y ppa:savoury1/ffmpeg4
# !apt-get -qq install -y ffmpeg

######################################################################
# 1. Overview
Expand Down Expand Up @@ -77,7 +70,28 @@
import matplotlib.pyplot as plt
import torch
import torchaudio
from torchaudio.prototype.io import Streamer

try:
from torchaudio.prototype.io import Streamer
except ModuleNotFoundError:
try:
import google.colab

print(
"""
To enable running this notebook in Google Colab, install nightly
torch and torchaudio builds and the requisite third party libraries by
adding the following code block to the top of the notebook before running it:

!pip3 uninstall -y torch torchvision torchaudio
!pip3 install --pre torch torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
!add-apt-repository -y ppa:savoury1/ffmpeg4
!apt-get -qq install -y ffmpeg
"""
)
except ModuleNotFoundError:
pass
raise

print(torch.__version__)
print(torchaudio.__version__)
Expand Down