Refactor target_fps handling in TorchrunInferenceWorker#580
Refactor target_fps handling in TorchrunInferenceWorker#580helloyongyang merged 1 commit intomainfrom
Conversation
Summary of ChangesHello @GACLove, 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 refactors the handling of 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 refactors the handling of target_fps in TorchrunInferenceWorker. The changes make the code more concise by using pop and improve diagnostics by adding a warning when target_fps is provided without a video_frame_interpolation configuration. However, I've identified a potential bug in the new logic. The check for the existence of video_frame_interpolation configuration can fail if it's an empty dictionary, which would be a regression from the previous behavior. My review includes a suggestion to fix this.
| if vfi_cfg: | ||
| task_data["video_frame_interpolation"] = {**vfi_cfg, "target_fps": target_fps} | ||
| else: | ||
| logger.warning(f"Target FPS {target_fps} is set, but video frame interpolation is not configured") |
There was a problem hiding this comment.
The check if vfi_cfg: will evaluate to False if video_frame_interpolation is configured as an empty dictionary ({}). In this scenario, the code will incorrectly log a warning and fail to set the target_fps, which is likely not the intended behavior. The previous implementation handled this case correctly by checking for key existence. To fix this and align with the probable intent, you should check if vfi_cfg is not None instead of checking for its truthiness.
| if vfi_cfg: | |
| task_data["video_frame_interpolation"] = {**vfi_cfg, "target_fps": target_fps} | |
| else: | |
| logger.warning(f"Target FPS {target_fps} is set, but video frame interpolation is not configured") | |
| if vfi_cfg is not None: | |
| task_data["video_frame_interpolation"] = {**vfi_cfg, "target_fps": target_fps} | |
| else: | |
| logger.warning(f"Target FPS {target_fps} is set, but video frame interpolation is not configured") |
No description provided.