From 91ceb7e63db61c5998fc828710dc8faa5a837633 Mon Sep 17 00:00:00 2001 From: Divyansh Khanna Date: Wed, 25 Feb 2026 14:54:21 -0800 Subject: [PATCH 1/2] simple update --- test/stateful_dataloader/test_dataloader.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/stateful_dataloader/test_dataloader.py b/test/stateful_dataloader/test_dataloader.py index 3cfa6538f..f4756e542 100644 --- a/test/stateful_dataloader/test_dataloader.py +++ b/test/stateful_dataloader/test_dataloader.py @@ -2433,12 +2433,15 @@ def test_default_collate_shared_tensor(self): self.assertEqual(dataloader.default_collate([t_in]).is_shared(), False) self.assertEqual(dataloader.default_collate([n_in]).is_shared(), False) - # FIXME: fix the following hack that makes `default_collate` believe - # that it is in a worker process (since it tests - # `get_worker_info() != None`), even though it is not. old = _utils.worker._worker_info try: - _utils.worker._worker_info = "x" + _utils.worker._worker_info = _utils.worker.WorkerInfo( + id=0, + num_workers=1, + seed=0, + dataset=self.dataset, + worker_method="multiprocessing", + ) self.assertEqual(dataloader.default_collate([t_in]).is_shared(), True) self.assertEqual(dataloader.default_collate([n_in]).is_shared(), True) finally: From 32bebef3c98599835e43746e59d70b6021f1f706 Mon Sep 17 00:00:00 2001 From: Divyansh Khanna Date: Fri, 13 Mar 2026 11:54:03 -0700 Subject: [PATCH 2/2] docs upgrade --- docs/requirements.txt | 10 +++-- docs/source/_static/css/custom.css | 15 ------- docs/source/_templates/layout.html | 8 ---- docs/source/conf.py | 69 ++++++++++++++++++++++++------ 4 files changed, 63 insertions(+), 39 deletions(-) delete mode 100644 docs/source/_static/css/custom.css delete mode 100644 docs/source/_templates/layout.html diff --git a/docs/requirements.txt b/docs/requirements.txt index 2b9895351..b82007f8a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,8 @@ -sphinx==5.0.0 -# torch -# PyTorch Theme --e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme +sphinx>=7.2.0 +-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2 +sphinx-design==0.6.1 +sphinx-sitemap==2.7.1 +sphinxext-opengraph +docutils>=0.18.1,<0.21 # For Graph Visualization graphviz diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css deleted file mode 100644 index 25dd69c70..000000000 --- a/docs/source/_static/css/custom.css +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -h1 { - font-size: 2rem; - letter-spacing: 1.78px; - line-height: 2.5rem; - margin: 1.375rem 0; - text-transform: none; /* Overwrite upper-case conversion of titles */ -} diff --git a/docs/source/_templates/layout.html b/docs/source/_templates/layout.html deleted file mode 100644 index 7b7a77316..000000000 --- a/docs/source/_templates/layout.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "!layout.html" %} - -{% block sidebartitle %} - - {% include "searchbox.html" %} -{% endblock %} diff --git a/docs/source/conf.py b/docs/source/conf.py index f25a089dd..865caf0c9 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -19,7 +19,7 @@ import os import sys -import pytorch_sphinx_theme +import pytorch_sphinx_theme2 import torchdata # sys.path.insert(0, os.path.abspath('.')) @@ -55,6 +55,10 @@ "sphinx.ext.intersphinx", "sphinx.ext.doctest", "sphinx.ext.graphviz", + "sphinx_design", + "sphinx_sitemap", + "pytorch_sphinx_theme2", + "sphinxext.opengraph", ] # Do not execute standard reST doctest blocks so that documentation can @@ -62,7 +66,10 @@ doctest_test_doctest_blocks = "" # Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] +templates_path = [ + "_templates", + os.path.join(os.path.dirname(pytorch_sphinx_theme2.__file__), "templates"), +] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -75,17 +82,50 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -# html_theme = 'alabaster' -html_theme = "pytorch_sphinx_theme" -html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] +html_theme = "pytorch_sphinx_theme2" +html_theme_path = [pytorch_sphinx_theme2.get_html_theme_path()] + +# OpenGraph settings +ogp_site_url = "https://pytorch.org/data/" +ogp_image = "https://pytorch.org/assets/images/social-share.jpg" + +# Theme options +theme_variables = pytorch_sphinx_theme2.get_theme_variables() html_theme_options = { - "collapse_navigation": False, + "navigation_with_keys": False, + "analytics_id": "GTM-T8XT4PS", + "logo": { + "text": "TorchData", + }, + "icon_links": [ + { + "name": "GitHub", + "url": "https://github.com/pytorch/data", + "icon": "fa-brands fa-github", + }, + { + "name": "PyPi", + "url": "https://pypi.org/project/torchdata/", + "icon": "fa-brands fa-python", + }, + ], + "use_edit_page_button": True, + "navbar_center": "navbar-nav", + "navbar_start": ["pytorch_version"], "display_version": True, - "logo_only": True, - "pytorch_project": "docs", - "navigation_with_keys": True, - "analytics_id": "UA-117752657-2", +} + +html_context = { + "theme_variables": theme_variables, + "display_github": True, + "github_url": "https://github.com", + "github_user": "pytorch", + "github_repo": "data", + "github_version": "main", + "doc_path": "docs/source", + "library_links": theme_variables.get("library_links", []), + "community_links": theme_variables.get("community_links", []), } # Add any paths that contain custom static files (such as style sheets) here, @@ -93,9 +133,14 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] -html_css_files = [ - "css/custom.css", +# Sitemap settings +html_baseurl = f"https://pytorch.org/data/{version}/" +sitemap_locales = [None] +sitemap_excludes = [ + "search.html", + "genindex.html", ] +sitemap_url_scheme = "{link}" signature_replacements = {}