Repository navigation
fix: bound the image fetch in the TRT-LLM preprocessing template - #129
Merged
Merged
Conversation
|
Comment on lines
+781
to
+788
| # Read one byte past the limit so that an oversized response is | ||
| # rejected rather than silently truncated. | ||
| image_data = response.raw.read(self.IMAGE_FETCH_MAX_BYTES + 1, | ||
| decode_content=True) | ||
| if len(image_data) > self.IMAGE_FETCH_MAX_BYTES: | ||
| raise ValueError( | ||
| f"[TensorRT-LLM][ERROR] Image at {img_url} exceeds the " | ||
| f"{self.IMAGE_FETCH_MAX_BYTES} byte limit.") |
There was a problem hiding this comment.
When one request in a dynamic batch receives an HTTP error, exceeds the size limit, or times out, these new exceptions escape the unguarded per-request loop and abort the entire execute invocation, causing otherwise valid requests in the same batch to fail. Convert fetch failures into an error response for only the offending request.
Knowledge Base Used: TensorRT-LLM model pipeline templates
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
whoisj
approved these changes
Sep 14, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the PR do?
Bounds the remote image fetch in the TRT-LLM preprocessing template.
load_images_from_urlsfetched a request-supplied URL with no timeout, no size limit, and no status check. Adds an inactivity timeout, a total transfer deadline, and a max response size, and raises on HTTP errors instead of passing an error page to PIL. The inline base64 branch is unchanged.Checklist
<commit_type>: <Title>Commit Type:
Related PRs:
Test plan:
Ran this example locally after the updates