MemOS icon indicating copy to clipboard operation
MemOS copied to clipboard

feat(embedder): allow configuring the local embedding model source (HF mirror / offline path)

Open a1554154492-dev opened this issue 2 months ago • 3 comments

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_action stay NULL).
  • embedding_retry_queue fills with hundreds of pending/failed jobs.
  • 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/transformers v4 defaults env.remoteHost to https://huggingface.co/ and does not read an HF_ENDPOINT env var.
  • The plugin's LocalEmbeddingProvider (dist/core/embedding/providers/local.js) calls pipeline("feature-extraction", model, ...) without ever overriding env.remoteHost / env.localModelPath / env.cacheDir.
  • config.yaml exposes no field to set a mirror or a pre-seeded offline model directory for the local provider.

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 to env.remoteHost before the pipeline loads, and/or honor HF_ENDPOINT.
  • cacheDir / localModelPath for 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 | 我希望其他人来解决

a1554154492-dev avatar Sep 07 '26 11:09 a1554154492-dev

+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.

chunxiaoxx avatar Sep 08 '26 15:09 chunxiaoxx

This issue has been automatically marked as stale due to inactivity.

github-actions[bot] avatar Oct 09 '26 02:10 github-actions[bot]

This issue has been automatically closed due to inactivity.

github-actions[bot] avatar Oct 19 '26 02:10 github-actions[bot]