feat(embedder): allow configuring the local embedding model source (HF mirror / offline path)
Pre-submission checklist | 提交前检查
- [x] I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
- [x] I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
- [x] This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题
Problem Statement | 问题陈述
When embedding.provider: local is used (default model Xenova/all-MiniLM-L6-v2, 384-dim), the local embedder downloads its model from https://huggingface.co/ via @huggingface/transformers. In network-restricted environments (e.g. mainland China, where huggingface.co is blocked / unreachable) that download always fails with fetch failed, and there is no way to configure the model source. Consequences:
- Every new trace is captured with no vector (
vec_summary/vec_actionstay NULL). embedding_retry_queuefills with hundreds ofpending/failedjobs.- L2 induction / L3 abstraction / skill crystallization stall indefinitely on new data (no L2 candidates, no policies, no skills accumulate after the model source stops working).
Notes on the root cause (verified against @memtensor/[email protected] and @huggingface/[email protected]):
@huggingface/transformersv4 defaultsenv.remoteHosttohttps://huggingface.co/and does not read anHF_ENDPOINTenv var.- The plugin's
LocalEmbeddingProvider(dist/core/embedding/providers/local.js) callspipeline("feature-extraction", model, ...)without ever overridingenv.remoteHost/env.localModelPath/env.cacheDir. config.yamlexposes no field to set a mirror or a pre-seeded offline model directory for thelocalprovider.
The only current workaround is manually pre-seeding the transformers file cache under node_modules/@huggingface/transformers/.cache/ (fetching the model from a reachable mirror such as https://hf-mirror.com/), which is undocumented and fragile (lost on reinstall).
Suggested enhancement
Expose configuration to control the local embedding model source, e.g. under embedding::
remoteHost(e.g.https://hf-mirror.com/) — passed toenv.remoteHostbefore the pipeline loads, and/or honorHF_ENDPOINT.cacheDir/localModelPathfor a pre-seeded offline model directory.allowRemoteModels: false(or equivalent) to force fully-offline loading from cache.
Then plumb these through in local.js before pipeline() is constructed.
Willingness to Implement | 实现意愿
- [x] I would like someone else to implement this | 我希望其他人来解决
+1 from operating a local-first memory layer — two field notes: (1) HF_HUB_OFFLINE=1 plus an explicit local cache path solved our network-restricted deploys (ship the model cache with the install, no download at boot); (2) model choice matters more than the download mechanism here — the default all-MiniLM-L6-v2 (384-dim) is noticeably weak for long-horizon memory retrieval. We benchmarked smaller embedders against BGE-m3 (1024-dim) on LongMemEval-S retrieval and the small ones cost real accuracy; BGE-m3 has been the CPU sweet spot for us (~50ms/utterance — cold-load is the only pain, hence caching). hf-mirror.com works as an env override in CN-restricted environments, but your offline-path proposal is the cleaner ask.
This issue has been automatically marked as stale due to inactivity.
This issue has been automatically closed due to inactivity.