fix: pass embedding kwargs (trust_remote_code) in preload_embedding()#1508
Open
hurtdidit wants to merge 1 commit intoagent0ai:mainfrom
Open
fix: pass embedding kwargs (trust_remote_code) in preload_embedding()#1508hurtdidit wants to merge 1 commit intoagent0ai:mainfrom
hurtdidit wants to merge 1 commit intoagent0ai:mainfrom
Conversation
Bug: preload_embedding() calls models.get_embedding_model() without
forwarding kwargs from the embedding config object. This causes
HuggingFace models requiring trust_remote_code=True (e.g.
nomic-ai/nomic-bert-2048) to fail during startup preloading.
Fix: Extract kwargs with getattr(emb_cfg, "kwargs", {}) and forward
them via **emb_kwargs. Fully backward compatible - empty dict is a
no-op for configs without kwargs.
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.
Bug
preload_embedding()inpreload.pycallsmodels.get_embedding_model()without forwarding thekwargsfrom the embedding config object. This causes HuggingFace models that requiretrust_remote_code=True(e.g.,nomic-ai/nomic-bert-2048) to fail during startup preloading with:Root Cause
The config schema supports a
kwargsfield, andget_embedding_model()already accepts**kwargsand passes them through — butpreload_embedding()never forwards them. The feature is half-implemented.Fix
Extract
kwargsfrom the config object with a safe default and forward them:Two-line change to
preload.py.Impact
**{}is a no-op for configs without kwargstrust_remote_code(increasingly common)Testing
Deployed and verified across 5 production Agent Zero instances (Docker). All instances show successful preload with
All keys matched successfullyand zeroError in preload_embeddingmessages.