[MAX] Add file-backed media responses for OpenResponses pixel generation#6341
Open
pei0033 wants to merge 9 commits intomodular:mainfrom
Open
[MAX] Add file-backed media responses for OpenResponses pixel generation#6341pei0033 wants to merge 9 commits intomodular:mainfrom
pei0033 wants to merge 9 commits intomodular:mainfrom
Conversation
Contributor
Author
|
Added cache eviction for local file-backed generated media. Workflow is now:
The cache limit is configurable with |
7776fa2 to
d8cf15b
Compare
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.
Summary
This PR improves OpenResponses-based pixel-generation serving by adding file-backed media responses and response-format selection for generated outputs.
Specifically, it:
/v1/responsesresponse_format: "url"andresponse_format: "b64_json"for generated media404on mismatchExample local flow validated during development:
Start a server:
MAX_SERVE_API_TYPES='["responses"]' \ ./bazelw run //max/python/max/entrypoints:pipelines -- serve \ --model-path black-forest-labs/FLUX.2-klein-4B \ --task pixel_generation \ --port 8000 \ --devices gpu \ --prefer-module-v3Send a T2I request:
With
response_format: "url", the response includes animage_urlthat canbe fetched from
/v1/images/{image_id}/content. Withresponse_format: "b64_json", the response includes inlineimage_data.Testing
./bazelw test //max/tests/tests/serve:test_openresponses_routes//max/tests/tests/serve:test_openresponses_routesspecifically verifies that:/v1/responsesrequests still succeedresponse_format: "b64_json"is requestedI also manually verified:
black-forest-labs/FLUX.2-klein-4Bresponse_format: "url"returnsimage_urlresponse_format: "b64_json"returns inlineimage_data404Checklist
sequence of smaller PRs
./bazelw run formatto format my changesAssisted-by:trailer in my commit message or this PR description(see AI Tool Use Policy)
Assisted-by: OpenAI Codex