MCPcopy Index your code
hub / github.com/Prismadic/magnet

github.com/Prismadic/magnet @v0.3.17

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.17 ↗ · + Follow
131 symbols 387 edges 23 files 53 documented · 40%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

magnet

📖 docs | 💻 examples | 📓 substack

the small distributed language model toolkit

⚡️ fine-tune state-of-the-art LLMs anywhere, rapidly ⚡️

GitHub release (with filter) PyPI - Version GitHub Workflow Status (with event) GitHub code size in bytes GitHub last commit (branch) GitHub issues GitHub Repo stars GitHub watchers PyPI - Downloads PyPI - Wheel X (formerly Twitter) Follow

🧬 Installation

pip install llm-magnet

or

python3 setup.py install

🎉 usage

check out the example notebooks

a snippet to get you started

from magnet.base import Magnet
from magnet.base import EmbeddedMagnet

cluster = EmbeddedMagnet()
cluster.start()
magnet = cluster.create_magnet()
await magnet.align()

config = {
    "host": "127.0.0.1",
    "credentials": None,
    "domain": None,
    "name": "my_stream",
    "category": "my_category",
    "kv_name": "my_kv",
    "session": "my_session",
    "os_name": "my_object_store",
    "index": {
        "milvus_uri": "127.0.0.1",
        "milvus_port": 19530,
        "milvus_user": "test",
        "milvus_password": "test",
        "dimension": 1024,
        "model": "BAAI/bge-large-en-v1.5",
        "name": "test",
        "options": {
            'metric_type': 'COSINE',
            'index_type':'HNSW',
            'params': {
                "efConstruction": 40
                , "M": 48
            }
        }
    }
}

magnet = Magnet(config)
await magnet.align()

🔮 features

  • ⚡️ It's Fast
  • fast on consumer hardware
  • very fast on Apple Silicon
  • extremely fast on ROCm/CUDA
  • 🫵 Automatic or your way
  • rely on established transformer patterns to let magnet do the work
  • keep your existing data processing functions, bring them to magnet!
  • 🛰️ 100% Distributed
  • processing, embedding, storage, retrieval, querying, or inference from anywhere
  • as much or as little compute as you need
  • 🧮 Choose Inference Method
  • HuggingFace
  • vLLM node
  • GPU
  • mlx
  • 🌎 Huge Volumes
  • handle gigantic amounts of data inexpensively
  • fault-tolerant by design
  • decentralized workloads
  • 🔐 Secure
  • JWT
  • Basic
  • 🪵 World-Class Comprehension
  • magnet optionally logs its own code as it's executed (yes, really)
  • build a self-aware system and allow it to learn from itself
  • emojis are the future

🧲 why

  • build a distributed LLM research node with any hardware, from Rasbperry Pi to the expensive cloud
  • Apple silicon first-class citizen with mlx
  • embed & index to vector db with milvus
  • distributed processing with NATS
  • upload to S3
  • ideal cyberpunk vision of LLM power users in vectorspace

Core symbols most depended-on inside this repo

_f
called by 135
magnet/utils/globals.py
encode
called by 8
magnet/utils/mlx/mistral.py
align
called by 3
magnet/base.py
decode
called by 3
magnet/utils/mlx/mistral.py
pulse
called by 3
magnet/ic/field.py
sample
called by 2
magnet/utils/mlx/mistral.py
load
called by 2
magnet/utils/index/milvus.py
on
called by 2
magnet/ic/field.py

Shape

Method 84
Class 28
Function 19

Languages

Python100%

Modules by API surface

magnet/utils/mlx/mistral.py28 symbols
magnet/ic/field.py19 symbols
magnet/base.py14 symbols
magnet/utils/llm/prompts.py10 symbols
magnet/utils/index/milvus.py10 symbols
magnet/utils/data_classes.py10 symbols
magnet/ize/memory.py9 symbols
magnet/utils/globals.py8 symbols
magnet/utils/nats.py5 symbols
magnet/utils/llm/api.py5 symbols
tests/test_Prism.py4 symbols
magnet/utils/llm/local.py3 symbols

For agents

$ claude mcp add magnet \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact