Metadata-Version: 2.4
Name: CarvusTrain
Version: 1.0.0
Summary: CarvusTrain: A powerful AI development ecosystem — train, deploy, and serve AI models with code generation, grammar understanding, RAG, and agent training.
Keywords: ai,deep-learning,machine-learning,training-framework,nlp,transformers,code-generation,rag,llm,carvustrain,aadil-fazal
Author-email: Aadil Fazal <aadilfazal@github.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Code Generators
License-File: LICENSE
Requires-Dist: scikit-learn>=1.0 ; extra == "all"
Requires-Dist: sentence-transformers>=2.2 ; extra == "all"
Requires-Dist: pytest>=7.0 ; extra == "dev"
Requires-Dist: pytest-cov>=4.0 ; extra == "dev"
Requires-Dist: black>=23.0 ; extra == "dev"
Requires-Dist: flake8>=6.0 ; extra == "dev"
Requires-Dist: mypy>=1.0 ; extra == "dev"
Requires-Dist: torch>=2.0.0 ; extra == "torch"
Requires-Dist: pyyaml>=6.0 ; extra == "yaml"
Project-URL: Changelog, https://github.com/AadilFazal/CarvusTrain/blob/main/CHANGELOG.md
Project-URL: Documentation, https://github.com/AadilFazal/CarvusTrain/tree/main/docs
Project-URL: Homepage, https://github.com/AadilFazal/CarvusTrain
Project-URL: Repository, https://github.com/AadilFazal/CarvusTrain.git
Provides-Extra: all
Provides-Extra: dev
Provides-Extra: torch
Provides-Extra: yaml

<p align="center">
  <img src="https://raw.githubusercontent.com/AadilFazal/CarvusTrain/main/logo.png" alt="CarvusTrain Logo" width="250"/>
</p>

# CarvusTrain

> *An AI Development Ecosystem — Train, Deploy, and Serve AI Models*
>
> **Author: Aadil Fazal** | [GitHub](https://github.com/AadilFazal/CarvusTrain) | [PyPI](https://pypi.org/project/CarvusTrain/)

CarvusTrain is a complete AI development ecosystem that goes beyond simple training. It features real code generation in 14+ programming languages, semantic knowledge bases with TF-IDF search, built-in English grammar understanding, REST API deployment, and goal-oriented agent training — all in pure Python with zero mandatory dependencies.

## Quick Start

```bash
pip install -e .
python
```

```python
from carvustrain import Model

# Create a model
model = Model(name="MyAI", architecture="transformer")
model.knowledge_base.load_grammar_knowledge()  # Load 62 grammar facts
model.learn("Python is a programming language.")
model.learn("JavaScript runs in browsers.")

# Ask questions
print(model.ask("What is Python?"))

# Generate real code
code = model.inference_engine.generate_code(
    "Write Dijkstra shortest path in Python"
)
print(code)

# Deploy as REST API
model.serve(port=8000)
```

## Features

### Core AI
- **Model Builder** — Architecture selection: transformer, neural_network, CNN, RNN, LSTM, custom
- **AI Coding Modes** — General, Programmer, Researcher, Teacher, Creative, Security, Data Scientist
- **Auto AI Trainer** — Automatic batch size, learning rate, and training strategy
- **Memory Engine** — Long-term conversation memory and context tracking
- **Personality System** — Configurable style, humor, and creativity traits
- **Plugin System** — Extensible architecture for custom abilities

### Real Code Generation
- **50+ Algorithm Templates** — DFS, BFS, Dijkstra, merge sort, linked list ops, tree traversals, DP patterns
- **14+ Programming Languages** — Python, JavaScript, TypeScript, Java, C++, Rust, Go, Kotlin, Swift, Bash, Ruby, PHP, R, Scala
- **Cross-Language Detection** — Auto-detects language from code patterns
- **Natural Language Aliases** — "depth first search" → DFS, "shortest path" → Dijkstra

### Knowledge & Learning
- **Semantic Knowledge Base** — TF-IDF search (pure Python), optional scikit-learn, optional sentence-transformers
- **Learning Validator** — Tracks accuracy, knowledge retention, language understanding, comprehension
- **English Grammar** — 62 grammar facts across 6 categories (parts of speech, tenses, rules, mistakes, style)
- **Grammar-Aware Validation** — Checks sentence structure and grammar term usage in responses

### Deployment
- **Model Server** — REST API with POST / (ask) and GET / (info) endpoints
- **Multi-Format Export** — .ct, .json, .bin, .onnx, .gguf
- **CLI** — 15+ commands: create, init, train, chat, serve, deploy, export, evaluate, benchmark

### Agent System
- **Goal-Oriented Agents** — Train agents for specific tasks
- **Multi-Agent Teams** — Add sub-agents and orchestrate complex workflows
- **Custom Training** — Agent-specific training with auto-optimization

## CLI Reference

```bash
carvustrain create my-ai          # Create a new AI project
carvustrain train --data data.txt # Train a model
carvustrain chat --model my.ct    # Interactive chat
carvustrain serve --port 8000     # REST API server
carvustrain deploy --model my.ct  # Production deployment
carvustrain list                  # List .ct model files
carvustrain info --model my.ct    # Model details
carvustrain export --output out.onnx --format onnx
carvustrain evaluate --model my.ct --data test.txt
carvustrain benchmark --model my.ct --runs 50
carvustrain doctor                # System diagnostics
```

## Algorithm Templates

| Algorithm | Python | JavaScript | Rust | Go |
|---|---|---|---|---|
| Binary Search | ✅ | ✅ | ✅ | ✅ |
| Quick Sort | ✅ | ✅ | ✅ | ✅ |
| Merge Sort | ✅ | ✅ | ✅ | ✅ |
| DFS | ✅ | ✅ | ✅ | ✅ |
| BFS | ✅ | ✅ | ✅ | ✅ |
| Dijkstra | ✅ | ✅ | ✅ | ✅ |
| Reverse Linked List | ✅ | ✅ | ✅ | ✅ |
| Detect Cycle | ✅ | ✅ | — | ✅ |
| Tree Traversals | ✅ | ✅ | ✅ | ✅ |
| DP (LCS, Coin, Knap, Edit) | ✅ | — | — | — |

## Installation

```bash
# From source
git clone https://github.com/AadilFazal/CarvusTrain.git
cd CarvusTrain
pip install -e .

# Optional performance boosters
pip install scikit-learn        # Faster TF-IDF
pip install sentence-transformers  # Deep embeddings
```

## Project Structure

```
CarvusTrain/
├── carvustrain/            # Core Package
│   ├── __init__.py         # Package entry point
│   ├── model.py            # Model, ChatModel, AgentModel, etc.
│   ├── memory.py           # KnowledgeBase, LearningValidator, Grammar
│   ├── inference.py        # CodeGenerator, QA, Text generation
│   ├── trainer.py          # Training loop with validation
│   ├── cli.py              # 15+ CLI commands
│   ├── exporter.py         # Multi-format export
│   ├── dataset.py          # Dataset & DataLoader
│   ├── tokenizer.py        # Tokenization suite
│   ├── ...                 # 20+ modules total
├── docs/                   # Documentation
├── tests/                  # Test suite
├── examples/               # Example scripts
├── train.ct                # Default training config
├── FULL_GUIDE.md           # Comprehensive guide
├── pyproject.toml          # Package config
└── README.md               # This file
```

## License

MIT License — see [LICENSE](LICENSE).

