Split model list on modality (#18328)

* 📝 split up model list

* Adapt script to reorg

* apply niels feedback

Co-authored-by: Sylvain Gugger <Sylvain.gugger@gmail.com>
This commit is contained in:
Steven Liu 2022-08-01 09:10:20 -07:00 committed by GitHub
parent 01db72abd4
commit 151a2aaa4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 307 additions and 282 deletions

View File

@ -164,286 +164,301 @@
title: Feature Extractor title: Feature Extractor
title: Main Classes title: Main Classes
- sections: - sections:
- local: model_doc/albert
title: ALBERT
- local: model_doc/auto - local: model_doc/auto
title: Auto Classes title: Auto Classes
- local: model_doc/bart - isExpanded: false
title: BART sections:
- local: model_doc/barthez - local: model_doc/albert
title: BARThez title: ALBERT
- local: model_doc/bartpho - local: model_doc/bart
title: BARTpho title: BART
- local: model_doc/beit - local: model_doc/barthez
title: BEiT title: BARThez
- local: model_doc/bert - local: model_doc/bartpho
title: BERT title: BARTpho
- local: model_doc/bert-generation - local: model_doc/bert
title: BertGeneration title: BERT
- local: model_doc/bert-japanese - local: model_doc/bert-generation
title: BertJapanese title: BertGeneration
- local: model_doc/bertweet - local: model_doc/bert-japanese
title: Bertweet title: BertJapanese
- local: model_doc/big_bird - local: model_doc/bertweet
title: BigBird title: Bertweet
- local: model_doc/bigbird_pegasus - local: model_doc/big_bird
title: BigBirdPegasus title: BigBird
- local: model_doc/blenderbot - local: model_doc/bigbird_pegasus
title: Blenderbot title: BigBirdPegasus
- local: model_doc/blenderbot-small - local: model_doc/blenderbot
title: Blenderbot Small title: Blenderbot
- local: model_doc/bloom - local: model_doc/blenderbot-small
title: BLOOM title: Blenderbot Small
- local: model_doc/bort - local: model_doc/bloom
title: BORT title: BLOOM
- local: model_doc/byt5 - local: model_doc/bort
title: ByT5 title: BORT
- local: model_doc/camembert - local: model_doc/byt5
title: CamemBERT title: ByT5
- local: model_doc/canine - local: model_doc/camembert
title: CANINE title: CamemBERT
- local: model_doc/clip - local: model_doc/canine
title: CLIP title: CANINE
- local: model_doc/codegen - local: model_doc/codegen
title: CodeGen title: CodeGen
- local: model_doc/convbert - local: model_doc/convbert
title: ConvBERT title: ConvBERT
- local: model_doc/convnext - local: model_doc/cpm
title: ConvNeXT title: CPM
- local: model_doc/cpm - local: model_doc/ctrl
title: CPM title: CTRL
- local: model_doc/ctrl - local: model_doc/deberta
title: CTRL title: DeBERTa
- local: model_doc/cvt - local: model_doc/deberta-v2
title: CvT title: DeBERTa-v2
- local: model_doc/data2vec - local: model_doc/dialogpt
title: Data2Vec title: DialoGPT
- local: model_doc/deberta - local: model_doc/distilbert
title: DeBERTa title: DistilBERT
- local: model_doc/deberta-v2 - local: model_doc/dpr
title: DeBERTa-v2 title: DPR
- local: model_doc/decision_transformer - local: model_doc/electra
title: Decision Transformer title: ELECTRA
- local: model_doc/deit - local: model_doc/encoder-decoder
title: DeiT title: Encoder Decoder Models
- local: model_doc/detr - local: model_doc/flaubert
title: DETR title: FlauBERT
- local: model_doc/dialogpt - local: model_doc/fnet
title: DialoGPT title: FNet
- local: model_doc/distilbert - local: model_doc/fsmt
title: DistilBERT title: FSMT
- local: model_doc/dit - local: model_doc/funnel
title: DiT title: Funnel Transformer
- local: model_doc/dpr - local: model_doc/openai-gpt
title: DPR title: GPT
- local: model_doc/dpt - local: model_doc/gpt_neo
title: DPT title: GPT Neo
- local: model_doc/electra - local: model_doc/gpt_neox
title: ELECTRA title: GPT NeoX
- local: model_doc/encoder-decoder - local: model_doc/gptj
title: Encoder Decoder Models title: GPT-J
- local: model_doc/flaubert - local: model_doc/gpt2
title: FlauBERT title: GPT2
- local: model_doc/flava - local: model_doc/herbert
title: FLAVA title: HerBERT
- local: model_doc/fnet - local: model_doc/ibert
title: FNet title: I-BERT
- local: model_doc/fsmt - local: model_doc/layoutlm
title: FSMT title: LayoutLM
- local: model_doc/funnel - local: model_doc/led
title: Funnel Transformer title: LED
- local: model_doc/glpn - local: model_doc/longformer
title: GLPN title: Longformer
- local: model_doc/openai-gpt - local: model_doc/longt5
title: GPT title: LongT5
- local: model_doc/gpt_neo - local: model_doc/luke
title: GPT Neo title: LUKE
- local: model_doc/gpt_neox - local: model_doc/lxmert
title: GPT NeoX title: LXMERT
- local: model_doc/gptj - local: model_doc/m2m_100
title: GPT-J title: M2M100
- local: model_doc/gpt2 - local: model_doc/marian
title: GPT2 title: MarianMT
- local: model_doc/groupvit - local: model_doc/mbart
title: GroupViT title: MBart and MBart-50
- local: model_doc/herbert - local: model_doc/megatron-bert
title: HerBERT title: MegatronBERT
- local: model_doc/hubert - local: model_doc/megatron_gpt2
title: Hubert title: MegatronGPT2
- local: model_doc/ibert - local: model_doc/mluke
title: I-BERT title: mLUKE
- local: model_doc/imagegpt - local: model_doc/mobilebert
title: ImageGPT title: MobileBERT
- local: model_doc/layoutlm - local: model_doc/mpnet
title: LayoutLM title: MPNet
- local: model_doc/layoutlmv2 - local: model_doc/mt5
title: LayoutLMV2 title: MT5
- local: model_doc/layoutlmv3 - local: model_doc/mvp
title: LayoutLMV3 title: MVP
- local: model_doc/layoutxlm - local: model_doc/nezha
title: LayoutXLM title: NEZHA
- local: model_doc/led - local: model_doc/nllb
title: LED title: NLLB
- local: model_doc/levit - local: model_doc/nystromformer
title: LeViT title: Nyströmformer
- local: model_doc/longformer - local: model_doc/opt
title: Longformer title: OPT
- local: model_doc/longt5 - local: model_doc/pegasus
title: LongT5 title: Pegasus
- local: model_doc/luke - local: model_doc/phobert
title: LUKE title: PhoBERT
- local: model_doc/lxmert - local: model_doc/plbart
title: LXMERT title: PLBart
- local: model_doc/m2m_100 - local: model_doc/prophetnet
title: M2M100 title: ProphetNet
- local: model_doc/marian - local: model_doc/qdqbert
title: MarianMT title: QDQBert
- local: model_doc/maskformer - local: model_doc/rag
title: MaskFormer title: RAG
- local: model_doc/mbart - local: model_doc/realm
title: MBart and MBart-50 title: REALM
- local: model_doc/mctct - local: model_doc/reformer
title: MCTCT title: Reformer
- local: model_doc/megatron-bert - local: model_doc/rembert
title: MegatronBERT title: RemBERT
- local: model_doc/megatron_gpt2 - local: model_doc/retribert
title: MegatronGPT2 title: RetriBERT
- local: model_doc/mluke - local: model_doc/roberta
title: mLUKE title: RoBERTa
- local: model_doc/mobilebert - local: model_doc/roformer
title: MobileBERT title: RoFormer
- local: model_doc/mobilevit - local: model_doc/splinter
title: MobileViT title: Splinter
- local: model_doc/mpnet - local: model_doc/squeezebert
title: MPNet title: SqueezeBERT
- local: model_doc/mt5 - local: model_doc/t5
title: MT5 title: T5
- local: model_doc/mvp - local: model_doc/t5v1.1
title: MVP title: T5v1.1
- local: model_doc/nezha - local: model_doc/tapas
title: NEZHA title: TAPAS
- local: model_doc/nllb - local: model_doc/tapex
title: NLLB title: TAPEX
- local: model_doc/nystromformer - local: model_doc/transfo-xl
title: Nyströmformer title: Transformer XL
- local: model_doc/opt - local: model_doc/ul2
title: OPT title: UL2
- local: model_doc/owlvit - local: model_doc/xglm
title: OWL-ViT title: XGLM
- local: model_doc/pegasus - local: model_doc/xlm
title: Pegasus title: XLM
- local: model_doc/perceiver - local: model_doc/xlm-prophetnet
title: Perceiver title: XLM-ProphetNet
- local: model_doc/phobert - local: model_doc/xlm-roberta
title: PhoBERT title: XLM-RoBERTa
- local: model_doc/plbart - local: model_doc/xlm-roberta-xl
title: PLBart title: XLM-RoBERTa-XL
- local: model_doc/poolformer - local: model_doc/xlnet
title: PoolFormer title: XLNet
- local: model_doc/prophetnet - local: model_doc/yoso
title: ProphetNet title: YOSO
- local: model_doc/qdqbert title: Text models
title: QDQBert - isExpanded: false
- local: model_doc/rag sections:
title: RAG - local: model_doc/beit
- local: model_doc/realm title: BEiT
title: REALM - local: model_doc/convnext
- local: model_doc/reformer title: ConvNeXT
title: Reformer - local: model_doc/cvt
- local: model_doc/regnet title: CvT
title: RegNet - local: model_doc/deit
- local: model_doc/rembert title: DeiT
title: RemBERT - local: model_doc/detr
- local: model_doc/resnet title: DETR
title: ResNet - local: model_doc/dit
- local: model_doc/retribert title: DiT
title: RetriBERT - local: model_doc/dpt
- local: model_doc/roberta title: DPT
title: RoBERTa - local: model_doc/glpn
- local: model_doc/roformer title: GLPN
title: RoFormer - local: model_doc/groupvit
- local: model_doc/segformer title: GroupViT
title: SegFormer - local: model_doc/imagegpt
- local: model_doc/sew title: ImageGPT
title: SEW - local: model_doc/levit
- local: model_doc/sew-d title: LeViT
title: SEW-D - local: model_doc/maskformer
- local: model_doc/speech-encoder-decoder title: MaskFormer
title: Speech Encoder Decoder Models - local: model_doc/mobilevit
- local: model_doc/speech_to_text title: MobileViT
title: Speech2Text - local: model_doc/owlvit
- local: model_doc/speech_to_text_2 title: OWL-ViT
title: Speech2Text2 - local: model_doc/poolformer
- local: model_doc/splinter title: PoolFormer
title: Splinter - local: model_doc/regnet
- local: model_doc/squeezebert title: RegNet
title: SqueezeBERT - local: model_doc/resnet
- local: model_doc/swin title: ResNet
title: Swin Transformer - local: model_doc/segformer
- local: model_doc/swinv2 title: SegFormer
title: Swin Transformer V2 - local: model_doc/swin
- local: model_doc/t5 title: Swin Transformer
title: T5 - local: model_doc/swinv2
- local: model_doc/t5v1.1 title: Swin Transformer V2
title: T5v1.1 - local: model_doc/van
- local: model_doc/tapas title: VAN
title: TAPAS - local: model_doc/vit
- local: model_doc/tapex title: Vision Transformer (ViT)
title: TAPEX - local: model_doc/vit_mae
- local: model_doc/trajectory_transformer title: ViTMAE
title: Trajectory Transformer - local: model_doc/yolos
- local: model_doc/transfo-xl title: YOLOS
title: Transformer XL title: Vision models
- local: model_doc/trocr - isExpanded: false
title: TrOCR sections:
- local: model_doc/ul2 - local: model_doc/hubert
title: UL2 title: Hubert
- local: model_doc/unispeech - local: model_doc/mctct
title: UniSpeech title: MCTCT
- local: model_doc/unispeech-sat - local: model_doc/sew
title: UniSpeech-SAT title: SEW
- local: model_doc/van - local: model_doc/sew-d
title: VAN title: SEW-D
- local: model_doc/vilt - local: model_doc/speech_to_text
title: ViLT title: Speech2Text
- local: model_doc/vision-encoder-decoder - local: model_doc/speech_to_text_2
title: Vision Encoder Decoder Models title: Speech2Text2
- local: model_doc/vision-text-dual-encoder - local: model_doc/unispeech
title: Vision Text Dual Encoder title: UniSpeech
- local: model_doc/vit - local: model_doc/unispeech-sat
title: Vision Transformer (ViT) title: UniSpeech-SAT
- local: model_doc/visual_bert - local: model_doc/wav2vec2
title: VisualBERT title: Wav2Vec2
- local: model_doc/vit_mae - local: model_doc/wav2vec2-conformer
title: ViTMAE title: Wav2Vec2-Conformer
- local: model_doc/wav2vec2 - local: model_doc/wav2vec2_phoneme
title: Wav2Vec2 title: Wav2Vec2Phoneme
- local: model_doc/wav2vec2-conformer - local: model_doc/wavlm
title: Wav2Vec2-Conformer title: WavLM
- local: model_doc/wav2vec2_phoneme - local: model_doc/xls_r
title: Wav2Vec2Phoneme title: XLS-R
- local: model_doc/wavlm - local: model_doc/xlsr_wav2vec2
title: WavLM title: XLSR-Wav2Vec2
- local: model_doc/xglm title: Audio models
title: XGLM - isExpanded: false
- local: model_doc/xlm sections:
title: XLM - local: model_doc/clip
- local: model_doc/xlm-prophetnet title: CLIP
title: XLM-ProphetNet - local: model_doc/data2vec
- local: model_doc/xlm-roberta title: Data2Vec
title: XLM-RoBERTa - local: model_doc/flava
- local: model_doc/xlm-roberta-xl title: FLAVA
title: XLM-RoBERTa-XL - local: model_doc/layoutlmv2
- local: model_doc/xlnet title: LayoutLMV2
title: XLNet - local: model_doc/layoutlmv3
- local: model_doc/xls_r title: LayoutLMV3
title: XLS-R - local: model_doc/layoutxlm
- local: model_doc/xlsr_wav2vec2 title: LayoutXLM
title: XLSR-Wav2Vec2 - local: model_doc/perceiver
- local: model_doc/yolos title: Perceiver
title: YOLOS - local: model_doc/speech-encoder-decoder
- local: model_doc/yoso title: Speech Encoder Decoder Models
title: YOSO - local: model_doc/trocr
title: TrOCR
- local: model_doc/vilt
title: ViLT
- local: model_doc/vision-encoder-decoder
title: Vision Encoder Decoder Models
- local: model_doc/vision-text-dual-encoder
title: Vision Text Dual Encoder
- local: model_doc/visual_bert
title: VisualBERT
title: Multimodal models
- isExpanded: false
sections:
- local: model_doc/decision_transformer
title: Decision Transformer
- local: model_doc/trajectory_transformer
title: Trajectory Transformer
title: Reinforcement learning models
title: Models title: Models
- sections: - sections:
- local: internal/modeling_utils - local: internal/modeling_utils

View File

@ -65,12 +65,22 @@ def check_model_doc(overwrite=False):
while api_doc[model_idx]["title"] != "Models": while api_doc[model_idx]["title"] != "Models":
model_idx += 1 model_idx += 1
old_model_doc = api_doc[model_idx]["sections"] model_doc = api_doc[model_idx]["sections"]
new_model_doc = clean_model_doc_toc(old_model_doc)
if old_model_doc != new_model_doc: modalities_docs = [(idx, section) for idx, section in enumerate(model_doc) if "sections" in section]
diff = False
for idx, modality_doc in modalities_docs:
old_modality_doc = modality_doc["sections"]
new_modality_doc = clean_model_doc_toc(old_modality_doc)
if old_modality_doc != new_modality_doc:
diff = True
if overwrite:
model_doc[idx]["sections"] = new_modality_doc
if diff:
if overwrite: if overwrite:
api_doc[model_idx]["sections"] = new_model_doc api_doc[model_idx]["sections"] = model_doc
content[api_idx]["sections"] = api_doc content[api_idx]["sections"] = api_doc
with open(PATH_TO_TOC, "w", encoding="utf-8") as f: with open(PATH_TO_TOC, "w", encoding="utf-8") as f:
f.write(yaml.dump(content, allow_unicode=True)) f.write(yaml.dump(content, allow_unicode=True))