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

Regression in handling of images larger than around 1MB #1097

Closed
AlexandreBouffard opened this issue Feb 5, 2025 · 11 comments
Closed

Regression in handling of images larger than around 1MB #1097

AlexandreBouffard opened this issue Feb 5, 2025 · 11 comments

Comments

@AlexandreBouffard
Copy link

I have a script that iterates over images to perform an inline prompt using defImages().

  • Images smaller than around 1MB process as expected. Debugging shows that their content attribute is populated.
  • Images larger than around 1MB throw error Unsupported buffer-like object in resolveBufferLike(). Debugging shows that their content attribute is missing.

This script was working fine a few days/weeks ago, with same input files.

@pelikhan
Copy link
Member

pelikhan commented Feb 5, 2025

Looking

@pelikhan
Copy link
Member

pelikhan commented Feb 5, 2025

I may have broken things when working with my 2gb videos.

@pelikhan
Copy link
Member

pelikhan commented Feb 5, 2025

Try 101.0

@AlexandreBouffard
Copy link
Author

Now working with 1.101.1.

However initializing env with files (in my case 30 images each between 500kB and 2MB), before first prompt is sent, takes around 7 minutes with node process at 100% of one CPU core. During that time, in the GenAIScript tab in VS Code, I see files appearing one by one every 15 seconds or so. I do not recall any preprocessing delay, maybe at most a few seconds, last time I ran this script with same input files.

@pelikhan
Copy link
Member

pelikhan commented Feb 6, 2025

Let me test this scenario.

@pelikhan
Copy link
Member

pelikhan commented Feb 6, 2025

do you use defImages(env.files) in your script?

@AlexandreBouffard
Copy link
Author

I do a for loop on env.files and use _.defImages(file) in the inline prompt, but without any prompt at all, just initializing env.files takes around 7 minutes.

For example with test folder containing 30 images each between 500kB and 2MB:

script({
  files: ["test/*"],
});

for (const file of env.files) {
}

@pelikhan
Copy link
Member

pelikhan commented Feb 6, 2025

Perfect thanks for the repro. I've started loading binary files and this might be the issue. Also it's possible that these images get processed by Jimp which can be slow as well. looking

@pelikhan
Copy link
Member

pelikhan commented Feb 6, 2025

Oopsies, we were tokenizing the binary data in the trace. Back to instantly fast (until it hits the resizing step)

@pelikhan
Copy link
Member

pelikhan commented Feb 6, 2025

@AlexandreBouffard try v1.101.2

@AlexandreBouffard
Copy link
Author

@pelikhan fixed!

@pelikhan pelikhan closed this as completed Feb 6, 2025
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

2 participants