docs: keep shared task examples in navigation
Signed-off-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
1 parent
636d44e272
commit
13731101ab
3 files changed
+38
-14
No files matched your search
+4
-14
@@ -16,31 +16,21 @@ nav:
|
|||||||
- Examples:
|
- Examples:
|
||||||
- examples/README.md
|
- examples/README.md
|
||||||
- Offline Inference:
|
- Offline Inference:
|
||||||
- GLM-Image Multistage End-to-End Inference: user_guide/examples/offline_inference/glm_image.md
|
|
||||||
- HunyuanImage-3.0 Image-to-Text Inference: user_guide/examples/offline_inference/hunyuan_image3.md
|
|
||||||
- Image-To-Image: user_guide/examples/offline_inference/image_to_image.md
|
- Image-To-Image: user_guide/examples/offline_inference/image_to_image.md
|
||||||
- Image-To-Video: user_guide/examples/offline_inference/image_to_video.md
|
- Image-To-Video: user_guide/examples/offline_inference/image_to_video.md
|
||||||
- InternVLA-A1: user_guide/examples/offline_inference/internvla_a1.md
|
- Speech-To-Video: user_guide/examples/offline_inference/speech_to_video.md
|
||||||
- MiMo-Audio: user_guide/examples/offline_inference/mimo_audio.md
|
|
||||||
- Qwen2.5-Omni: user_guide/examples/offline_inference/qwen2_5_omni.md
|
|
||||||
- Qwen3-Omni: user_guide/examples/offline_inference/qwen3_omni.md
|
|
||||||
- Text-To-Audio: user_guide/examples/offline_inference/text_to_audio.md
|
- Text-To-Audio: user_guide/examples/offline_inference/text_to_audio.md
|
||||||
- Text-To-Image: user_guide/examples/offline_inference/text_to_image.md
|
- Text-To-Image: user_guide/examples/offline_inference/text_to_image.md
|
||||||
- Text-To-Speech: user_guide/examples/offline_inference/text_to_speech.md
|
- Text-To-Speech: user_guide/examples/offline_inference/text_to_speech.md
|
||||||
- Text-To-Video: user_guide/examples/offline_inference/text_to_video.md
|
- Text-To-Video: user_guide/examples/offline_inference/text_to_video.md
|
||||||
|
- X-To-Text: user_guide/examples/offline_inference/x_to_text.md
|
||||||
- X-To-Video-Audio: user_guide/examples/offline_inference/x_to_video_audio.md
|
- X-To-Video-Audio: user_guide/examples/offline_inference/x_to_video_audio.md
|
||||||
- Online Serving:
|
- Online Serving:
|
||||||
- BAGEL-7B-MoT: user_guide/examples/online_serving/bagel.md
|
|
||||||
- vLLM-Omni Helm Chart: user_guide/examples/online_serving/chart-helm.md
|
|
||||||
- Diffusers Backend Adapter: user_guide/examples/online_serving/diffusers_pipeline_adapter.md
|
|
||||||
- GLM-Image Online Serving: user_guide/examples/online_serving/glm_image.md
|
|
||||||
- Image-To-Image: user_guide/examples/online_serving/image_to_image.md
|
- Image-To-Image: user_guide/examples/online_serving/image_to_image.md
|
||||||
- Image-To-Video: user_guide/examples/online_serving/image_to_video.md
|
- Image-To-Video: user_guide/examples/online_serving/image_to_video.md
|
||||||
- MiMo-Audio: user_guide/examples/online_serving/mimo_audio.md
|
- Speech-To-Video: user_guide/examples/online_serving/speech_to_video.md
|
||||||
- Qwen2.5-Omni: user_guide/examples/online_serving/qwen2_5_omni.md
|
|
||||||
- Qwen3-Omni: user_guide/examples/online_serving/qwen3_omni.md
|
|
||||||
- Text-To-Speech: user_guide/examples/online_serving/text_to_speech.md
|
|
||||||
- Text-To-Image: user_guide/examples/online_serving/text_to_image.md
|
- Text-To-Image: user_guide/examples/online_serving/text_to_image.md
|
||||||
|
- Text-To-Speech: user_guide/examples/online_serving/text_to_speech.md
|
||||||
- Text-To-Video: user_guide/examples/online_serving/text_to_video.md
|
- Text-To-Video: user_guide/examples/online_serving/text_to_video.md
|
||||||
- General:
|
- General:
|
||||||
- usage/*
|
- usage/*
|
||||||
|
|||||||
@@ -24,6 +24,23 @@ SERVING_MODE_TITLES = {
|
|||||||
"online_serving": "Online serving",
|
"online_serving": "Online serving",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Keep the Examples navigation focused on reusable modality/task entry points.
|
||||||
|
# Model-specific scripts remain available under ``examples/`` and are surfaced
|
||||||
|
# from these shared pages instead of getting one page per model.
|
||||||
|
GENERAL_EXAMPLE_SLUGS = frozenset(
|
||||||
|
{
|
||||||
|
"image_to_image",
|
||||||
|
"image_to_video",
|
||||||
|
"speech_to_video",
|
||||||
|
"text_to_audio",
|
||||||
|
"text_to_image",
|
||||||
|
"text_to_speech",
|
||||||
|
"text_to_video",
|
||||||
|
"x_to_text",
|
||||||
|
"x_to_video_audio",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# Generated example pages keep their source-derived URLs even when their
|
# Generated example pages keep their source-derived URLs even when their
|
||||||
# navigation category changes. Quantization helpers are feature documentation,
|
# navigation category changes. Quantization helpers are feature documentation,
|
||||||
# not user-serving examples, so keep them under the existing Features /
|
# not user-serving examples, so keep them under the existing Features /
|
||||||
@@ -56,6 +73,13 @@ def load_model_display_names() -> dict[str, str]:
|
|||||||
MODEL_DISPLAY_NAMES = load_model_display_names()
|
MODEL_DISPLAY_NAMES = load_model_display_names()
|
||||||
|
|
||||||
|
|
||||||
|
def is_general_example(example: "Example") -> bool:
|
||||||
|
"""Return whether an example should get a generated serving page."""
|
||||||
|
if example.category not in SERVING_MODE_TITLES:
|
||||||
|
return True
|
||||||
|
return example.path.stem in GENERAL_EXAMPLE_SLUGS
|
||||||
|
|
||||||
|
|
||||||
def fix_case(text: str) -> str:
|
def fix_case(text: str) -> str:
|
||||||
subs = {
|
subs = {
|
||||||
"api": "API",
|
"api": "API",
|
||||||
@@ -432,6 +456,8 @@ def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool):
|
|||||||
for path in category.glob("*/*.md"):
|
for path in category.glob("*/*.md"):
|
||||||
examples.append(Example(path.parent, category.stem))
|
examples.append(Example(path.parent, category.stem))
|
||||||
|
|
||||||
|
examples = [example for example in examples if is_general_example(example)]
|
||||||
|
|
||||||
# Generate the example documentation
|
# Generate the example documentation
|
||||||
for example in sorted(examples, key=lambda e: e.path.stem):
|
for example in sorted(examples, key=lambda e: e.path.stem):
|
||||||
example_name = f"{example.path.stem}.md"
|
example_name = f"{example.path.stem}.md"
|
||||||
|
|||||||
@@ -47,6 +47,14 @@ def test_model_display_names_require_string_mapping(tmp_path, monkeypatch):
|
|||||||
generate_examples.load_model_display_names()
|
generate_examples.load_model_display_names()
|
||||||
|
|
||||||
|
|
||||||
|
def test_only_general_serving_examples_get_generated_pages():
|
||||||
|
general_example = SimpleNamespace(category="offline_inference", path=Path("text_to_image"))
|
||||||
|
model_example = SimpleNamespace(category="offline_inference", path=Path("qwen3_omni"))
|
||||||
|
|
||||||
|
assert generate_examples.is_general_example(general_example)
|
||||||
|
assert not generate_examples.is_general_example(model_example)
|
||||||
|
|
||||||
|
|
||||||
def test_quantization_examples_keep_source_urls_under_feature_navigation(tmp_path, monkeypatch):
|
def test_quantization_examples_keep_source_urls_under_feature_navigation(tmp_path, monkeypatch):
|
||||||
nav_file = tmp_path / "docs" / ".nav.yml"
|
nav_file = tmp_path / "docs" / ".nav.yml"
|
||||||
nav_file.parent.mkdir(parents=True)
|
nav_file.parent.mkdir(parents=True)
|
||||||
|
|||||||
Reference in new issue
Block a user