Skip to main content

GPU-accelerated fork of mempalace — NVIDIA CUDA, AMD ROCm, Apple MPS. 3-6x faster mining.

Project description

mempalace-gpu

GPU-accelerated fork of milla-jovovich/mempalace

This fork adds GPU-accelerated embeddings and batch processing to MemPalace. Supports NVIDIA (CUDA), AMD (ROCm), and Apple Silicon (MPS). For documentation on MemPalace itself (palace structure, AAAK dialect, MCP tools, benchmarks), see the upstream README.


What this fork adds

GPU-accelerated embeddings

Embeddings are computed via sentence-transformers on GPU when available, falling back to ChromaDB's default CPU/ONNX model when not.

mempalace mine ~/myproject --device auto    # auto-detect best GPU
mempalace mine ~/myproject --device cuda    # NVIDIA
mempalace mine ~/myproject --device rocm    # AMD
mempalace mine ~/myproject --device mps     # Apple Silicon (M1-M5)
mempalace mine ~/myproject --device cpu     # force CPU

Also configurable via MEMPALACE_DEVICE env var or "device" in ~/.mempalace/config.json.

Batch processing

collection.add() calls are batched (100 documents per call instead of 1), reducing ChromaDB overhead regardless of CPU or GPU mode.

Self-update MCP tool

The MCP server includes a mempalace_self_update tool that pulls the latest version from PyPI, callable directly from your AI assistant.


Performance

Tested on two real-world codebases on NVIDIA CUDA. Same files, same drawers — only the device changes.

Test Files Drawers Size CPU GPU Speedup
Large mixed codebase (JS/TS/Dart/Python/HTML) 118 13,673 ~1.7 GB 156.7s 26.3s 6.0x
Medium Flutter app (Dart/YAML/JSON) 145 2,906 ~85 MB 37.3s 10.7s 3.5x

Speedup scales with drawer count. More chunks = more embedding work = bigger GPU advantage.


Installation

# Clone this fork
git clone https://github.com/phobicdotno/mempalace-gpu.git
cd mempalace-gpu

NVIDIA (CUDA)

pip install -e ".[gpu]"

AMD (ROCm)

# Install PyTorch with ROCm first
pip install torch --index-url https://download.pytorch.org/whl/rocm6.2
# Then install mempalace with GPU extras
pip install -e ".[gpu]"

Apple Silicon (MPS)

# PyTorch ships with MPS support on macOS by default
pip install -e ".[gpu]"

CPU only (still gets batch processing)

pip install -e .

Staying in sync with upstream

git remote add upstream https://github.com/milla-jovovich/mempalace.git
git fetch upstream
git merge upstream/main

Changes from upstream

File Change
mempalace/embeddings.py New -- GPU detection (NVIDIA/AMD/Apple), embedding factory, batch flush
mempalace/miner.py Batched collection.add(), content hashing, update() command
mempalace/convo_miner.py Batched collection.add()
mempalace/config.py device property (auto/cuda/rocm/mps/cpu)
mempalace/cli.py --device flag, update subcommand
mempalace/mcp_server.py mempalace_self_update tool, shared embeddings
mempalace/searcher.py Shared embedding function for vector compatibility
mempalace/layers.py Shared embedding function
mempalace/palace_graph.py Shared embedding function
pyproject.toml gpu optional dependency group

All other files are unmodified from upstream. Existing palaces remain compatible.


License

MIT -- same as upstream.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mempalace_gpu-3.2.0.tar.gz (79.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mempalace_gpu-3.2.0-py3-none-any.whl (84.4 kB view details)

Uploaded Python 3

File details

Details for the file mempalace_gpu-3.2.0.tar.gz.

File metadata

  • Download URL: mempalace_gpu-3.2.0.tar.gz
  • Upload date:
  • Size: 79.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mempalace_gpu-3.2.0.tar.gz
Algorithm Hash digest
SHA256 58763a3d9e139c3b490b40b581509128adc3ee55ca16954e5f372e1eec224f99
MD5 217f5bf7ecbf6ea0f761987e797543ce
BLAKE2b-256 5c55661859072b88f3b9ce1ceac076daa12c87a783eb530620130fdb2c5ffb52

See more details on using hashes here.

File details

Details for the file mempalace_gpu-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: mempalace_gpu-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 84.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mempalace_gpu-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccdc6c6315fe4dba46826edc09e6154cdb1d041102c7a8549e17149e9111a276
MD5 69f23ebba879b38436f1fad48726e1ce
BLAKE2b-256 02f3e191c13951debb59478d0f0e8b57d2cd6c6abefdcb7ecc180ac822f07b48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page