Adding --max_length parameter for embeddings - #4496
Open
przepeck wants to merge 8 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for configuring embeddings max_length (via CLI/graph export and MediaPipe node options) so model context length can be fixed explicitly—intended to improve loading/inference behavior on NPU—along with test coverage for the new setting.
Changes:
- Add
--max_lengthto embeddings graph-export CLI and propagate it into generated graph pbtxt (max_lengthnode option). - Extend embeddings node initialization/servable flow to carry an optional configured max length and apply it during preprocessing.
- Add/update unit and integration tests plus test graphs/configs covering max-length behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/ovmsconfig_test.cpp | Extends config parsing tests to cover --max_length for embeddings graph settings. |
| src/test/graph_export_test.cpp | Updates graph export expectations and settings to include max_length. |
| src/test/embeddingsnode_test.cpp | Adds HTTP-level tests verifying requests within/exceeding configured max_length. |
| src/test/embeddings/graph_ov_max_length.pbtxt | Adds a new embeddings graph fixture with max_length set. |
| src/test/embeddings/config_embeddings.json | Registers the new test model/graph in embeddings test config. |
| src/graph_export/graph_export.cpp | Emits max_length into generated embeddings graph templates when configured. |
| src/graph_export/embeddings_graph_cli_parser.cpp | Adds CLI option parsing for --max_length into embeddings graph settings. |
| src/embeddings/embeddings_servable.hpp | Adds optional configured max-length member/plumbing into the servable. |
| src/embeddings/embeddings_servable.cpp | Applies configured max length as an override during preprocessing. |
| src/embeddings/embeddings_node_initializer.cpp | Reads max_length from node options and passes it into the servable. |
| src/embeddings/embeddings_calculator_ov.proto | Extends calculator options proto with optional uint32 max_length. |
| src/capi_frontend/server_settings.hpp | Extends embeddings graph settings struct with maxLength. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
looks good. add also documentation and include new parameter in the embeddings demo with NPU |
dtrawins
approved these changes
Sep 1, 2026
michalkulakowski
approved these changes
Sep 2, 2026
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
CVS-187555
Adding
--max_lengthparameter for embeddings to speed up model loading and inference on NPU.Model loading time:
unset: ~13min
200: 18s
🧪 Checklist
``