[WIP/AI-assisted] fix: embedding parameter naming consistency#2335
Draft
lxcxjxhx wants to merge 4 commits into
Draft
[WIP/AI-assisted] fix: embedding parameter naming consistency#2335lxcxjxhx wants to merge 4 commits into
lxcxjxhx wants to merge 4 commits into
Conversation
- Update __init__ parameter from 'embedding' to 'embeddings' - Fix error message to reference 'embeddings=True' - Update __getstate__ to use 'embeddings' key - Add backward compatibility handling in __setstate__ The parameter naming was inconsistent between Python API and C++ bindings, causing confusion and potential serialization/deserialization issues.
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.
Fix inconsistent
embeddingvsembeddingsparameter naming in__getstate__and error message.Problem
The
__init__method acceptsembeddings(plural), but two places still reference the old singularembedding:__getstate__(line 2176) serializes with keyembedding, but__setstate__passes it back to__init__which expectsembeddings. This breaks pickle round-tripping:embed()(line 1101) tells usersembedding=True, but the actual parameter isembeddings=True.Fix
embedding=toembeddings=in__getstate__return dictembedding=Truetoembeddings=TrueNote: The
__init__method already handles the deprecatedembeddingkwarg (lines 203-211) with aDeprecationWarning, so old pickled state dicts will still load correctly through that path.Testing
__getstate__now produces{"embeddings": ...}key__init__provides backward compatibility for old pickled states