Fix macOS ARM64 segfault in EmbeddingInferencer#381
Open
guy-singer wants to merge 2 commits intomainfrom
Open
Conversation
Three root causes addressed: 1. Create missing utilities.py module - The module was imported by __init__.py, fastdup_controller.py, galleries.py, html_writer.py, and model files but did not exist. This provides is_macos_intel(), is_python_3_8(), dcheck_latest_version(), find_model_path() (with high_accuracy support), and shared constants (_DOC_MSG, _POST_RUN_MSG, _GETTING_STARTED_LINK, GITHUB_URL). 2. Fix vector_search() passing non-contiguous array to C++ - Line 2284 created img_arr via np.ascontiguousarray() but then passed the original vec to the native function. On ARM64 with stricter memory alignment requirements this causes a segfault. Now passes img_arr. 3. Set KMP_DUPLICATE_LIB_OK on macOS before loading native library - When numpy/scipy/torch each bundle their own libomp, the duplicate OpenMP runtime causes an abort (documented in INSTALL.md). This is especially common on ARM64 Apple Silicon. https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm
The utilities module is provided by a different repository and should not be duplicated here. https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm
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.
root cause addressed:
Fix vector_search() passing non-contiguous array to C++ - Line 2284
created img_arr via np.ascontiguousarray() but then passed the
original vec to the native function. On ARM64 with stricter memory
alignment requirements this causes a segfault. Now passes img_arr.
https://claude.ai/code/session_01PgfX2eyWURkx9NWvDnqtJm
Note
Low Risk
Overview
Fixes a native bridge bug in
vector_search()by passing the contiguousnp.float32buffer (img_arr) todll.vector_searchinstead of the original potentially non-contiguousvec, preventing alignment-related segfaults.Written by Cursor Bugbot for commit 8b4346b. This will update automatically on new commits. Configure here.