Repository navigation
fix(engine): preserve single-pass engine iterables - #679
Open
linjiaye929 wants to merge 1 commit into
Open
linjiaye929 wants to merge 1 commit into
linjiaye929 wants to merge 1 commit into
Conversation
linjiaye929
marked this pull request as ready for review
October 12, 2026 10:25
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
This branch has not been 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.
Summary
AsyncEngineArray.__init__accepts anIterable[AsyncEmbeddingEngine], but consumes it while counting engines and then iterates it again for name validation and storage. Valid iterators and generators therefore raiseValueError("Engines must have unique model names"). Empty iterators and generators bypass the initial truthiness check and create an empty array instead.Materialize the iterable once before checking for empty input or duplicate names. Preserve engine order and identity, and document the constructor's iterable contract.
Validation
Linux, Python 3.12.14, NumPy 1.26.4, CPU-only PyTorch 2.8.0, sentence-transformers 3.3.1, and pytest 8.4.2.
From
libs/infinity_emb:040269bgive 6 failed, 10 passed. Failures cover valid single-pass iterables and empty single-pass iterables.debugengineand batching workers, with no inference mocks or model downloads. These are not pretrained-model or HTTP-server tests.Adjacent checks:
DO_NOT_TRACK=1 HF_HUB_OFFLINE=1 python -m pytest \ tests/unit_test/test_engine_array.py \ tests/unit_test/test_engine.py::test_async_api_debug \ tests/unit_test/test_engine.py::test_args_between_array_and_engine_same \ tests/unit_test/test_sync_engine.py::test_sync_engine \ tests/unit_test/test_sync_engine.py::test_sync_engine_double \ tests/unit_test/inference/test_select_model.py \ -k 'not torch and not optimum and not ctranslate2' -q python -m pytest tests/unit_test/test_args.py -qruff check .passes. Formatting, codespell, andgit diff --checkpass for changed files.mypy infinity_embreports the same 22 missing-optional-dependency errors on this branch and unmodified main, with identical output and noengine.pyerrors.make precommit, pretrained-model, accelerator, and HTTP-server suites were not run in this minimal CPU environment.Checklist
AI assistance was used to prepare this contribution.