forked from pytorch/ao
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pytorch-labs:main' into main
- Loading branch information
Showing
29 changed files
with
1,125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
name: Build Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release/* | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9] | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: build-docs-${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
defaults: | ||
run: | ||
shell: bash -l -eo pipefail {0} | ||
|
||
jobs: | ||
build_docs: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ['3.11'] | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
- name: Setup conda env | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
miniconda-version: "latest" | ||
activate-environment: test | ||
python-version: ${{ matrix.python-version }} | ||
- name: Update pip | ||
run: python -m pip install --upgrade pip | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install torch | ||
python -m pip install -e . | ||
cd docs | ||
python -m pip install -r requirements.txt | ||
- name: Get the torchtune version | ||
run: | | ||
# Get the github.ref_name and save into the | ||
# REF_NAME variable. This will be passed in | ||
# conf.py to display the version in the | ||
# site dropdown | ||
REF_NAME=${{ github.ref_name }} | ||
TORCHAO_VERSION_DOCS="${REF_NAME}" | ||
echo "$TORCHAO_VERSION_DOCS" | ||
- name: Build docs | ||
run: | | ||
cd docs | ||
make html | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: Doc-Build | ||
path: docs/build/html/ | ||
|
||
upload: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Grant write permission here so that the doc can be pushed to gh-pages branch | ||
contents: write | ||
needs: build_docs | ||
if: github.repository == 'pytorch-labs/ao' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v')) | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
persist-credentials: false | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: Doc-Build | ||
path: docs | ||
- name: Add no-index tag | ||
run: | | ||
REF_NAME=$(echo "${{ github.ref }}") | ||
echo "Ref name: ${REF_NAME}" | ||
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then | ||
find docs -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">'; | ||
fi | ||
- name: Move and commit changes | ||
env: | ||
GITHUB_PYTORCHBOT_TOKEN: ${{ secrets.GH_PYTORCHBOT_TOKEN }} | ||
run: | | ||
git remote set-url origin https://pytorchbot:${GITHUB_PYTORCHBOT_TOKEN}@github.com/pytorch-labs/ao.git | ||
set -euo pipefail | ||
REF_TYPE=${{ github.ref_type }} | ||
REF_NAME=${{ github.ref_name }} | ||
if [[ "${REF_TYPE}" == branch ]]; then | ||
TARGET_FOLDER="${REF_NAME}" | ||
elif [[ "${REF_TYPE}" == tag ]]; then | ||
case "${REF_NAME}" in | ||
*-rc*) | ||
echo "Aborting upload since this is an RC tag: ${REF_NAME}" | ||
exit 0 | ||
;; | ||
*) | ||
TARGET_FOLDER=$(echo "${REF_NAME}" | sed 's/v\([0-9]\+\)\.\([0-9]\+\)\.[0-9]\+/\1.\2/') | ||
;; | ||
esac | ||
fi | ||
echo "Target Folder: ${TARGET_FOLDER}" | ||
mkdir -p "${TARGET_FOLDER}" | ||
rm -rf "${TARGET_FOLDER}"/* | ||
mv docs/* "${TARGET_FOLDER}" | ||
git config user.name 'pytorchbot' | ||
git config user.email 'soumith+bot@pytorch.org' | ||
git add "${TARGET_FOLDER}" || true | ||
git commit -m "auto-generating sphinx docs" || true | ||
git push -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
ifneq ($(EXAMPLES_PATTERN),) | ||
EXAMPLES_PATTERN_OPTS := -D sphinx_gallery_conf.filename_pattern="$(EXAMPLES_PATTERN)" | ||
endif | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = -W -j auto $(EXAMPLES_PATTERN_OPTS) | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = torchao | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
html-noplot: # Avoids running the gallery examples, which may take time | ||
$(SPHINXBUILD) -D plot_gallery=0 -b html "${SOURCEDIR}" "$(BUILDDIR)"/html | ||
@echo | ||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html." | ||
|
||
clean: | ||
rm -rf $(BUILDDIR)/* | ||
rm -rf $(SOURCEDIR)/generated_examples/ # sphinx-gallery | ||
rm -rf $(SOURCEDIR)/gen_modules/ # sphinx-gallery | ||
rm -rf $(SOURCEDIR)/sg_execution_times.rst # sphinx-gallery | ||
rm -rf $(SOURCEDIR)/generated/ # autosummary | ||
|
||
.PHONY: help Makefile docset | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Tutorials | ||
========= | ||
|
||
template_tutorial.py | ||
Template Tutorial | ||
tutorials/template_tutorial.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sphinx-gallery>0.11 | ||
sphinx==5.0.0 | ||
sphinx_design | ||
sphinx_copybutton | ||
sphinx-tabs | ||
matplotlib | ||
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
/* sphinx-design styles for cards/tabs */ | ||
|
||
|
||
:root { | ||
--sd-color-info: #ee4c2c; | ||
--sd-color-primary: #6c6c6d; | ||
--sd-color-primary-highlight: #f3f4f7; | ||
--sd-color-card-border-hover: #ee4c2c; | ||
--sd-color-card-border: #f3f4f7; | ||
--sd-color-card-background: #fff; | ||
--sd-color-card-text: inherit; | ||
--sd-color-card-header: transparent; | ||
--sd-color-card-footer: transparent; | ||
--sd-color-tabs-label-active: #ee4c2c; | ||
--sd-color-tabs-label-hover: #ee4c2c; | ||
--sd-color-tabs-label-inactive: #6c6c6d; | ||
--sd-color-tabs-underline-active: #ee4c2c; | ||
--sd-color-tabs-underline-hover: #fabdbd; | ||
--sd-color-tabs-underline-inactive: transparent; | ||
--sd-color-tabs-overline: rgb(222, 222, 222); | ||
--sd-color-tabs-underline: rgb(222, 222, 222); | ||
} | ||
|
||
.sd-text-info { | ||
color: #ee4c2c; | ||
} | ||
|
||
.sd-card-img-top { | ||
background: #ee4c2c; | ||
height: 5px !important; | ||
} | ||
|
||
.sd-card { | ||
position: relative; | ||
background-color: #fff; | ||
opacity: 1.0; | ||
border-radius: 0px; | ||
width: 30%; | ||
border: none; | ||
padding-bottom: 0px; | ||
} | ||
|
||
|
||
.sd-card-img:hover { | ||
opacity: 1.0; | ||
background-color: #f3f4f7; | ||
} | ||
|
||
|
||
.sd-card:after { | ||
display: block; | ||
opacity: 1; | ||
content: ''; | ||
border-bottom: solid 1px #ee4c2c; | ||
background-color: #fff; | ||
transform: scaleX(0); | ||
transition: transform .250s ease-in-out; | ||
transform-origin: 0% 50%; | ||
} | ||
|
||
.sd-card:hover { | ||
background-color: #fff; | ||
opacity: 1; | ||
border-top: 1px solid #f3f4f7; | ||
border-left: 1px solid #f3f4f7; | ||
border-right: 1px solid #f3f4f7; | ||
} | ||
|
||
.sd-card:hover:after { | ||
transform: scaleX(1); | ||
} | ||
|
||
.card-prerequisites:hover { | ||
transition: none; | ||
border: none; | ||
} | ||
|
||
.card-prerequisites:hover:after { | ||
transition: none; | ||
transform: none; | ||
} | ||
|
||
.card-prerequisites:after { | ||
display: block; | ||
content: ''; | ||
border-bottom: none; | ||
background-color: #fff; | ||
transform: none; | ||
transition: none; | ||
transform-origin: none; | ||
} | ||
|
||
|
||
details.sd-dropdown { | ||
font-weight: 300; | ||
width: auto; | ||
} | ||
|
||
details.sd-dropdown:after { | ||
border: none; | ||
transition: none; | ||
} | ||
|
||
details.sd-dropdown:hover { | ||
border: none; | ||
transition: none; | ||
} | ||
|
||
details.sd-dropdown .sd-summary-content { | ||
font-weight: 300; | ||
} | ||
|
||
details.sd-dropdown .highlight .n { | ||
font-weight: normal; | ||
} | ||
|
||
.et-page-column1 { | ||
float: left; | ||
width: 70%; | ||
font-size: 1rem; | ||
} | ||
|
||
.et-page-column2 { | ||
float: right; | ||
padding-top: 40px; | ||
padding-left: 60px; | ||
padding-right: 60px; | ||
padding-bottom: 60px; | ||
width: 30%; | ||
} | ||
|
||
.et-page-column-row:after { | ||
content: ""; | ||
display: table; | ||
clear: both; | ||
} | ||
|
||
/* For screens smaller than 768px (typical mobile devices) */ | ||
@media screen and (max-width: 768px) { | ||
.et-page-column1, .et-page-column2 { | ||
float: none; /* Remove floats */ | ||
width: 100%; /* Full width for both columns */ | ||
padding: 0; | ||
font-size: 1rem; | ||
} | ||
|
||
.et-page-column2 img { | ||
display: none; | ||
} | ||
.et-page-column-row:after { | ||
content: ""; | ||
display: table; | ||
clear: both; | ||
} | ||
} | ||
|
||
article.pytorch-article .class .method dt { | ||
border-top: none; | ||
} | ||
|
||
article.pytorch-article .class .simple dt { | ||
border-top: none; | ||
} | ||
|
||
article.pytorch-article .function dt.sig { | ||
border-top: none; | ||
} | ||
|
||
/* Fix for Sphinx gallery thumbnails. | ||
See https://github.com/sphinx-gallery/sphinx-gallery/issues/990 | ||
*/ | ||
article.pytorch-article .sphx-glr-thumbnails .sphx-glr-thumbcontainer { | ||
width: unset; | ||
margin-right: 0; | ||
margin-left: 0; | ||
} | ||
article.pytorch-article div.section div.wy-table-responsive tbody td { | ||
width: 50%; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.