Skip to content
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

Accelerator Fix and Local Image Load Support #10

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eren23
Copy link

@eren23 eren23 commented Jul 16, 2023

Referring to issue #5

@@ -1075,7 +1081,8 @@ def collate_fn(examples):
pipeline.set_progress_bar_config(disable=True)

# run inference
original_image = download_image(args.val_image_url)
# original_image = download_image(args.val_image_url)
original_image = open_image(args.val_image_url)
Copy link
Member

Choose a reason for hiding this comment

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

This won't work if you pass an image URL. It will only work if you pass an image file path that is local in nature.

Copy link
Author

@eren23 eren23 Jul 19, 2023

Choose a reason for hiding this comment

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

Pushing a change for this one to accept both a URL or a local file path

Comment on lines +438 to +442
if source.startswith('http'):
# Download image from URL
response = requests.get(source, stream=True)
response.raise_for_status()
image = PIL.Image.open(response.raw)
Copy link
Member

Choose a reason for hiding this comment

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

We can simply use load_image() from diffusers.utils for this.

@@ -1075,7 +1082,7 @@ def collate_fn(examples):
pipeline.set_progress_bar_config(disable=True)

# run inference
original_image = download_image(args.val_image_url)
load_image(args.val_image_url)
Copy link
Member

Choose a reason for hiding this comment

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

load_image() doesn't return anything and is neither a closure inside main() so, I am sure about the effectivity of this.

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