fleet-memory/hindsight-api/hindsight_api
Nicolò Boschi 0bf85a3435
fix: improve pytorch model initialization to prevent meta tensor issues (#180)
* fix: prevent meta tensor issues when accelerate is installed without GPU

When accelerate is installed but no GPU is available, transformers can
incorrectly use lazy loading (meta tensors) which fails when
sentence-transformers tries to move the model to a device.

The fix checks hardware and installed packages to determine the right
loading strategy:
- GPU available: device=None, device_map=None (auto-detect GPU)
- No GPU + accelerate: device='cpu', device_map='cpu' (force CPU loading)
- No GPU + no accelerate: device='cpu', device_map=None (normal CPU)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: add filelock for model initialization in parallel tests

When pytest-xdist runs multiple workers in parallel, they all try to
load models from the HuggingFace cache simultaneously, causing race
conditions and intermittent meta tensor errors.

Added filelock around embeddings and cross_encoder initialization in
conftest.py, similar to how pg0 database setup is serialized. Models
are now pre-initialized in the fixture before being passed to tests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: add MPS support for macOS Apple Silicon

Extend GPU detection to include Apple MPS backend in addition to CUDA.
This ensures macOS users with Apple Silicon use MPS acceleration
instead of being incorrectly routed to the CPU fallback path.
2026-01-20 14:15:51 +01:00
..
admin feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
alembic feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
api feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
engine fix: improve pytorch model initialization to prevent meta tensor issues (#180) 2026-01-20 14:15:51 +01:00
extensions feat: improve mental model refresh and add directives (#166) 2026-01-19 11:38:35 +01:00
worker feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
__init__.py feat: extensions (#54) 2025-12-22 11:05:23 +01:00
banner.py fix: doc build and lint files (#34) 2025-12-16 13:49:09 +01:00
config.py feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
daemon.py feat: refactor hindsight-embed architecture (#66) 2025-12-22 22:02:40 +01:00
main.py feat: new 'worker' service (#176) 2026-01-20 10:17:56 +01:00
mcp_local.py feat: extensions (#54) 2025-12-22 11:05:23 +01:00
metrics.py feat: add tenant to metrics labels (#151) 2026-01-13 15:31:58 +01:00
migrations.py fix: batch queries on recall (#149) 2026-01-13 13:20:22 +01:00
models.py chore: drop unused access_count column (#178) 2026-01-20 10:36:02 +01:00
pg0.py feat: backup/restore (#110) 2026-01-07 11:29:50 +01:00
server.py Fix: Load extensions in server.py for multi-worker deployments (#155) 2026-01-13 17:55:33 +01:00