Skip to content

Commit 403afd1

Browse files
committed
Add a field to the side bar
1 parent 4333ba8 commit 403afd1

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

.github/workflows/build_main_documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ jobs:
171171
- name: Combine subpackage documentation
172172
run: |
173173
cd optimum
174-
sudo python docs/combine_docs.py --subpackages nvidia amd intel neuron habana furiosa --version ${{ env.VERSION }}
174+
sudo python docs/combine_docs.py --subpackages nvidia amd intel neuron tpu habana furiosa --version ${{ env.VERSION }}
175175
cd ..
176176
177177
- name: Push to repositories

.github/workflows/build_pr_documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
- name: Combine subpackage documentation
102102
run: |
103103
cd optimum
104-
sudo python docs/combine_docs.py --subpackages nvidia amd intel neuron habana furiosa --version pr_$PR_NUMBER
104+
sudo python docs/combine_docs.py --subpackages nvidia amd intel neuron tpu habana furiosa --version pr_$PR_NUMBER
105105
sudo mv optimum-doc-build ../
106106
cd ..
107107

docs/combine_docs.py

+28
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,31 @@ def add_neuron_doc(base_toc: List):
108108
)
109109

110110

111+
def add_tpu_doc(base_toc: List):
112+
"""
113+
Extends the table of content with a section about Optimum Neuron.
114+
115+
Args:
116+
base_toc (List): table of content for the doc of Optimum.
117+
"""
118+
# Update optimum table of contents
119+
base_toc.insert(
120+
SUBPACKAGE_TOC_INSERT_INDEX,
121+
{
122+
"sections": [
123+
{
124+
# Ideally this should directly point at https://huggingface.co/docs/optimum-tpu/index
125+
# Current hacky solution is to have a redirection in _redirects.yml
126+
"local": "docs/optimum-tpu/index",
127+
"title": "🤗 Optimum TPU",
128+
}
129+
],
130+
"title": "TPU",
131+
"isExpanded": False,
132+
},
133+
)
134+
135+
111136
def main():
112137
args = parser.parse_args()
113138
optimum_path = Path("optimum-doc-build")
@@ -121,6 +146,9 @@ def main():
121146
if subpackage == "neuron":
122147
# Neuron has its own doc so it is managed differently
123148
add_neuron_doc(base_toc)
149+
elif subpackage == "tpu":
150+
# Optimum TPU has its own doc so it is managed differently
151+
add_tpu_doc(base_toc)
124152
elif subpackage == "nvidia":
125153
# At the moment, Optimum Nvidia's doc is the README of the GitHub repo
126154
# It is linked to in optimum/docs/source/nvidia_overview.mdx

docs/source/_redirects.yml

+3
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ intel_trainer: intel/reference_inc
2828

2929
# Optimum Neuron
3030
docs/optimum-neuron/index: /docs/optimum-neuron/index
31+
32+
# Optimum TPU
33+
docs/optimum-tpu/index: /docs/optimum-tpu/index

0 commit comments

Comments
 (0)