-
Notifications
You must be signed in to change notification settings - Fork 152
Return the Tensor when input_info.return_result_tensor is true #776
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -378,15 +378,16 @@ def run_pipeline(self, input_info): | |||||
| images = self.run_vae_decoder(latents) | ||||||
| self.end_run() | ||||||
|
|
||||||
| if isinstance(images[0], list) and len(images[0]) > 1: | ||||||
| image_prefix = f"{input_info.save_result_path}".split(".")[0] | ||||||
| for idx, image in enumerate(images[0]): | ||||||
| image.save(f"{image_prefix}_{idx}.png") | ||||||
| logger.info(f"Image saved: {image_prefix}_{idx}.png") | ||||||
| else: | ||||||
| image = images[0] | ||||||
| image.save(f"{input_info.save_result_path}") | ||||||
| logger.info(f"Image saved: {input_info.save_result_path}") | ||||||
| if not input_info.return_result_tensor: | ||||||
| if isinstance(images[0], list) and len(images[0]) > 1: | ||||||
| image_prefix = f"{input_info.save_result_path}".split(".")[0] | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using A more robust way would be to use
Suggested change
|
||||||
| for idx, image in enumerate(images[0]): | ||||||
| image.save(f"{image_prefix}_{idx}.png") | ||||||
| logger.info(f"Image saved: {image_prefix}_{idx}.png") | ||||||
| else: | ||||||
| image = images[0] | ||||||
| image.save(f"{input_info.save_result_path}") | ||||||
| logger.info(f"Image saved: {input_info.save_result_path}") | ||||||
|
|
||||||
| del latents, generator | ||||||
| torch_device_module.empty_cache() | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,9 +342,10 @@ def run_pipeline(self, input_info): | |
| images = self.run_vae_decoder(latents) | ||
| self.end_run() | ||
|
|
||
| image = images[0] | ||
| image.save(f"{input_info.save_result_path}") | ||
| logger.info(f"Image saved: {input_info.save_result_path}") | ||
| if not input_info.return_result_tensor: | ||
| image = images[0] | ||
| image.save(f"{input_info.save_result_path}") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| logger.info(f"Image saved: {input_info.save_result_path}") | ||
|
|
||
| del latents, generator | ||
| torch_device_module.empty_cache() | ||
|
|
||
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.
The f-string formatting is redundant here as
input_info.save_result_pathis already a string. You can pass the variable directly toimage.savefor cleaner code.