Skip to content

feat: Sanitize logging for image modality#697

Merged
wprazuch merged 1 commit intomainfrom
wprazuch/fix-image-modality-debug-logging
Feb 5, 2026
Merged

feat: Sanitize logging for image modality#697
wprazuch merged 1 commit intomainfrom
wprazuch/fix-image-modality-debug-logging

Conversation

@wprazuch
Copy link
Contributor

@wprazuch wprazuch commented Feb 4, 2026

When running MMMU Pro, the logging from Caching Interceptor congests the stdout with base64 encoded strings of characters. This makes logging, and progress following of image-based harnesses impossible to investigate and track.

After this fix, the stdout is now clear and readable:

[I 2026-02-04T17:47:50.737] 127.0.0.1 - - [04/Feb/2026 17:47:50] "POST /chat/completions HTTP/1.1" 200 -
[I 2026-02-04T17:47:50.745] Request started path=chat/completions method=POST url=https://inference-api.nvidia.com/v1/chat/completions logger=root request_id=e3c17a10-995e-4e1e-8c02-2d56f3b1feb8 model_name=gcp/google/gemini-2.5-flash
[D 2026-02-04T17:47:50.752] Intercepted request request_data={'messages': [{'role': 'user', 'content': [{'type': 'image_url', 'image_url': {'url': '<image: format=png, size≈385128 bytes>'}}, {'type': 'text', 'text': "Answer the following multiple choice question. The last line of your response should be in the following format: 'Answer: A/B/C/D/E/F/G/H/I/J' (e.g. 'Answer: A').\n\n\n\nA) A memory\nB) A transition\nC) An opportunity\nD) A common experience\nE) A journey\nF) A warning\nG) A clock\nH) Time waits for no man\nI) An obstacle\nJ) A mystery"}]}], 'model': 'gcp/google/gemini-2.5-flash', 'frequency_penalty': 0.0, 'logprobs': False, 'n': 1, 'presence_penalty': 0.0, 'seed': 0, 'temperature': 0.0, 'top_p': 0.95, 'min_p': 0.0, 'repetition_penalty': 1.0, 'spaces_between_special_tokens': False} logger=CachingInterceptor request_id=e3c17a10-995e-4e1e-8c02-2d56f3b1feb8 model_name=gcp/google/gemini-2.5-flash
[D 2026-02-04T17:47:50.752] Processing request for caching cache_key=c07bd66a... request_data_keys=['messages', 'model', 'frequency_penalty', 'logprobs', 'n', 'presence_penalty', 'seed', 'temperature', 'top_p', 'min_p', 'repetition_pe

Note the {'type': 'image_url', 'image_url': {'url': '<image: format=png, size≈385128 bytes>'}}, sanitized description of the input.

and isinstance(value, str)
and value.startswith("data:image/")
):
match = re.match(r"data:image/([^;]+);base64,(.+)", value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cann image (the capturing group) be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[^;]+ denotes one or more characters, so it cannot be empty.

Not that I know this, Cursor told me 😆

Signed-off-by: Wojciech Prazuch <[email protected]>
@wprazuch wprazuch force-pushed the wprazuch/fix-image-modality-debug-logging branch from 9635e01 to 3f572a8 Compare February 5, 2026 09:31
@copy-pr-bot
Copy link

copy-pr-bot bot commented Feb 5, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@wprazuch
Copy link
Contributor Author

wprazuch commented Feb 5, 2026

/ok to test 3f572a8

@wprazuch wprazuch merged commit 3b303b0 into main Feb 5, 2026
47 of 48 checks passed
@wprazuch wprazuch deleted the wprazuch/fix-image-modality-debug-logging branch February 5, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants