Skip to content

support wan2.5 i2i#66

Merged
kevinlin09 merged 1 commit intodashscope:mainfrom
mose-x:support_wan2.5_i2i
Oct 21, 2025
Merged

support wan2.5 i2i#66
kevinlin09 merged 1 commit intodashscope:mainfrom
mose-x:support_wan2.5_i2i

Conversation

@mose-zm
Copy link
Copy Markdown
Contributor

@mose-zm mose-zm commented Oct 21, 2025

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @mose-zm, 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 enhances the image synthesis capabilities by improving the handling of input images and refining the logic for determining the task type. It introduces more robust processing for multiple input images, including local file uploads, and adds explicit support for the "wan2.5-i2i" model to correctly identify image-to-image tasks.

Highlights

  • Enhanced Image Input Processing: The _get_input method now robustly handles lists of input images, iterating through each to check for local files and uploading them as necessary before assigning them to the IMAGES input.
  • Refactored Task Determination: A new private helper function, __get_i2i_task, has been introduced to centralize and clarify the logic for determining the image synthesis task type.
  • Support for wan2.5 i2i Model: The task determination logic now explicitly recognizes models containing "wan2.5-i2i" as 'image2image' tasks, improving compatibility and specificity for this model.
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

@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 adds support for the wan2.5-i2i model in image synthesis. The changes correctly handle local image file uploads for the images parameter and refactor the logic for determining the task type based on the model name. My review includes suggestions to improve code conciseness and maintainability by simplifying a conditional check and inlining a single-use helper function, which also addresses an inconsistency in comment language.

inputs[NEGATIVE_PROMPT] = negative_prompt
if images is not None:
inputs[IMAGES] = images
if images is not None and images and len(images) > 0:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The condition to check if images is a non-empty list is redundant. In Python, you can simply use if images:, which evaluates to True for non-empty lists and False for None or empty lists. This is more idiomatic and readable.

Suggested change
if images is not None and images and len(images) > 0:
if images:

Comment on lines +188 to +201
def __get_i2i_task(task, model) -> str:
# 处理task参数:优先使用有效的task值
if task is not None and task != "":
return task

# 根据model确定任务类型
if model is not None and model != "":
if 'imageedit' in model or "wan2.5-i2i" in model:
return 'image2image'

# 默认返回文本到图像任务
return ImageSynthesis.task

task = __get_i2i_task(task, model)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This nested function __get_i2i_task is defined and then called only once, which adds unnecessary complexity. The logic can be inlined for better readability.

A few other points:

  • The double underscore prefix __ is typically used for name mangling in classes and is not needed for a local helper function. A single underscore _ would be more appropriate if the function were kept.
  • The comments are in Chinese, which is inconsistent with the rest of the file's English comments. It's best to maintain a single language for comments within a file.

I suggest replacing the function definition and call with the equivalent inlined logic.

Suggested change
def __get_i2i_task(task, model) -> str:
# 处理task参数:优先使用有效的task值
if task is not None and task != "":
return task
# 根据model确定任务类型
if model is not None and model != "":
if 'imageedit' in model or "wan2.5-i2i" in model:
return 'image2image'
# 默认返回文本到图像任务
return ImageSynthesis.task
task = __get_i2i_task(task, model)
if not task:
if model and ('imageedit' in model or 'wan2.5-i2i' in model):
task = 'image2image'
else:
task = ImageSynthesis.task

@kevinlin09 kevinlin09 merged commit b29d2a0 into dashscope:main Oct 21, 2025
@mose-zm mose-zm deleted the support_wan2.5_i2i branch December 16, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants