🚀 EdgeMind
A high-performance, self-optimizing local AI image generation engine and Python SDK.
Engineered to run seamlessly across any operating system, custom hardware configuration, or path setup without overflowing VRAM or system memory.
Quickstart • API Guide • CLI Commands • Platform Support • Model Setup
✨ Key Features
- 🐍 Pure Python Module: Seamlessly embed local image generation into Python apps, Discord bots, agent workflows, and backend services with
import edgemind. - ⚡ 1-Step Hyper-SD Acceleration: Generates photorealistic high-fidelity images in just 1 inference step with zero quality loss using automatic Hyper-SD LoRA fusion.
- 🌐 Cross-Platform & Universal Paths: Runs natively on Windows, Linux, and macOS (including Apple Silicon M-series). Automatically discovers models across custom directories, environment variables, Hugging Face caches, and local WebUI installations.
- 🧠 Hardware Telemetry & Dynamic Profiling:
- Live hardware probing for CPU cores, available system RAM, and GPU VRAM.
- Automatic selection of optimization profiles:
- 🟢 Ultra VRAM (>16GB VRAM): Full pipeline caching and native batch processing.
- 🔵 High VRAM (8–16GB VRAM): FP16 / BF16 mixed-precision acceleration.
- 🟡 Medium VRAM (4–8GB VRAM): Automated model CPU offloading and VAE tiling.
- 🟠 Low VRAM / CPU (<4GB VRAM): Sequential sub-module CPU offloading, VAE slicing, and attention slicing.
- 🧹 Zero-Leak Memory Management: Programmatic memory purging (
client.unload()) releasing CUDA cache, IPC handles, and system garbage collector instantly. - 🖼️ Rich Image Representation: Output
EdgeMindImageobject provides direct.save(),.show(), rawPIL.Image, PNG byte stream, Base64 data URI, and embedded generation metadata.
💻 Platform & Hardware Support
EdgeMind automatically detects your hardware architecture and applies the most efficient backend:
| Hardware Tier | Platform | Acceleration Backend | Precision Supported |
|---|---|---|---|
| NVIDIA GPU | Windows / Linux | CUDA (11.8, 12.1, 12.4+) | FP16, BF16, FP32 |
| Apple Silicon (M1/M2/M3/M4) | macOS | Metal Performance Shaders (MPS) | FP16, FP32 |
| AMD GPU | Linux / Windows | ROCm / DirectML | FP16, FP32 |
| CPU Only | All Platforms | PyTorch CPU with CPU Offload & Slicing | FP32 |
🛠️ Installation & Setup
1. Install PyTorch Tailored to Your Hardware
NVIDIA GPU (CUDA 12.1 - Recommended):
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
Apple Silicon (macOS MPS) or CPU-Only:
pip install torch torchvision
2. Install EdgeMind
From PyPI:
pip install edgemind-ai
From Source:
git clone https://github.com/VikasPatel22/EdgeMind.git
cd EdgeMind
pip install -e .
Via Requirements:
pip install -r requirements.txt
🚀 Quickstart
Generate an image in 3 lines of Python code:
import edgemind
# Auto-detects local hardware, best checkpoint, and 1-step LoRA
image = edgemind.generate("Cyberpunk samurai cat in neon rain, cinematic lighting, 8k", save=True)
print(f"Generated in {image.elapsed_seconds}s (Seed: {image.seed})")
print(f"Saved to: {image.saved_path}")
image.show()
📖 Python SDK & API Guide
1. Initialize the Engine (edgemind.init)
Configure custom model checkpoints, optional 1-step Hyper-SD LoRA, and memory options:
import edgemind
# Initialize client with custom paths and settings
ai = edgemind.init(
model_path="models/dreamshaper_8.safetensors", # Local checkpoint or Diffusers repo
hyper_sd_path="models/Hyper-SD15-1step-lora.safetensors", # Optional 1-step turbo LoRA
output_dir="./outputs", # Output save folder
device="auto", # "auto", "cuda", "mps", "cpu"
precision="auto", # "auto", "fp16", "bf16", "fp32"
cpu_offload=True, # Automated CPU offload
vae_tiling=True, # VAE tiling for lower VRAM
attention_slicing=True # Attention slicing
)
2. Configure Client Defaults (client.configure)
Set reusable generation defaults using the fluent builder API:
ai.configure(
negative_prompt="blurry, distorted, ugly, low quality, bad anatomy",
steps=1, # 1 inference step for Hyper-SD LoRA
cfg_scale=1.0, # Recommended CFG for 1-step generation
aspect_ratio="16:9", # "1:1", "16:9", "9:16", "4:3", "3:4", "21:9"
sampler="Euler", # "Euler", "Euler A", "DPM++ 2M", "DDIM", "UniPC", "Heun"
auto_enhance=True, # Aesthetic prompt quality enhancer
quality_preset="photorealistic" # "photorealistic", "cinematic", "anime", "cyberpunk", "3d"
)
3. Generate Single Images (client.generate)
image = ai.generate(
prompt="A celestial lion sculpted from galaxy nebulas, glowing starlight, 8k",
seed=42, # Explicit seed or omit for random
aspect_ratio="16:9", # Overrides client default
save=True # Automatically saves to output_dir
)
4. Working With EdgeMindImage
The result returned by generate() provides rich native properties and export methods:
# 1. Native PIL Image
pil_img = image.image # Standard PIL.Image.Image instance
# 2. Save to custom location (with embedded generation metadata in PNG chunks)
image.save("custom_path.png")
# 3. View in OS default image viewer
image.show()
# 4. Binary PNG bytes (for file transfers, streaming, or Discord bots)
raw_bytes = image.bytes
# 5. Base64 Data URI (for web APIs or HTML rendering)
b64_uri = image.base64
# 6. NumPy array (for OpenCV or ML pipelines)
np_array = image.to_numpy()
# 7. Metadata inspection
print("Prompt:", image.prompt)
print("Seed:", image.seed)
print("Elapsed Time:", image.elapsed_seconds)
print("Model Used:", image.model)
print("Hyper-SD Active:", image.hyper_sd_active)
5. Batch Image Generation (client.generate_batch)
Generate multiple image variations sequentially:
prompts = [
"Ethereal crystal castle floating above storm clouds, golden hour",
"Bioluminescent deep sea astronaut discovering ancient ruins",
"Cyberpunk neon street market in Tokyo at midnight, ultra realistic"
]
results = ai.generate_batch(prompts, save=True, steps=1)
for img in results:
print(f"Saved: {img.saved_path} (Seed: {img.seed})")
6. Memory Management (client.unload)
Explicitly flush GPU VRAM and release pipeline from system memory:
ai.unload()
7. Inspect Hardware & Discovered Models
# Hardware specs and auto-profile
specs = ai.hardware_info
print(f"Device: {specs['device_name']}, Profile: {specs['profile']}, VRAM: {specs['vram_total_gb']}GB")
# Discovered local model checkpoints across drives
models = ai.models
for m in models:
print(f"- {m['name']} ({m['format']}) at {m['path']}")
💻 CLI Interface
EdgeMind provides a command-line interface directly from your terminal:
# Generate image from prompt
edgemind "A neon cyberpunk samurai cat, 8k resolution" --steps 1 --output cat.png --show
# Inspect hardware and execution tier
edgemind info
# List discovered local models
edgemind models
📁 Model Setup & Scanning
EdgeMind supports .safetensors, .ckpt, and Diffusers format folders (Stable Diffusion 1.5, SD 2.1, SDXL, SDXL Turbo, Flux, etc.).
Option A: Local Models Folder
Place checkpoints into ./models/:
models/
├── dreamshaper_8.safetensors
└── Hyper-SD15-1step-lora.safetensors
Option B: Automatic Cross-Platform Discovery
EdgeMind automatically detects models in common installation directories across Windows, macOS, and Linux without requiring duplicate downloads:
~/.cache/huggingface/hub/(Hugging Face default hub cache)~/stable-diffusion-webui/models/Stable-diffusion~/Fooocus/models/checkpoints~/ComfyUI/models/checkpoints- Common WebUI, Fooocus, and ComfyUI checkpoint folders across system drives (Windows / Linux / macOS)
Option C: Custom Models Path via Environment Variable
# Windows (PowerShell)
$env:EDGEMIND_MODELS_DIR="D:\AI_Models\Checkpoints"
# Linux / macOS
export EDGEMIND_MODELS_DIR="/mnt/data/models"
⚡ 1-Step Hyper-SD LoRA Acceleration
For near-instant 1-step generation:
- Download
Hyper-SD15-1step-lora.safetensorsfrom Hugging Face:curl -L -o models/Hyper-SD15-1step-lora.safetensors "https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-1step-lora.safetensors"
- EdgeMind automatically detects and fuses the LoRA, configuring Euler scheduling with trailing timestep spacing for lightning inference.
📄 License
Distributed under the MIT License. See LICENSE for more details.
Metadata
Release files for edgemind-ai 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edgemind_ai-0.1.1.tar.gz | 22.0 kB | Without provenance | Details for edgemind_ai-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edgemind_ai-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for edgemind_ai-0.1.1-py3-none-any.whl |
Total release size: 42.1 kB
Release files / edgemind_ai-0.1.1.tar.gz
| Download URL | edgemind_ai-0.1.1.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee1e2739a64f345d4af11596d55f8f6a5a3a8c889927cf06b7eeeaf742a06199
|
|
BLAKE2b-256 checksum How to use checksums |
3f0f0f6362d392fd1269a52e13d177bfad3e2caafd1d92d2b2a85cac6d0e2405
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / edgemind_ai-0.1.1-py3-none-any.whl
| Download URL | edgemind_ai-0.1.1-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb84ea183cc0b7582aa30864230c2f2759595c35423110c289fd70a1d02af548
|
|
BLAKE2b-256 checksum How to use checksums |
a5f937239f81bb687e04e4db4dbb5dfac5abe3d39eb7157e0d021f0aaba98984
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for edgemind-ai 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.