[diffusion] fix gen video doc#14409
Conversation
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
|
|
||
| ```python | ||
| from sglang.multimodal_gen import DiffGenerator | ||
| from sglang.multimodal_gen import DiffGenerator, SamplingParams |
There was a problem hiding this comment.
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.
| from sglang.multimodal_gen import DiffGenerator, SamplingParams | |
| from sglang.multimodal_gen import DiffGenerator |
| 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__ |
There was a problem hiding this comment.
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.
| 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, | |
| } |
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com> Co-authored-by: Mick <mickjagger19@icloud.com>
Motivation
The current doc is broken.
Modifications
Use
SamplingParamsto send parameters togenerator.generate.Accuracy Tests
Run the python script to generate video (on MTGPU) without problems.
Benchmarking and Profiling
Checklist