Commit b66a85ae authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Update Sphinx to 5.1.1 (#2678)

Summary:
Previous versions of Sphinx reported wrong path for return class. This issue is fixed on the latest Sphinx.

It allows to remove the patch we apply in `conf.py`. This is essential for the adoptation of `:autosummary:`, as it won't render correctly with the patch.

https://output.circle-artifacts.com/output/job/19d93ede-08de-4b9e-9d66-67ca5dab964e/artifacts/0/docs/pipelines.html

Pull Request resolved: https://github.com/pytorch/audio/pull/2678

Reviewed By: carolineechen

Differential Revision: D39509447

Pulled By: mthrok

fbshipit-source-id: e104bc6a87f32cba6c549a9fe8f2d1e489ee27e4
parent bfdb6764
...@@ -8,7 +8,7 @@ pyparsing<3,>=2.0.2 ...@@ -8,7 +8,7 @@ pyparsing<3,>=2.0.2
# - source/_templates/layout.html # - source/_templates/layout.html
# - source/_static/css/custom.css # - source/_static/css/custom.css
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@cece053#egg=pytorch_sphinx_theme -e git+https://github.com/pytorch/pytorch_sphinx_theme.git@cece053#egg=pytorch_sphinx_theme
sphinx==3.5.4 sphinx==5.1.1
sphinxcontrib.katex==0.8.6 sphinxcontrib.katex==0.8.6
sphinxcontrib.bibtex==2.4.2 sphinxcontrib.bibtex==2.4.2
sphinx_gallery==0.11.1 sphinx_gallery==0.11.1
......
...@@ -17,15 +17,14 @@ ...@@ -17,15 +17,14 @@
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
# #
import importlib
import os import os
import sys
sys.path.insert(0, os.path.abspath("."))
import re import re
import sys
import warnings import warnings
from datetime import datetime from datetime import datetime
sys.path.insert(0, os.path.abspath("."))
import pytorch_sphinx_theme import pytorch_sphinx_theme
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
...@@ -35,7 +34,7 @@ warnings.filterwarnings("ignore", module=r"matplotlib\..*") ...@@ -35,7 +34,7 @@ warnings.filterwarnings("ignore", module=r"matplotlib\..*")
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
# #
needs_sphinx = "1.6" needs_sphinx = "4.0.0"
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
...@@ -164,13 +163,6 @@ else: ...@@ -164,13 +163,6 @@ else:
version = f"Nightly Build ({torchaudio.__version__})" version = f"Nightly Build ({torchaudio.__version__})"
release = "nightly" release = "nightly"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path # This patterns also effect to html_static_path and html_extra_path
...@@ -350,40 +342,7 @@ def inject_minigalleries(app, what, name, obj, options, lines): ...@@ -350,40 +342,7 @@ def inject_minigalleries(app, what, name, obj, options, lines):
lines.append("\n") lines.append("\n")
# Overwrite the imported classes
def fix_module_path(module, attribute):
attr = importlib.import_module(module)
for attr_ in attribute:
attr = getattr(attr, attr_)
attr.__module__ = module
def fix_aliases():
patterns = {
"torchaudio.models": [
["HuBERTPretrainModel"],
["Wav2Vec2Model"],
["RNNT"],
["Tacotron2"],
],
"torchaudio.pipelines": [
["Tacotron2TTSBundle"],
["Tacotron2TTSBundle", "TextProcessor"],
["Tacotron2TTSBundle", "Vocoder"],
],
}
for module, attributes in patterns.items():
for attribute in attributes:
fix_module_path(module, attribute)
if importlib.util.find_spec("torchaudio.flashlight_lib_text_decoder") is not None:
for class_ in ["CTCHypothesis", "CTCDecoderLM", "CTCDecoderLMState"]:
fix_module_path("torchaudio.models.decoder", [class_])
def setup(app): def setup(app):
fix_aliases()
app.connect("autodoc-process-docstring", inject_minigalleries) app.connect("autodoc-process-docstring", inject_minigalleries)
......
...@@ -16,13 +16,13 @@ RNNTBundle ...@@ -16,13 +16,13 @@ RNNTBundle
.. autoclass:: RNNTBundle .. autoclass:: RNNTBundle
:members: sample_rate, n_fft, n_mels, hop_length, segment_length, right_context_length :members: sample_rate, n_fft, n_mels, hop_length, segment_length, right_context_length
.. automethod:: get_decoder() -> torchaudio.models.RNNTBeamSearch .. automethod:: get_decoder
.. automethod:: get_feature_extractor() -> RNNTBundle.FeatureExtractor .. automethod:: get_feature_extractor
.. automethod:: get_streaming_feature_extractor() -> RNNTBundle.FeatureExtractor .. automethod:: get_streaming_feature_extractor
.. automethod:: get_token_processor() -> RNNTBundle.TokenProcessor .. automethod:: get_token_processor
RNNTBundle - FeatureExtractor RNNTBundle - FeatureExtractor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -8,9 +8,7 @@ from . import components ...@@ -8,9 +8,7 @@ from . import components
class Wav2Vec2Model(Module): class Wav2Vec2Model(Module):
"""torchaudio.models.Wav2Vec2Model(feature_extractor: torch.nn.Module, encoder: torch.nn.Module, aux: Optional[torch.nn.Module] = None) """Encoder model used in *wav2vec 2.0* :cite:`baevski2020wav2vec`.
Encoder model used in *wav2vec 2.0* :cite:`baevski2020wav2vec`.
Note: Note:
To build the model, please use one of the factory functions. To build the model, please use one of the factory functions.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment