Remove sentence transformers#152
Merged
Merged
Conversation
lpi-tn
reviewed
Jun 24, 2026
lpi-tn
reviewed
Jun 24, 2026
lpi-tn
approved these changes
Jun 24, 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.
This pull request migrates the embedding and keyword extraction code from using
sentence-transformersto HuggingFace Transformers, updating both the core implementation and related tests. The main changes include refactoring embedding model loading and inference, updating keyword extraction to use HuggingFace pipelines, and adapting tests to mock the new interfaces.Migration to HuggingFace Transformers:
embedding_model_helpersmodule now uses HuggingFace'sAutoModelandAutoTokenizerfor loading embedding models instead ofSentenceTransformer. The new_compute_embeddingshelper performs embedding extraction using HuggingFace models, andcreate_content_sliceshas been updated to use this workflow. (welearn_datastack/modules/embedding_model_helpers.py) [1] [2] [3] [4] [5]load_embedding_modelfunction now returns both the model and tokenizer, checks for local directory existence, and stores models in a new format. (welearn_datastack/modules/embedding_model_helpers.py)Keyword extraction pipeline update:
keywords_extractormodule now uses HuggingFace'spipeline("feature-extraction")for KeyBERT, aligning with the new embedding backend. (welearn_datastack/modules/keywords_extractor.py) [1] [2]Dependency and test updates:
transformerslibrary is added as a dependency, andsentence-transformersis removed. (pyproject.toml)tests/document_vectorizer/test_embedding_model_helpers.py,tests/keywords_extractor/test_keywords_extractor.py) [1] [2] [3] [4] [5] [6]Minor formatting and cleanup:
These changes modernize the embedding and keyword extraction stack, improve maintainability, and align the code with current best practices for NLP model usage.