CarvusTrain: A powerful AI development ecosystem — train, deploy, and serve AI models with code generation, grammar understanding, RAG, and agent training.
Project description
🌟 Overview
CarvusTrain is a pure-Python AI development ecosystem for building, training, deploying, and evolving intelligent systems — with zero mandatory dependencies.
Built from scratch with Python 3.10+, CarvusTrain provides a complete AI toolkit:
- 🧠 Create AI Models — Transformer, CNN, RNN, LSTM, or custom architectures
- 💡 Knowledge Management — TF-IDF semantic search, code detection, grammar understanding
- 📚 Learn from Data — Text files, CSV, JSON, XML, YAML, Markdown, custom
.ctformat - 🎯 Smart Training — Auto AI Trainer with learning validation
- 🌐 Deploy as APIs — Built-in REST API server with no extra dependencies
- 🧬 Export Anywhere — ONNX, GGUF, JSON, BIN, and native
.ctformats
🎯 Who Should Use CarvusTrain
| Profile | Use Case |
|---|---|
| ML Engineers | Build custom AI models without deep learning framework overhead |
| Full-Stack Developers | Add AI capabilities to existing applications in minutes |
| Data Scientists | Transform datasets into intelligent systems with semantic understanding |
| Students | Learn AI concepts with clean, readable Python code |
| Hobbyists | Experiment with AI without GPU requirements |
✨ Core Features
🚀 Quick Start
Installation
Via PyPI (Recommended)
pip install carvustrain
From Source
git clone https://github.com/Aadil-Fazal/CarvusTrain.git
cd CarvusTrain
pip install -e .
Your First AI Model (30 seconds)
from carvustrain import Model
# Create your first AI model
ai = Model(name="MyFirstAI")
# Teach it something
ai.learn("Python is a high-level programming language used for web development")
ai.learn("Machine learning is a subset of artificial intelligence")
# Ask it questions
response = ai.ask("What is Python?")
print(response)
# Output: "Python is a high-level programming language used for web development"
# Export your model
ai.export("my_model.onnx", format="onnx")
CLI Quick Commands
# Create a new project
carvustrain create my-ai-project
# Train your model
carvustrain train --data dataset.csv --epochs 10
# Interactive chat
carvustrain chat
# Start API server
carvustrain serve --port 8000
# Export model
carvustrain export --format onnx --model my_model.ct --output model.onnx
# Check system health
carvustrain doctor
🏗️ Architecture
System Architecture
graph TB
subgraph Input["🔌 Input Layer"]
Raw["Raw Data<br/>(txt, csv, json, xml, md)"]
CLI["CLI Input"]
CT["Custom .ct Files"]
end
subgraph Process["⚙️ Processing Pipeline"]
Parser["Multi-Format Parser"]
Tokenizer["Tokenization"]
KB["Knowledge Base<br/>(TF-IDF Search)"]
end
subgraph AI["🧠 AI Core"]
Engine["Inference Engine"]
Memory["Memory System<br/>(Context & Cache)"]
Validator["Learning Validator"]
end
subgraph Output["📤 Output Layer"]
QA["Question Answering"]
Generate["Text Generation"]
Export["Model Export<br/>(.ct, .json, .onnx, .gguf, .bin)"]
end
subgraph Deploy["🚀 Deployment"]
API_Server["REST API<br/>(zero dependencies)"]
CLI_Tools["CLI Tools"]
end
Raw --> Parser
CLI --> Parser
CT --> Parser
Parser --> Tokenizer
Tokenizer --> KB
KB --> Engine
Engine --> Memory
Memory --> Validator
Validator --> QA
Validator --> Generate
QA --> Export
Generate --> Export
QA --> API_Server
Generate --> CLI_Tools
Training Pipeline
sequenceDiagram
participant User
participant CLI
participant Trainer
participant KB as Knowledge Base
participant Validator
User->>CLI: carvustrain train --data dataset.csv
CLI->>Trainer: Initialize training
Trainer->>Trainer: Load & preprocess data
loop Training Epochs
Trainer->>KB: Update knowledge
KB->>Validator: Validate quality
Validator-->>Trainer: Learning metrics
end
Trainer-->>User: Training complete
💻 Code Examples
Example 1: Basic Training & Inference
from carvustrain import Model
model = Model(name="Assistant")
model.train(data=["AI is transforming the world."], epochs=3)
answer = model.ask("What is AI?")
print(answer)
Example 2: Interactive Chat
from carvustrain import ChatModel
chat = ChatModel(name="ChatBot")
chat.learn(["Carvus is an AI assistant built with CarvusTrain."])
reply = chat.chat("Hello! Who are you?")
print(reply)
Example 3: Fine-tuning & Multi-Format Export
from carvustrain import Model
model = Model(name="BaseCarvus")
model.train(data=["Base knowledge about machine learning."], epochs=2)
# Fine-tune on new domain
model.finetune(data=["Specialized knowledge on transformers."], epochs=3)
# Export to multiple formats
model.export("model.onnx", format="onnx")
model.export("model.gguf", format="gguf")
model.export("model.json", format="json")
Example 4: Advanced Agent with Sub-Agents
from carvustrain import AgentModel, Model
# Create a main agent
agent = AgentModel(name="CodeAssistant", goal="software engineer")
# Add specialized sub-agents
researcher = AgentModel(name="Researcher")
planner = AgentModel(name="Planner")
agent.add_sub_agent("researcher", researcher)
agent.add_sub_agent("planner", planner)
# Orchestrate a task
results = agent.orchestrate("Build a Python web scraper")
print(results)
Example 5: REST API Server
from carvustrain import Model
ai = Model(name="ProductionAI")
ai.learn("CarvusTrain is an AI development ecosystem.")
# Start API server (zero dependencies)
ai.serve(port=8000)
# POST / with {"prompt": "your question"}
# GET / for model status
Example 6: Code Generation
from carvustrain import Model
model = Model(name="CodeGen")
result = model.generate("Write a Python function to sort a list", max_new_tokens=200)
print(result)
🎬 CLI Guide
# Project initialization
carvustrain create my-ai --architecture transformer
carvustrain init ./project
# Training
carvustrain train --data dataset.csv --epochs 10 --batch-size 32
carvustrain train --data dataset.csv --validation 20% --epochs 50
# Inference & Chat
carvustrain predict --model model.ct --prompt "Hello"
carvustrain chat --model model.ct
# Model Management
carvustrain list
carvustrain info --model model.ct
carvustrain export --model model.ct --format onnx --output model.onnx
# Deployment
carvustrain serve --model model.ct --port 8000
carvustrain deploy --model model.ct --port 8000
# Utilities
carvustrain evaluate --model model.ct --data test_data.csv
carvustrain benchmark --model model.ct --runs 20
carvustrain doctor
carvustrain version
📦 Project Structure
CarvusTrain/
├── CarvusTrain/
│ ├── __init__.py # Public API & functional interface
│ ├── model.py # Core Model, ChatModel, AgentModel classes
│ ├── trainer.py # Training engine with learning validation
│ ├── inference.py # Inference engine & code generator
│ ├── memory.py # Knowledge base, TF-IDF, learning validator
│ ├── cli.py # Command-line interface
│ ├── configuration.py # Dataclass configs (Model, Training, Inference)
│ ├── constants.py # Constants & defaults
│ ├── dataset.py # Dataset, DataLoader, TextDataset
│ ├── tokenizer.py # Tokenizers (Word, Char, BPE, etc.)
│ ├── parser.py # Multi-format parser (.ct, .csv, .json, etc.)
│ ├── exporter.py # ModelExporter (ct, bin, onnx, json, gguf)
│ ├── evaluation.py # Evaluator & Benchmarker
│ ├── optimizer.py # Adam, AdamW, SGD, RMSprop, AdaGrad
│ ├── scheduler.py # LR schedulers
│ ├── losses.py # Loss functions
│ ├── metrics.py # Evaluation metrics
│ ├── activation.py # Activation functions
│ ├── layers.py # Neural network layers
│ ├── callbacks.py # Training callbacks
│ ├── preprocessing.py # Text preprocessing utilities
│ ├── postprocessing.py # Logit processing & text postprocessing
│ ├── utils.py # Device detection, system info, formatting
│ ├── logger.py # Colorized logging
│ ├── exceptions.py # Custom exception classes
│ └── version.py # Version information
├── examples/
│ ├── 01_basic_usage.py
│ ├── 02_custom_carvus_file.py
│ ├── 03_finetune_and_export.py
│ └── 04_chat_model_interactive.py
├── docs/
│ ├── api_reference.md
│ ├── architecture.md
│ ├── cli_guide.md
│ ├── developer_guide.md
│ ├── installation.md
│ └── quickstart.md
├── pyproject.toml
├── setup.py
├── setup.cfg
├── LICENSE
└── README.md
🛠️ Performance & Features
Click to expand details
Supported Export Formats
| Format | Extension | Description |
|---|---|---|
| CarvusTrain Native | .ct |
Zip archive with model manifest |
| JSON | .json |
Human-readable model dump |
| Binary | .bin |
Compact binary serialization |
| ONNX | .onnx |
ONNX metadata descriptor |
| GGUF | .gguf |
GGUF v3 container (llama.cpp) |
Supported Data Formats
| Format | Extension | Description |
|---|---|---|
| Plain Text | .txt |
Paragraph-split text |
| CSV | .csv |
Tabular data with headers |
| JSON | .json |
Structured records |
| JSONL | .jsonl |
Line-delimited JSON |
| XML | .xml |
Element-based records |
| YAML | .yaml, .yml |
YAML documents |
| Markdown | .md, .markdown |
Cleaned text content |
| Native | .ct |
CarvusTrain sectioned format |
Supported Tokenizers
- WordTokenizer — Space/punctuation-based tokenization
- CharTokenizer — Character-level tokenization
- SentenceTokenizer — Sentence-split tokenization
- BPETokenizer — Byte-pair encoding
- WordPieceTokenizer — Subword tokenization (BERT-style)
- SentencePieceTokenizer — Unigram language model
- CustomTokenizer — User-defined tokenization
🔐 Security & Compliance
- ✅ Zero mandatory dependencies — Minimized attack surface
- ✅ Input Validation — Robust parsing with error handling
- ✅ Data Isolation — No telemetry, no external calls
- ✅ MIT License — Free for commercial and personal use
📚 Documentation
| Resource | Link |
|---|---|
| Getting Started | docs/quickstart.md |
| API Reference | docs/api_reference.md |
| Examples | examples/ |
| Architecture | docs/architecture.md |
| CLI Reference | docs/cli_guide.md |
| Changelog | CHANGELOG.md |
🤝 Contributing
We welcome contributions! Here's how to get involved:
# Clone repository
git clone https://github.com/Aadil-Fazal/CarvusTrain.git
cd CarvusTrain
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
# Format code
black CarvusTrain/
ruff check CarvusTrain/
Contribution Guidelines
- Fork & Clone — Create your feature branch (
git checkout -b feature/amazing-feature) - Make Changes — Code with tests and documentation
- Test Locally — Run full test suite
- Commit — Write clear commit messages
- Push — Push to your fork
- Pull Request — Create PR with detailed description
❓ FAQ
Does CarvusTrain require deep learning knowledge?
No! CarvusTrain abstracts away complexity with high-level APIs. However, understanding ML concepts helps optimize your models.
What's the minimum hardware requirement?
- Minimum: 4GB RAM, any modern CPU
- Recommended: 8GB+ RAM for larger datasets
- GPU: Optional — works on CPU only by default
Can I use CarvusTrain for production systems?
Absolutely! It's designed for production use with built-in REST API server and export capabilities.
How does pricing work?
CarvusTrain is completely free and open-source under MIT License. No hidden fees, no usage limits.
Does it require external AI models or APIs?
No! CarvusTrain is a pure-Python framework with zero mandatory dependencies. Everything runs locally.
How is CarvusTrain different from PyTorch/TensorFlow?
While PyTorch and TensorFlow are low-level frameworks requiring GPU setup, CarvusTrain is a high-level, zero-dependency platform that works out of the box.
🗺️ Roadmap
✅ Completed (v1.0 - v1.1)
- Core transformer architecture & model classes
- Knowledge base with TF-IDF semantic search
- Multi-format data parser (txt, csv, json, xml, yaml, md)
- Training engine with learning validation
- REST API server (zero deps)
- CLI interface with 15+ commands
- Code generation engine (20+ languages)
- Multi-format exporter (ct, json, bin, onnx, gguf)
- English grammar knowledge base
- Tokenizer suite (7 tokenizer types)
🔄 In Progress (v1.2 - v1.5)
- GPU-accelerated training (CUDA/ROCm)
- Distributed training across multiple machines
- Real-time streaming inference
- Advanced quantization techniques
- Visual model builder UI
- Auto hyperparameter tuning
🚀 Planned (v2.0+)
- Neural Architecture Search (NAS)
- Federated learning support
- Multi-modal capabilities (image, audio)
- Production monitoring dashboard
- On-device inference frameworks
📄 License
This project is licensed under the MIT License — see LICENSE for details.
You are free to:
- ✅ Use commercially
- ✅ Modify the source
- ✅ Distribute copies
- ✅ Use privately
🙏 Acknowledgments
- Built with Python 3.10+
- Inspired by the open-source AI community
- Special thanks to all contributors and stargazers ⭐
⭐ Star This Project
If CarvusTrain helps you, please consider giving us a star ⭐ on GitHub. It means the world to us!
Made with ⚡ by Aadil Fazal
GitHub • Documentation • PyPI
Last Updated: 2026 | CarvusTrain v1.1.0
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file carvustrain-1.1.0.tar.gz.
File metadata
- Download URL: carvustrain-1.1.0.tar.gz
- Upload date:
- Size: 97.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74fa8984d7d2d3b9936caff2e583c6893270fcc8823673d5185192748ee36a17
|
|
| MD5 |
56bc74fb1d2ed4c23e997e6eee4776ba
|
|
| BLAKE2b-256 |
a66f526255b3feee2f19ad8c0d588aedeea4268cc3233e1fc716a6b85364b5f8
|
File details
Details for the file carvustrain-1.1.0-py3-none-any.whl.
File metadata
- Download URL: carvustrain-1.1.0-py3-none-any.whl
- Upload date:
- Size: 94.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59dd376f4e0cff665f4442baaf7076c8f5660bfa5cd66b5b796ca5ade0858cd6
|
|
| MD5 |
37eb3521e2b2fec1a967b0f88be4dbb7
|
|
| BLAKE2b-256 |
90d2218c5761d5cacebf1979082efbf3ac4317b199df9dcaba637155b27abaf1
|