Skip to content

Commit d63e6fc

Browse files
authored
[BUG] fixed _toctree.yml alphabetical ordering (#11277)
update
1 parent 59f1b7b commit d63e6fc

File tree

2 files changed

+86
-34
lines changed

2 files changed

+86
-34
lines changed

docs/source/en/_toctree.yml

+30-30
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,12 @@
290290
title: AuraFlowTransformer2DModel
291291
- local: api/models/cogvideox_transformer3d
292292
title: CogVideoXTransformer3DModel
293-
- local: api/models/consisid_transformer3d
294-
title: ConsisIDTransformer3DModel
295293
- local: api/models/cogview3plus_transformer2d
296294
title: CogView3PlusTransformer2DModel
297295
- local: api/models/cogview4_transformer2d
298296
title: CogView4Transformer2DModel
297+
- local: api/models/consisid_transformer3d
298+
title: ConsisIDTransformer3DModel
299299
- local: api/models/dit_transformer2d
300300
title: DiTTransformer2DModel
301301
- local: api/models/easyanimate_transformer3d
@@ -310,12 +310,12 @@
310310
title: HunyuanVideoTransformer3DModel
311311
- local: api/models/latte_transformer3d
312312
title: LatteTransformer3DModel
313-
- local: api/models/lumina_nextdit2d
314-
title: LuminaNextDiT2DModel
315-
- local: api/models/lumina2_transformer2d
316-
title: Lumina2Transformer2DModel
317313
- local: api/models/ltx_video_transformer3d
318314
title: LTXVideoTransformer3DModel
315+
- local: api/models/lumina2_transformer2d
316+
title: Lumina2Transformer2DModel
317+
- local: api/models/lumina_nextdit2d
318+
title: LuminaNextDiT2DModel
319319
- local: api/models/mochi_transformer3d
320320
title: MochiTransformer3DModel
321321
- local: api/models/omnigen_transformer
@@ -324,10 +324,10 @@
324324
title: PixArtTransformer2DModel
325325
- local: api/models/prior_transformer
326326
title: PriorTransformer
327-
- local: api/models/sd3_transformer2d
328-
title: SD3Transformer2DModel
329327
- local: api/models/sana_transformer2d
330328
title: SanaTransformer2DModel
329+
- local: api/models/sd3_transformer2d
330+
title: SD3Transformer2DModel
331331
- local: api/models/stable_audio_transformer
332332
title: StableAudioDiTModel
333333
- local: api/models/transformer2d
@@ -342,10 +342,10 @@
342342
title: StableCascadeUNet
343343
- local: api/models/unet
344344
title: UNet1DModel
345-
- local: api/models/unet2d
346-
title: UNet2DModel
347345
- local: api/models/unet2d-cond
348346
title: UNet2DConditionModel
347+
- local: api/models/unet2d
348+
title: UNet2DModel
349349
- local: api/models/unet3d-cond
350350
title: UNet3DConditionModel
351351
- local: api/models/unet-motion
@@ -354,6 +354,10 @@
354354
title: UViT2DModel
355355
title: UNets
356356
- sections:
357+
- local: api/models/asymmetricautoencoderkl
358+
title: AsymmetricAutoencoderKL
359+
- local: api/models/autoencoder_dc
360+
title: AutoencoderDC
357361
- local: api/models/autoencoderkl
358362
title: AutoencoderKL
359363
- local: api/models/autoencoderkl_allegro
@@ -370,10 +374,6 @@
370374
title: AutoencoderKLMochi
371375
- local: api/models/autoencoder_kl_wan
372376
title: AutoencoderKLWan
373-
- local: api/models/asymmetricautoencoderkl
374-
title: AsymmetricAutoencoderKL
375-
- local: api/models/autoencoder_dc
376-
title: AutoencoderDC
377377
- local: api/models/consistency_decoder_vae
378378
title: ConsistencyDecoderVAE
379379
- local: api/models/autoencoder_oobleck
@@ -521,40 +521,40 @@
521521
- sections:
522522
- local: api/pipelines/stable_diffusion/overview
523523
title: Overview
524-
- local: api/pipelines/stable_diffusion/text2img
525-
title: Text-to-image
524+
- local: api/pipelines/stable_diffusion/depth2img
525+
title: Depth-to-image
526+
- local: api/pipelines/stable_diffusion/gligen
527+
title: GLIGEN (Grounded Language-to-Image Generation)
528+
- local: api/pipelines/stable_diffusion/image_variation
529+
title: Image variation
526530
- local: api/pipelines/stable_diffusion/img2img
527531
title: Image-to-image
528532
- local: api/pipelines/stable_diffusion/svd
529533
title: Image-to-video
530534
- local: api/pipelines/stable_diffusion/inpaint
531535
title: Inpainting
532-
- local: api/pipelines/stable_diffusion/depth2img
533-
title: Depth-to-image
534-
- local: api/pipelines/stable_diffusion/image_variation
535-
title: Image variation
536+
- local: api/pipelines/stable_diffusion/k_diffusion
537+
title: K-Diffusion
538+
- local: api/pipelines/stable_diffusion/latent_upscale
539+
title: Latent upscaler
540+
- local: api/pipelines/stable_diffusion/ldm3d_diffusion
541+
title: LDM3D Text-to-(RGB, Depth), Text-to-(RGB-pano, Depth-pano), LDM3D Upscaler
536542
- local: api/pipelines/stable_diffusion/stable_diffusion_safe
537543
title: Safe Stable Diffusion
544+
- local: api/pipelines/stable_diffusion/sdxl_turbo
545+
title: SDXL Turbo
538546
- local: api/pipelines/stable_diffusion/stable_diffusion_2
539547
title: Stable Diffusion 2
540548
- local: api/pipelines/stable_diffusion/stable_diffusion_3
541549
title: Stable Diffusion 3
542550
- local: api/pipelines/stable_diffusion/stable_diffusion_xl
543551
title: Stable Diffusion XL
544-
- local: api/pipelines/stable_diffusion/sdxl_turbo
545-
title: SDXL Turbo
546-
- local: api/pipelines/stable_diffusion/latent_upscale
547-
title: Latent upscaler
548552
- local: api/pipelines/stable_diffusion/upscale
549553
title: Super-resolution
550-
- local: api/pipelines/stable_diffusion/k_diffusion
551-
title: K-Diffusion
552-
- local: api/pipelines/stable_diffusion/ldm3d_diffusion
553-
title: LDM3D Text-to-(RGB, Depth), Text-to-(RGB-pano, Depth-pano), LDM3D Upscaler
554554
- local: api/pipelines/stable_diffusion/adapter
555555
title: T2I-Adapter
556-
- local: api/pipelines/stable_diffusion/gligen
557-
title: GLIGEN (Grounded Language-to-Image Generation)
556+
- local: api/pipelines/stable_diffusion/text2img
557+
title: Text-to-image
558558
title: Stable Diffusion
559559
- local: api/pipelines/stable_unclip
560560
title: Stable unCLIP

utils/check_doc_toc.py

+56-4
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,13 @@ def check_pipeline_doc(overwrite=False):
123123

124124
# sort sub pipeline docs
125125
for pipeline_doc in pipeline_docs:
126-
if "section" in pipeline_doc:
127-
sub_pipeline_doc = pipeline_doc["section"]
126+
if "sections" in pipeline_doc:
127+
sub_pipeline_doc = pipeline_doc["sections"]
128128
new_sub_pipeline_doc = clean_doc_toc(sub_pipeline_doc)
129-
if overwrite:
130-
pipeline_doc["section"] = new_sub_pipeline_doc
129+
if new_sub_pipeline_doc != sub_pipeline_doc:
130+
diff = True
131+
if overwrite:
132+
pipeline_doc["sections"] = new_sub_pipeline_doc
131133
new_pipeline_docs.append(pipeline_doc)
132134

133135
# sort overall pipeline doc
@@ -149,10 +151,60 @@ def check_pipeline_doc(overwrite=False):
149151
)
150152

151153

154+
def check_model_doc(overwrite=False):
155+
with open(PATH_TO_TOC, encoding="utf-8") as f:
156+
content = yaml.safe_load(f.read())
157+
158+
# Get to the API doc
159+
api_idx = 0
160+
while content[api_idx]["title"] != "API":
161+
api_idx += 1
162+
api_doc = content[api_idx]["sections"]
163+
164+
# Then to the model doc
165+
model_idx = 0
166+
while api_doc[model_idx]["title"] != "Models":
167+
model_idx += 1
168+
169+
diff = False
170+
model_docs = api_doc[model_idx]["sections"]
171+
new_model_docs = []
172+
173+
# sort sub model docs
174+
for model_doc in model_docs:
175+
if "sections" in model_doc:
176+
sub_model_doc = model_doc["sections"]
177+
new_sub_model_doc = clean_doc_toc(sub_model_doc)
178+
if new_sub_model_doc != sub_model_doc:
179+
diff = True
180+
if overwrite:
181+
model_doc["sections"] = new_sub_model_doc
182+
new_model_docs.append(model_doc)
183+
184+
# sort overall model doc
185+
new_model_docs = clean_doc_toc(new_model_docs)
186+
187+
if new_model_docs != model_docs:
188+
diff = True
189+
if overwrite:
190+
api_doc[model_idx]["sections"] = new_model_docs
191+
192+
if diff:
193+
if overwrite:
194+
content[api_idx]["sections"] = api_doc
195+
with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
196+
f.write(yaml.dump(content, allow_unicode=True))
197+
else:
198+
raise ValueError(
199+
"The model doc part of the table of content is not properly sorted, run `make style` to fix this."
200+
)
201+
202+
152203
if __name__ == "__main__":
153204
parser = argparse.ArgumentParser()
154205
parser.add_argument("--fix_and_overwrite", action="store_true", help="Whether to fix inconsistencies.")
155206
args = parser.parse_args()
156207

157208
check_scheduler_doc(args.fix_and_overwrite)
158209
check_pipeline_doc(args.fix_and_overwrite)
210+
check_model_doc(args.fix_and_overwrite)

0 commit comments

Comments
 (0)