Skip to content

[diffusion] fix gen video doc#14409

Merged
mickqian merged 3 commits intosgl-project:mainfrom
yeahdongcn:xd/fix_diffusion_doc
Dec 4, 2025
Merged

[diffusion] fix gen video doc#14409
mickqian merged 3 commits intosgl-project:mainfrom
yeahdongcn:xd/fix_diffusion_doc

Conversation

@yeahdongcn
Copy link
Copy Markdown
Collaborator

Motivation

The current doc is broken.

Modifications

Use SamplingParams to send parameters to generator.generate.

Accuracy Tests

Run the python script to generate video (on MTGPU) without problems.

Benchmarking and Profiling

Checklist

Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation diffusion SGLang Diffusion labels Dec 4, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @yeahdongcn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where the video generation example in the documentation was broken. The fix involves updating the example code to correctly use the SamplingParams object when invoking the generator.generate method. This ensures that the documentation provides accurate and functional code snippets for users, improving the overall usability and reliability of the multimodal generation features.

Highlights

  • Documentation Fix: Corrected the example code in python/sglang/multimodal_gen/README.md to properly generate videos, addressing a previously broken documentation example.
  • API Usage Update: Updated the generator.generate call within the example to utilize SamplingParams for passing generation parameters, aligning with the intended API and ensuring functional code.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a broken code example in the documentation for video generation. The change correctly updates the API call to generator.generate. My review includes suggestions to further simplify this example for better clarity by using a dictionary literal for parameters, which also removes the need for an extra import, making the example more direct and easier for new users to understand.

Comment thread python/sglang/multimodal_gen/README.md Outdated

```python
from sglang.multimodal_gen import DiffGenerator
from sglang.multimodal_gen import DiffGenerator, SamplingParams
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To make the example as minimal and clear as possible, you could remove the import of SamplingParams. As my other comment suggests, using a dictionary literal for the parameters in the generate call would make this import unnecessary.

Suggested change
from sglang.multimodal_gen import DiffGenerator, SamplingParams
from sglang.multimodal_gen import DiffGenerator

Comment thread python/sglang/multimodal_gen/README.md Outdated
Comment on lines +45 to +50
sampling_params_kwargs=SamplingParams(
prompt=prompt,
return_frames=True, # Also return frames from this call (defaults to False)
output_path="my_videos/", # Controls where videos are saved
save_output=True
).__dict__
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For a minimal example, it would be clearer to pass a dictionary literal directly to sampling_params_kwargs. This approach avoids exposing users to the SamplingParams class and the .__dict__ attribute, which can be seen as an implementation detail. A direct dictionary is more idiomatic given the function signature and simplifies the code for new users.

Suggested change
sampling_params_kwargs=SamplingParams(
prompt=prompt,
return_frames=True, # Also return frames from this call (defaults to False)
output_path="my_videos/", # Controls where videos are saved
save_output=True
).__dict__
sampling_params_kwargs={
"prompt": prompt,
"return_frames": True, # Also return frames from this call (defaults to False)
"output_path": "my_videos/", # Controls where videos are saved
"save_output": True,
}

@mickqian mickqian merged commit 079ac23 into sgl-project:main Dec 4, 2025
17 of 19 checks passed
yingluosanqian pushed a commit to yingluosanqian/sglang that referenced this pull request Dec 4, 2025
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
yuchengz816-bot pushed a commit to yuchengz816-bot/sglang that referenced this pull request Dec 8, 2025
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
Kevin-XiongC pushed a commit to novitalabs/sglang that referenced this pull request Dec 9, 2025
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
YChange01 pushed a commit to YChange01/sglang that referenced this pull request Jan 13, 2026
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Co-authored-by: Mick <mickjagger19@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants