Conversation
| """ | ||
| output = self.original_pipe_call(*args, **kwargs) | ||
| enhanced_images = [] | ||
| for image in output.images: |
There was a problem hiding this comment.
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.
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)
There was a problem hiding this comment.
can be ignored, checked the original codebase, and there if cuda is not available it defaults to cpu
4d6f3d2 to
c272862
Compare
|
This PR has been inactive for 10 days and is now marked as stale. |
johnrachwan123
left a comment
There was a problem hiding this comment.
Looks Good to me, the only thing I worry about is that basicsr and realesrgan are not super well maintained and could create some problems in the futures if they are in the toml file. Not sure what is the best way to handle this.
simlang
left a comment
There was a problem hiding this comment.
I have nothing much to add, thank you!
🚀🚀🚀🚀
| self.original_pipe_call = self.model.__call__ | ||
| self.strength = strength | ||
| # Store device for placing tensors if needed | ||
| self.device = getattr(model, "device", torch.device("cuda" if torch.cuda.is_available() else "cpu")) |
There was a problem hiding this comment.
there exists a get_device in the pruna utils, probably better to use this
| 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.
can be ignored, checked the original codebase, and there if cuda is not available it defaults to cpu
|
This PR has been inactive for 10 days and is now marked as stale. |
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