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

Little inefficiencies in "sgm/util.py" code #4

Open
Madhav-MKNC opened this issue Jun 24, 2023 · 0 comments
Open

Little inefficiencies in "sgm/util.py" code #4

Madhav-MKNC opened this issue Jun 24, 2023 · 0 comments

Comments

@Madhav-MKNC
Copy link

There are a few parts in the code that are a little inefficient or unnecessary:

  1. Unnecessary Conversion: In the log_txt_as_img function, txts is converted to a NumPy array and then immediately converted to a Torch tensor. This conversion can be skipped, and txts can be directly returned as a NumPy array.

  2. Inefficient Loop: In the log_txt_as_img function, the loop that creates the txt images can be optimized. Instead of creating a new txt image in each iteration, the loop can be simplified by creating a single txt image and then modifying it for each caption.

I am also submitting a PR with these necessary changes.

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

No branches or pull requests

1 participant