Skip to content

Feature/sklearnex and remove faiss#33

Merged
NetZissou merged 6 commits into
mainfrom
feature/sklearnex-and-remove-faiss
Jun 11, 2026
Merged

Feature/sklearnex and remove faiss#33
NetZissou merged 6 commits into
mainfrom
feature/sklearnex-and-remove-faiss

Conversation

@NetZissou

@NetZissou NetZissou commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Closes issue #32

  1. Patch sklearn with sklearnex.
  2. Remove faiss entirely from backend.

About sklearnex

Good API stability:

Unlike other libraries in the Python ecosystem, classes and functions in the Extension for Scikit-learn* are not just scikit-learn-compatible, but rather are built atop of scikit-learn itself by inheriting from their classes directly, defining the same attributes that the stock version of scikit-learn would do for each estimator, and reusing most of scikit-learn’s estimator methods where appropriate.

The Extension for Scikit-learn* is regularly tested for API compatibility and for correctness against scikit-learn’s own test suite (see Scikit-learn’s test suite for more information), and can be easily swapped in place of the stock scikit-learn library by patching it.

sklearnex is powered by the oneDAL library that provides accelerations on x86_64 Linux and Windows machines, and silently fall back to vanilla sklearn on unsupported architectures like Apple Silicon and ARM Linux. The package is under the UXL Foundation (a Linux Foundation project) so cross-vendor support is a stated goal.

NetZissou added 2 commits June 2, 2026 10:58
The FAISS KMeans backend added meaningful installation weight and
startup import noise for a marginal benefit. Removing it simplies the
backend selection logic to two cases:
- cuML if GPU available
- else sklearn

Changes
- Drop `faiss-cpu` & `faiss-gpu-cu12` from main deps and `gpu-*` extras
- Remove FAISS from backend scripts `resolve_brackend()`, `run_kmeans()` dispatch
- Remove "faiss" from clustering backend dropdowns in the webUI
- Update README & BACKEND_PIPELINE doc to reflect the changes
Add `scikit-learn-intelex` as default dependency and patch sklearn at
import time in `shared/utils/clustering.py`. Accelerates the existing
`sklearn` PCA / TSNE / KMeans calls on CPU.

UMAP is unaffected as `umap-learn` is not part of the `sklearn`
algorithm.

Set Set EMB_EXPLORER_DISABLE_SKLEARNEX=1 to opt out for debugging
vanilla sklearn behavior.
@NetZissou NetZissou self-assigned this Jun 2, 2026
@NetZissou NetZissou added the enhancement New feature or request label Jun 2, 2026
@NetZissou NetZissou linked an issue Jun 2, 2026 that may be closed by this pull request
Comment thread README.md Outdated
Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread docs/BACKEND_PIPELINE.md
Comment thread README.md
Co-authored-by: Net Zhang <48858129+NetZissou@users.noreply.github.com>
@NetZissou NetZissou requested a review from egrace479 June 3, 2026 17:05

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Footnote formatting fix

Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread docs/BACKEND_PIPELINE.md
Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread docs/BACKEND_PIPELINE.md Outdated
Comment thread README.md Outdated
@egrace479

Copy link
Copy Markdown
Member

I get the following warning when running emb-embed-explore and emb-precalculated:

WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager

Otherwise emb-precalculated looks fine. It's just the error we discussed with emb-embed-explore: when I select a folder with three images to embed, this pops up (full traceback in slack) and it does not recognize the embeddings (clustering errors out stating that embedding must be performed first)
Screenshot 2026-06-08 at 3 54 34 PM

NetZissou and others added 2 commits June 9, 2026 10:03
Co-Authored-By: egrace479 <egrace479@users.noreply.github.com>
Matrix:
- OS: ubuntu-latest, windows-latest, macos-latest
- Python: 3.10, 3.11, 3.12, 3.13

Each cell installs the CPU base (no gpu extras), runs an import smoke
tests for shared/utils/clustering and both Streamlit app entry points, then verifies the sklearnex platform marker: present on x86_64/AMD64, absent on arm64.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@NetZissou NetZissou linked an issue Jun 9, 2026 that may be closed by this pull request
@NetZissou

Copy link
Copy Markdown
Collaborator Author

@egrace479 thanks for the error logs and screenshots. Opened two seperate issues (#36 #35 )for further investigating.

Applied the footnote suggestions locally to bypass the GH Web error that we encountered yesterday.

Added CI Matrix to check for install and import on OS x Py Matrix:

  • OS: ubuntu-latest, windows-latest, macos-latest
  • Python: 3.10, 3.11, 3.12, 3.13

@NetZissou NetZissou requested a review from egrace479 June 9, 2026 14:54
Comment thread .github/workflows/install-and-import.yaml

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The emb-embed-explore error exists independent of this update and is tracked in #35.

This looks good.

@NetZissou NetZissou merged commit cea740f into main Jun 11, 2026
12 checks passed
@NetZissou NetZissou deleted the feature/sklearnex-and-remove-faiss branch June 11, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI matrix Backend Acceleration on CPU Cores

2 participants