-
Notifications
You must be signed in to change notification settings - Fork 75
Feat: add enhancers algorithms #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
| """ | ||
| output = self.original_pipe_call(*args, **kwargs) | ||
| enhanced_images = [] | ||
| for image in output.images: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing null check before accessing output images
In UpscaleHelper._wrapped_pipe_call, output.images is accessed directly without checking if output is None or has an images attribute. This contrasts with DenoiseHelper._wrapped_pipe_call in denoise.py, which properly guards with if output is None or not hasattr(output, "images") or not output.images: before accessing the images. If the pipeline returns an unexpected output (e.g., None or an object without images), this will raise an AttributeError or TypeError at runtime.
| tile_pad=smash_config["tile_pad"], | ||
| pre_pad=smash_config["pre_pad"], | ||
| half=not smash_config["fp32"], | ||
| gpu_id=0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Hardcoded GPU device ignores CPU and multi-GPU configuration
The RealESRGANer is instantiated with gpu_id=0 hardcoded, but the class declares runs_on: list[str] = ["cpu", "cuda", "accelerate"], claiming CPU and multi-GPU support. This means the algorithm will always attempt to use GPU 0 regardless of smash_config.device, potentially failing when the user configures CPU mode (which requires gpu_id=None) or a different GPU. This contrasts with denoise.py which properly uses .to(smash_config.device) to respect the device configuration.
Additional Locations (1)
4d6f3d2 to
c272862
Compare
Description
The enhancer algorithms
realesrgan_upscaleandimg2img_denoisewere added to Pruna.The
realesrgan_upscalealgorithm is in filesrc/pruna/algorithms/denoise.pyand tests are intests/algorithms/testers/upscale.py.The
img2img_denoisealgorithm is in filesrc/pruna/algorithms/denoise.pyand tests are intests/algorithms/testers/denoise.pyType of Change
How Has This Been Tested?
The tests in the algorithms' respective test files have passed.
Checklist