Skip to content

Commit 6a2309b

Browse files
stevhliusayakpaul
andauthored
[utils] Update check_doc_toc (#12642)
update Co-authored-by: Sayak Paul <[email protected]>
1 parent cd3bbe2 commit 6a2309b

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

docs/source/en/_toctree.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@
450450
- sections:
451451
- local: api/pipelines/overview
452452
title: Overview
453+
- local: api/pipelines/auto_pipeline
454+
title: AutoPipeline
453455
- sections:
454456
- local: api/pipelines/audioldm
455457
title: AudioLDM
@@ -462,8 +464,6 @@
462464
- local: api/pipelines/stable_audio
463465
title: Stable Audio
464466
title: Audio
465-
- local: api/pipelines/auto_pipeline
466-
title: AutoPipeline
467467
- sections:
468468
- local: api/pipelines/amused
469469
title: aMUSEd
@@ -527,6 +527,8 @@
527527
title: HiDream-I1
528528
- local: api/pipelines/hunyuandit
529529
title: Hunyuan-DiT
530+
- local: api/pipelines/hunyuanimage21
531+
title: HunyuanImage2.1
530532
- local: api/pipelines/pix2pix
531533
title: InstructPix2Pix
532534
- local: api/pipelines/kandinsky
@@ -640,8 +642,6 @@
640642
title: ConsisID
641643
- local: api/pipelines/framepack
642644
title: Framepack
643-
- local: api/pipelines/hunyuanimage21
644-
title: HunyuanImage2.1
645645
- local: api/pipelines/hunyuan_video
646646
title: HunyuanVideo
647647
- local: api/pipelines/i2vgenxl

utils/check_doc_toc.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@
2121

2222
PATH_TO_TOC = "docs/source/en/_toctree.yml"
2323

24+
# Titles that should maintain their position and not be sorted alphabetically
25+
FIXED_POSITION_TITLES = {"overview", "autopipeline"}
26+
2427

2528
def clean_doc_toc(doc_list):
2629
"""
2730
Cleans the table of content of the model documentation by removing duplicates and sorting models alphabetically.
2831
"""
2932
counts = defaultdict(int)
30-
overview_doc = []
33+
fixed_position_docs = []
3134
new_doc_list = []
3235
for doc in doc_list:
3336
if "local" in doc:
3437
counts[doc["local"]] += 1
3538

36-
if doc["title"].lower() == "overview":
37-
overview_doc.append({"local": doc["local"], "title": doc["title"]})
39+
if doc["title"].lower() in FIXED_POSITION_TITLES:
40+
fixed_position_docs.append({"local": doc["local"], "title": doc["title"]})
3841
else:
3942
new_doc_list.append(doc)
4043

@@ -57,14 +60,13 @@ def clean_doc_toc(doc_list):
5760
new_doc.extend([doc for doc in doc_list if "local" not in counts or counts[doc["local"]] == 1])
5861
new_doc = sorted(new_doc, key=lambda s: s["title"].lower())
5962

60-
# "overview" gets special treatment and is always first
61-
if len(overview_doc) > 1:
62-
raise ValueError("{doc_list} has two 'overview' docs which is not allowed.")
63-
64-
overview_doc.extend(new_doc)
63+
# Fixed-position titles maintain their original order
64+
result = []
65+
for doc in fixed_position_docs:
66+
result.append(doc)
6567

66-
# Sort
67-
return overview_doc
68+
result.extend(new_doc)
69+
return result
6870

6971

7072
def check_scheduler_doc(overwrite=False):

0 commit comments

Comments
 (0)