Metadata-Version: 2.4
Name: amf-core
Version: 0.1.0
Summary: Atomic Model Fragmentation (AMF) - Universal LLM Decomposition Library
Home-page: https://github.com/yourusername/amf-core
Author: Jad
Author-email: Jad <jad@example.com>
License: MIT
Project-URL: Homepage, https://github.com/yourusername/amf-core
Project-URL: Bug Tracker, https://github.com/yourusername/amf-core/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.0
Requires-Dist: gguf>=0.6.0
Requires-Dist: rich>=13.0.0
Requires-Dist: scikit-learn>=1.3.0
Provides-Extra: safetensors
Requires-Dist: safetensors>=0.4.0; extra == "safetensors"
Requires-Dist: huggingface_hub>=0.20.0; extra == "safetensors"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# Atomic Model Fragmentation (AMF)

**المحرك الجزيئي — Molecular Engine**

A revolutionary approach to running Large Language Models on resource-constrained hardware by breaking them down into functional, on-demand cells.

## Installation

```bash
# Clone the repository
cd AI_NEW_GEN

# Install as a library (development mode)
pip install -e .
```

## Quick Start (CLI)

1. **Fragment a model:**

   ```bash
   amf fragment --model qwen2.5:0.5b
   ```

2. **Start Interactive Engine:**

   ```bash
   amf chat
   ```

## Python Library Usage (`amf-core`)

The AMF system provides a universal Python library abstraction allowing you to easily embed this technology in any Python application.

```python
import amf

# 1. Load Universal Model (GGUF, Safetensors auto-detection)
model = amf.load_universal("/path/to/model.gguf")

# 2. Apply Genetic Fragmentation Strategy
cells = amf.fragment(
    model, 
    strategy="functional", 
    output_dir="./cells"
)

# 3. Explore Cellular DNA
for cell in cells.cells:
    print(f"Cell ID: {cell.cell_id}")
    print(f"DNA Tag: {cell.dna_tag}")
    print(f"Size: {cell.size_mb:.1f} MB")
```

## System Architecture

AMF operates in 6 distinct phases:

1. **Universal Parsing**: `ModelLoader` reads formats like GGUF and translates them into a universal tensor abstraction.
2. **Weight Analysis**: `WeightAnalyzer` classifies weights by layer zone, functional role, and computes statistics.
3. **DNA Tagging & Fragmentation**: `SortingAlgorithm` chunks weights into semantic groups (e.g., `A-L-003-Q` for Attention-Linguistic-Layer3-QBlock).
4. **Intent Analysis**: `IntentAnalyzer` parses user prompts to determine required reasoning/semantic layer zones.
5. **Molecular Orchestration**: `MolecularEngine` triggers selective `mmap` loading of only the necessary cells into memory.
6. **Dynamic Inference**: `InferenceEngine` executes the forward pass on the loaded functional subset using NumPy.
