feat(image): add FireRed Image Edit 1.1 support - #5306
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for the "FireRed-Image-Edit-1.1" model by defining its specification and updating the stable diffusion core to load it via the DiffusionPipeline. It also updates the image_to_image method to apply default generation configurations and combine reference_images for QwenImageEditPlusPipeline. Feedback suggests addressing potential runtime errors: safely handling cases where self._model_spec is None to avoid an AttributeError, and ensuring reference_images is wrapped in a list if it is not already iterable to prevent a TypeError.
| generate_kwargs = ( # type: ignore | ||
| self._model_spec.default_generate_config or {} | ||
| ).copy() | ||
| generate_kwargs.update({k: v for k, v in kwargs.items() if v is not None}) | ||
| kwargs = generate_kwargs |
There was a problem hiding this comment.
The self._model_spec attribute is defined as Optional and can be None. Accessing self._model_spec.default_generate_config directly without a None check can lead to an AttributeError if the model is initialized without a spec. We should safely handle the case where self._model_spec is None.
default_config = (
self._model_spec.default_generate_config
if self._model_spec is not None
else None
) or {}
generate_kwargs = default_config.copy()
generate_kwargs.update({k: v for k, v in kwargs.items() if v is not None})
kwargs = generate_kwargs
No description provided.