saara-ai 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. saara_ai-0.1.0/LICENSE +21 -0
  2. saara_ai-0.1.0/MANIFEST.in +2 -0
  3. saara_ai-0.1.0/PKG-INFO +318 -0
  4. saara_ai-0.1.0/README.md +250 -0
  5. saara_ai-0.1.0/pyproject.toml +125 -0
  6. saara_ai-0.1.0/saara/__init__.py +29 -0
  7. saara_ai-0.1.0/saara/cli/__init__.py +5 -0
  8. saara_ai-0.1.0/saara/cli/main.py +219 -0
  9. saara_ai-0.1.0/saara/dataset/__init__.py +14 -0
  10. saara_ai-0.1.0/saara/dataset/builder.py +237 -0
  11. saara_ai-0.1.0/saara/dataset/pdf_extractor.py +128 -0
  12. saara_ai-0.1.0/saara/dataset/synthetic_generator.py +228 -0
  13. saara_ai-0.1.0/saara/dataset/types.py +53 -0
  14. saara_ai-0.1.0/saara/evaluation/__init__.py +11 -0
  15. saara_ai-0.1.0/saara/evaluation/benchmarks.py +160 -0
  16. saara_ai-0.1.0/saara/evaluation/evaluator.py +269 -0
  17. saara_ai-0.1.0/saara/evaluation/metrics.py +83 -0
  18. saara_ai-0.1.0/saara/export/__init__.py +11 -0
  19. saara_ai-0.1.0/saara/export/exporter.py +377 -0
  20. saara_ai-0.1.0/saara/export/formats.py +15 -0
  21. saara_ai-0.1.0/saara/export/quantization.py +44 -0
  22. saara_ai-0.1.0/saara/gui/__init__.py +11 -0
  23. saara_ai-0.1.0/saara/gui/components.py +322 -0
  24. saara_ai-0.1.0/saara/gui/dashboard.py +173 -0
  25. saara_ai-0.1.0/saara/providers/__init__.py +20 -0
  26. saara_ai-0.1.0/saara/providers/base.py +84 -0
  27. saara_ai-0.1.0/saara/providers/llamacpp_provider.py +85 -0
  28. saara_ai-0.1.0/saara/providers/ollama_provider.py +91 -0
  29. saara_ai-0.1.0/saara/providers/vllm_provider.py +98 -0
  30. saara_ai-0.1.0/saara/training/__init__.py +11 -0
  31. saara_ai-0.1.0/saara/training/callbacks.py +98 -0
  32. saara_ai-0.1.0/saara/training/config.py +67 -0
  33. saara_ai-0.1.0/saara/training/finetuner.py +242 -0
  34. saara_ai-0.1.0/saara/utils/__init__.py +16 -0
  35. saara_ai-0.1.0/saara/utils/io.py +73 -0
  36. saara_ai-0.1.0/saara/utils/logging.py +46 -0
  37. saara_ai-0.1.0/saara/utils/memory.py +51 -0
  38. saara_ai-0.1.0/saara/version.py +4 -0
  39. saara_ai-0.1.0/saara_ai.egg-info/PKG-INFO +318 -0
  40. saara_ai-0.1.0/saara_ai.egg-info/SOURCES.txt +45 -0
  41. saara_ai-0.1.0/saara_ai.egg-info/dependency_links.txt +1 -0
  42. saara_ai-0.1.0/saara_ai.egg-info/entry_points.txt +2 -0
  43. saara_ai-0.1.0/saara_ai.egg-info/requires.txt +47 -0
  44. saara_ai-0.1.0/saara_ai.egg-info/top_level.txt +1 -0
  45. saara_ai-0.1.0/setup.cfg +4 -0
  46. saara_ai-0.1.0/setup.py +5 -0
  47. saara_ai-0.1.0/tests/test_saara.py +241 -0
saara_ai-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Kilani Sai Nikhil
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include LICENSE
2
+ include README.md
@@ -0,0 +1,318 @@
1
+ Metadata-Version: 2.4
2
+ Name: saara-ai
3
+ Version: 0.1.0
4
+ Summary: End-to-end ML pipeline: PDF→JSON datasets, synthetic data, fine-tuning, evaluation, and edge deployment with Gradio GUI
5
+ Author-email: Kilani Sai Nikhil <nikhil49023@gmail.com>
6
+ Maintainer-email: Kilani Sai Nikhil <nikhil49023@gmail.com>
7
+ License-Expression: MIT
8
+ Project-URL: Homepage, https://github.com/nikhil49023/saara-ai
9
+ Project-URL: Repository, https://github.com/nikhil49023/saara-ai
10
+ Project-URL: Documentation, https://saara-ai.readthedocs.io
11
+ Keywords: saara,ml,llm,fine-tuning,synthetic-data,pdf,vllm,gradio
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: torch>=2.1.0
25
+ Requires-Dist: transformers>=4.36.0
26
+ Requires-Dist: accelerate>=0.25.0
27
+ Requires-Dist: datasets>=2.14.0
28
+ Requires-Dist: unsloth>=2024.1
29
+ Requires-Dist: trl>=0.7.0
30
+ Requires-Dist: peft>=0.7.0
31
+ Requires-Dist: bitsandbytes>=0.41.0
32
+ Requires-Dist: vllm>=0.2.0
33
+ Requires-Dist: ollama>=0.1.0
34
+ Requires-Dist: llama-cpp-python>=0.2.0
35
+ Requires-Dist: pymupdf>=1.23.0
36
+ Requires-Dist: pdfplumber>=0.10.0
37
+ Requires-Dist: autoawq>=0.2.0
38
+ Requires-Dist: auto-gptq>=0.5.0
39
+ Requires-Dist: onnx>=1.15.0
40
+ Requires-Dist: gguf>=0.1.0
41
+ Requires-Dist: lm-eval>=0.4.0
42
+ Requires-Dist: lighteval>=0.4.0
43
+ Requires-Dist: pynvml>=11.5.0
44
+ Requires-Dist: codecarbon>=2.0.0
45
+ Requires-Dist: psutil>=5.9.0
46
+ Requires-Dist: gradio>=4.0.0
47
+ Requires-Dist: pyyaml>=6.0
48
+ Requires-Dist: tqdm>=4.66.0
49
+ Requires-Dist: rich>=13.0.0
50
+ Requires-Dist: click>=8.0.0
51
+ Provides-Extra: dev
52
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
53
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
54
+ Requires-Dist: black>=23.0.0; extra == "dev"
55
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
56
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
57
+ Provides-Extra: docs
58
+ Requires-Dist: sphinx>=7.0.0; extra == "docs"
59
+ Requires-Dist: sphinx-book-theme>=1.0.0; extra == "docs"
60
+ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
61
+ Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
62
+ Provides-Extra: edge
63
+ Requires-Dist: tensorrt>=8.6.0; extra == "edge"
64
+ Requires-Dist: onnxruntime-gpu>=1.16.0; extra == "edge"
65
+ Provides-Extra: all
66
+ Requires-Dist: saara-ai[dev,docs,edge]; extra == "all"
67
+ Dynamic: license-file
68
+
69
+ # SAARA
70
+
71
+ **End-to-end ML pipeline for dataset creation, fine-tuning, evaluation, and edge deployment with Gradio GUI**
72
+
73
+ ## Features
74
+
75
+ - 📄 **PDF to JSON Dataset Creation** - Extract text from PDFs and generate structured training data using local LLMs (vLLM, Ollama, llama.cpp)
76
+ - 🤖 **Synthetic Data Generation** - Create high-quality training data in multiple formats (Factual, Reasoning, Conversational, Instruction, Code, Creative)
77
+ - 🎯 **Fine-Tuning** - QLoRA/LoRA fine-tuning with Unsloth for fast, memory-efficient training
78
+ - 📊 **Comprehensive Evaluation** - Teacher-student comparison, standard benchmarks (MMLU, GSM8K, HumanEval), performance metrics, power consumption tracking
79
+ - 📦 **Model Export & Quantization** - Export to multiple formats (GGUF, AWQ, GPTQ, ONNX, TensorRT, Safetensors) with 2/3/4/8-bit quantization
80
+ - 🖥️ **Gradio GUI** - Visual interface for the entire pipeline with auto-generation from Python scripts
81
+
82
+ ## Installation
83
+
84
+ ```bash
85
+ # Clone repository
86
+ git clone https://github.com/nikhil49023/saara-ai.git
87
+ cd saara-ai
88
+
89
+ # Install package
90
+ pip install -e .
91
+
92
+ # For development
93
+ pip install -e ".[dev]"
94
+
95
+ # For edge deployment
96
+ pip install -e ".[edge]"
97
+ ```
98
+
99
+ ## Quick Start
100
+
101
+ ### 1. Launch GUI
102
+
103
+ ```bash
104
+ saara gui
105
+ ```
106
+
107
+ Or in Python:
108
+ ```python
109
+ from saara import SaaraDashboard
110
+
111
+ dashboard = SaaraDashboard()
112
+ dashboard.launch()
113
+ ```
114
+
115
+ ### 2. Create Dataset from PDF
116
+
117
+ ```python
118
+ from saara import DatasetBuilder
119
+ from saara.dataset.types import DataType
120
+ from saara.providers.ollama_provider import OllamaProvider, ProviderConfig
121
+
122
+ # Setup provider
123
+ config = ProviderConfig(model="mistral", base_url="http://localhost:11434")
124
+ provider = OllamaProvider(config)
125
+
126
+ # Create dataset
127
+ builder = DatasetBuilder(provider)
128
+ samples = builder.from_pdf(
129
+ "document.pdf",
130
+ data_types=[DataType.INSTRUCTION, DataType.FACTUAL],
131
+ pairs_per_type=5,
132
+ )
133
+
134
+ # Save
135
+ builder.save(samples, "dataset.jsonl")
136
+ ```
137
+
138
+ ### 3. Fine-Tune Model
139
+
140
+ ```python
141
+ from saara import FineTuner
142
+ from saara.training.config import TrainingConfig
143
+
144
+ config = TrainingConfig(
145
+ model_name="mistralai/Mistral-7B-v0.1",
146
+ num_train_epochs=3,
147
+ use_lora=True,
148
+ )
149
+
150
+ finetuner = FineTuner(config)
151
+ finetuner.train("dataset.jsonl")
152
+ finetuner.save("./output/models/my-finetune")
153
+ ```
154
+
155
+ ### 4. Evaluate with Teacher Comparison
156
+
157
+ ```python
158
+ from saara import ModelEvaluator
159
+ from saara.providers.ollama_provider import OllamaProvider, ProviderConfig
160
+
161
+ student = OllamaProvider(ProviderConfig(model="mistral-7b-finetuned"))
162
+ teacher = OllamaProvider(ProviderConfig(model="llama-3-70b"))
163
+
164
+ evaluator = ModelEvaluator(student, teacher)
165
+ metrics = evaluator.evaluate(
166
+ "test.jsonl",
167
+ run_benchmarks=True,
168
+ benchmark_names=["mmlu", "gsm8k"],
169
+ )
170
+
171
+ print(metrics.summary())
172
+ ```
173
+
174
+ ### 5. Export & Quantize
175
+
176
+ ```python
177
+ from saara import ModelExporter
178
+ from saara.export.formats import ExportFormat
179
+ from saara.export.quantization import QuantizationConfig
180
+
181
+ config = QuantizationConfig(bits=4)
182
+ exporter = ModelExporter("./output/models/my-finetune", config)
183
+
184
+ results = exporter.export(
185
+ "./output/exports",
186
+ formats=[ExportFormat.GGUF, ExportFormat.AWQ, ExportFormat.ONNX],
187
+ quantize=True,
188
+ )
189
+ ```
190
+
191
+ ## CLI Commands
192
+
193
+ ```bash
194
+ # Dataset creation
195
+ saara dataset from-pdf document.pdf -o ./output --data-types instruction factual
196
+ saara dataset from-text text.txt -o ./output
197
+
198
+ # Training
199
+ saara train finetune dataset.jsonl --model mistralai/Mistral-7B-v0.1 --epochs 3
200
+
201
+ # Evaluation
202
+ saara eval model test.jsonl --model mistral --teacher llama-3-70b --benchmarks mmlu gsm8k
203
+
204
+ # Export
205
+ saara export model ./models/final --formats gguf awq --quantize --bits 4
206
+
207
+ # GUI
208
+ saara gui --port 7860
209
+ ```
210
+
211
+ ## Examples
212
+
213
+ See the `examples/` directory for complete workflows:
214
+
215
+ - `01_pdf_to_dataset.py` - Extract and create dataset from PDF
216
+ - `02_synthetic_data.py` - Generate synthetic training data
217
+ - `03_finetune.py` - Fine-tune a model with QLoRA
218
+ - `04_evaluate.py` - Evaluate with teacher comparison
219
+ - `05_export.py` - Export to multiple formats
220
+ - `06_complete_pipeline.py` - End-to-end workflow
221
+ - `07_gui.py` - Launch Gradio GUI
222
+
223
+ ## Architecture
224
+
225
+ ```
226
+ saara/
227
+ ├── providers/ # Model providers (vLLM, Ollama, llama.cpp)
228
+ ├── dataset/ # Dataset creation (PDF extraction, synthetic generation)
229
+ ├── training/ # Fine-tuning pipelines (QLoRA, LoRA)
230
+ ├── evaluation/ # Evaluation (benchmarks, teacher-student, power)
231
+ ├── export/ # Export & quantization (GGUF, AWQ, GPTQ, ONNX, TensorRT)
232
+ ├── gui/ # Gradio components and dashboard
233
+ ├── cli/ # Command-line interface
234
+ └── utils/ # Utilities (I/O, logging, memory)
235
+ ```
236
+
237
+ ## Supported Formats
238
+
239
+ ### Dataset Output
240
+ - Alpaca
241
+ - ChatML
242
+ - ShareGPT
243
+ - DPO
244
+ - Completion
245
+ - JSONL
246
+
247
+ ### Model Export
248
+ - **Safetensors** - HuggingFace compatible
249
+ - **GGUF** - llama.cpp CPU/metal inference
250
+ - **AWQ** - NVIDIA GPU optimized (4-bit)
251
+ - **GPTQ** - Quantized inference
252
+ - **ONNX** - Cross-platform deployment
253
+ - **TensorRT** - NVIDIA Jetson edge deployment
254
+
255
+ ## Benchmarks
256
+
257
+ Standard benchmarks supported:
258
+ - MMLU (Multi-task Language Understanding)
259
+ - GSM8K (Grade School Math)
260
+ - HumanEval (Code Generation)
261
+ - BoolQ (Boolean Questions)
262
+ - HellaSwag (Commonsense NLI)
263
+ - TruthfulQA
264
+ - WinoGrande
265
+ - ARC Easy/Challenge
266
+
267
+ ## Metrics Tracked
268
+
269
+ - **Accuracy** - Task performance
270
+ - **Perplexity** - Language modeling quality
271
+ - **Speed** - Tokens/sec, latency
272
+ - **Memory** - VRAM usage
273
+ - **Power** - Watts, energy, carbon footprint
274
+ - **Teacher Agreement** - Student-teacher alignment
275
+ - **Hallucination Rate** - Factual accuracy
276
+
277
+ ## Requirements
278
+
279
+ - Python 3.10+
280
+ - CUDA 11.8+ (for GPU features)
281
+ - 8GB+ VRAM recommended for fine-tuning
282
+ - 16GB+ VRAM for larger models
283
+
284
+ ## Development
285
+
286
+ ```bash
287
+ # Install dev dependencies
288
+ pip install -e ".[dev]"
289
+
290
+ # Run tests
291
+ pytest tests/
292
+
293
+ # Format code
294
+ black saara/
295
+ ruff check saara/
296
+
297
+ # Type checking
298
+ mypy saara/
299
+ ```
300
+
301
+ ## License
302
+
303
+ MIT License - see [LICENSE](LICENSE)
304
+
305
+ ## Contributing
306
+
307
+ Contributions welcome! Please read our contributing guidelines before submitting PRs.
308
+
309
+ ## Citation
310
+
311
+ ```bibtex
312
+ @software{saara2024,
313
+ title = {SAARA: End-to-End ML Pipeline},
314
+ author = {Kilani Sai Nikhil},
315
+ year = {2024},
316
+ url = {https://github.com/nikhil49023/saara-ai},
317
+ }
318
+ ```
@@ -0,0 +1,250 @@
1
+ # SAARA
2
+
3
+ **End-to-end ML pipeline for dataset creation, fine-tuning, evaluation, and edge deployment with Gradio GUI**
4
+
5
+ ## Features
6
+
7
+ - 📄 **PDF to JSON Dataset Creation** - Extract text from PDFs and generate structured training data using local LLMs (vLLM, Ollama, llama.cpp)
8
+ - 🤖 **Synthetic Data Generation** - Create high-quality training data in multiple formats (Factual, Reasoning, Conversational, Instruction, Code, Creative)
9
+ - 🎯 **Fine-Tuning** - QLoRA/LoRA fine-tuning with Unsloth for fast, memory-efficient training
10
+ - 📊 **Comprehensive Evaluation** - Teacher-student comparison, standard benchmarks (MMLU, GSM8K, HumanEval), performance metrics, power consumption tracking
11
+ - 📦 **Model Export & Quantization** - Export to multiple formats (GGUF, AWQ, GPTQ, ONNX, TensorRT, Safetensors) with 2/3/4/8-bit quantization
12
+ - 🖥️ **Gradio GUI** - Visual interface for the entire pipeline with auto-generation from Python scripts
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ # Clone repository
18
+ git clone https://github.com/nikhil49023/saara-ai.git
19
+ cd saara-ai
20
+
21
+ # Install package
22
+ pip install -e .
23
+
24
+ # For development
25
+ pip install -e ".[dev]"
26
+
27
+ # For edge deployment
28
+ pip install -e ".[edge]"
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ### 1. Launch GUI
34
+
35
+ ```bash
36
+ saara gui
37
+ ```
38
+
39
+ Or in Python:
40
+ ```python
41
+ from saara import SaaraDashboard
42
+
43
+ dashboard = SaaraDashboard()
44
+ dashboard.launch()
45
+ ```
46
+
47
+ ### 2. Create Dataset from PDF
48
+
49
+ ```python
50
+ from saara import DatasetBuilder
51
+ from saara.dataset.types import DataType
52
+ from saara.providers.ollama_provider import OllamaProvider, ProviderConfig
53
+
54
+ # Setup provider
55
+ config = ProviderConfig(model="mistral", base_url="http://localhost:11434")
56
+ provider = OllamaProvider(config)
57
+
58
+ # Create dataset
59
+ builder = DatasetBuilder(provider)
60
+ samples = builder.from_pdf(
61
+ "document.pdf",
62
+ data_types=[DataType.INSTRUCTION, DataType.FACTUAL],
63
+ pairs_per_type=5,
64
+ )
65
+
66
+ # Save
67
+ builder.save(samples, "dataset.jsonl")
68
+ ```
69
+
70
+ ### 3. Fine-Tune Model
71
+
72
+ ```python
73
+ from saara import FineTuner
74
+ from saara.training.config import TrainingConfig
75
+
76
+ config = TrainingConfig(
77
+ model_name="mistralai/Mistral-7B-v0.1",
78
+ num_train_epochs=3,
79
+ use_lora=True,
80
+ )
81
+
82
+ finetuner = FineTuner(config)
83
+ finetuner.train("dataset.jsonl")
84
+ finetuner.save("./output/models/my-finetune")
85
+ ```
86
+
87
+ ### 4. Evaluate with Teacher Comparison
88
+
89
+ ```python
90
+ from saara import ModelEvaluator
91
+ from saara.providers.ollama_provider import OllamaProvider, ProviderConfig
92
+
93
+ student = OllamaProvider(ProviderConfig(model="mistral-7b-finetuned"))
94
+ teacher = OllamaProvider(ProviderConfig(model="llama-3-70b"))
95
+
96
+ evaluator = ModelEvaluator(student, teacher)
97
+ metrics = evaluator.evaluate(
98
+ "test.jsonl",
99
+ run_benchmarks=True,
100
+ benchmark_names=["mmlu", "gsm8k"],
101
+ )
102
+
103
+ print(metrics.summary())
104
+ ```
105
+
106
+ ### 5. Export & Quantize
107
+
108
+ ```python
109
+ from saara import ModelExporter
110
+ from saara.export.formats import ExportFormat
111
+ from saara.export.quantization import QuantizationConfig
112
+
113
+ config = QuantizationConfig(bits=4)
114
+ exporter = ModelExporter("./output/models/my-finetune", config)
115
+
116
+ results = exporter.export(
117
+ "./output/exports",
118
+ formats=[ExportFormat.GGUF, ExportFormat.AWQ, ExportFormat.ONNX],
119
+ quantize=True,
120
+ )
121
+ ```
122
+
123
+ ## CLI Commands
124
+
125
+ ```bash
126
+ # Dataset creation
127
+ saara dataset from-pdf document.pdf -o ./output --data-types instruction factual
128
+ saara dataset from-text text.txt -o ./output
129
+
130
+ # Training
131
+ saara train finetune dataset.jsonl --model mistralai/Mistral-7B-v0.1 --epochs 3
132
+
133
+ # Evaluation
134
+ saara eval model test.jsonl --model mistral --teacher llama-3-70b --benchmarks mmlu gsm8k
135
+
136
+ # Export
137
+ saara export model ./models/final --formats gguf awq --quantize --bits 4
138
+
139
+ # GUI
140
+ saara gui --port 7860
141
+ ```
142
+
143
+ ## Examples
144
+
145
+ See the `examples/` directory for complete workflows:
146
+
147
+ - `01_pdf_to_dataset.py` - Extract and create dataset from PDF
148
+ - `02_synthetic_data.py` - Generate synthetic training data
149
+ - `03_finetune.py` - Fine-tune a model with QLoRA
150
+ - `04_evaluate.py` - Evaluate with teacher comparison
151
+ - `05_export.py` - Export to multiple formats
152
+ - `06_complete_pipeline.py` - End-to-end workflow
153
+ - `07_gui.py` - Launch Gradio GUI
154
+
155
+ ## Architecture
156
+
157
+ ```
158
+ saara/
159
+ ├── providers/ # Model providers (vLLM, Ollama, llama.cpp)
160
+ ├── dataset/ # Dataset creation (PDF extraction, synthetic generation)
161
+ ├── training/ # Fine-tuning pipelines (QLoRA, LoRA)
162
+ ├── evaluation/ # Evaluation (benchmarks, teacher-student, power)
163
+ ├── export/ # Export & quantization (GGUF, AWQ, GPTQ, ONNX, TensorRT)
164
+ ├── gui/ # Gradio components and dashboard
165
+ ├── cli/ # Command-line interface
166
+ └── utils/ # Utilities (I/O, logging, memory)
167
+ ```
168
+
169
+ ## Supported Formats
170
+
171
+ ### Dataset Output
172
+ - Alpaca
173
+ - ChatML
174
+ - ShareGPT
175
+ - DPO
176
+ - Completion
177
+ - JSONL
178
+
179
+ ### Model Export
180
+ - **Safetensors** - HuggingFace compatible
181
+ - **GGUF** - llama.cpp CPU/metal inference
182
+ - **AWQ** - NVIDIA GPU optimized (4-bit)
183
+ - **GPTQ** - Quantized inference
184
+ - **ONNX** - Cross-platform deployment
185
+ - **TensorRT** - NVIDIA Jetson edge deployment
186
+
187
+ ## Benchmarks
188
+
189
+ Standard benchmarks supported:
190
+ - MMLU (Multi-task Language Understanding)
191
+ - GSM8K (Grade School Math)
192
+ - HumanEval (Code Generation)
193
+ - BoolQ (Boolean Questions)
194
+ - HellaSwag (Commonsense NLI)
195
+ - TruthfulQA
196
+ - WinoGrande
197
+ - ARC Easy/Challenge
198
+
199
+ ## Metrics Tracked
200
+
201
+ - **Accuracy** - Task performance
202
+ - **Perplexity** - Language modeling quality
203
+ - **Speed** - Tokens/sec, latency
204
+ - **Memory** - VRAM usage
205
+ - **Power** - Watts, energy, carbon footprint
206
+ - **Teacher Agreement** - Student-teacher alignment
207
+ - **Hallucination Rate** - Factual accuracy
208
+
209
+ ## Requirements
210
+
211
+ - Python 3.10+
212
+ - CUDA 11.8+ (for GPU features)
213
+ - 8GB+ VRAM recommended for fine-tuning
214
+ - 16GB+ VRAM for larger models
215
+
216
+ ## Development
217
+
218
+ ```bash
219
+ # Install dev dependencies
220
+ pip install -e ".[dev]"
221
+
222
+ # Run tests
223
+ pytest tests/
224
+
225
+ # Format code
226
+ black saara/
227
+ ruff check saara/
228
+
229
+ # Type checking
230
+ mypy saara/
231
+ ```
232
+
233
+ ## License
234
+
235
+ MIT License - see [LICENSE](LICENSE)
236
+
237
+ ## Contributing
238
+
239
+ Contributions welcome! Please read our contributing guidelines before submitting PRs.
240
+
241
+ ## Citation
242
+
243
+ ```bibtex
244
+ @software{saara2024,
245
+ title = {SAARA: End-to-End ML Pipeline},
246
+ author = {Kilani Sai Nikhil},
247
+ year = {2024},
248
+ url = {https://github.com/nikhil49023/saara-ai},
249
+ }
250
+ ```
@@ -0,0 +1,125 @@
1
+ [project]
2
+ name = "saara-ai"
3
+ version = "0.1.0"
4
+ description = "End-to-end ML pipeline: PDF→JSON datasets, synthetic data, fine-tuning, evaluation, and edge deployment with Gradio GUI"
5
+ authors = [{name = "Kilani Sai Nikhil", email = "nikhil49023@gmail.com"}]
6
+ maintainers = [{name = "Kilani Sai Nikhil", email = "nikhil49023@gmail.com"}]
7
+ readme = "README.md"
8
+ license = "MIT"
9
+ requires-python = ">=3.10"
10
+ keywords = ["saara", "ml", "llm", "fine-tuning", "synthetic-data", "pdf", "vllm", "gradio"]
11
+ classifiers = [
12
+ "Development Status :: 3 - Alpha",
13
+ "Intended Audience :: Developers",
14
+ "Intended Audience :: Science/Research",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
21
+ ]
22
+ dependencies = [
23
+ # Core ML
24
+ "torch>=2.1.0",
25
+ "transformers>=4.36.0",
26
+ "accelerate>=0.25.0",
27
+ "datasets>=2.14.0",
28
+
29
+ # Fine-tuning
30
+ "unsloth>=2024.1",
31
+ "trl>=0.7.0",
32
+ "peft>=0.7.0",
33
+ "bitsandbytes>=0.41.0",
34
+
35
+ # Inference (local)
36
+ "vllm>=0.2.0",
37
+ "ollama>=0.1.0",
38
+ "llama-cpp-python>=0.2.0",
39
+
40
+ # PDF Processing
41
+ "pymupdf>=1.23.0",
42
+ "pdfplumber>=0.10.0",
43
+
44
+ # Export & Quantization
45
+ "autoawq>=0.2.0",
46
+ "auto-gptq>=0.5.0",
47
+ "onnx>=1.15.0",
48
+ "gguf>=0.1.0",
49
+
50
+ # Evaluation & Benchmarks
51
+ "lm-eval>=0.4.0",
52
+ "lighteval>=0.4.0",
53
+
54
+ # Power & Performance
55
+ "pynvml>=11.5.0",
56
+ "codecarbon>=2.0.0",
57
+ "psutil>=5.9.0",
58
+
59
+ # Gradio GUI
60
+ "gradio>=4.0.0",
61
+
62
+ # Utilities
63
+ "pyyaml>=6.0",
64
+ "tqdm>=4.66.0",
65
+ "rich>=13.0.0",
66
+ "click>=8.0.0",
67
+ ]
68
+
69
+ [project.optional-dependencies]
70
+ dev = [
71
+ "pytest>=7.0.0",
72
+ "pytest-cov>=4.0.0",
73
+ "black>=23.0.0",
74
+ "ruff>=0.1.0",
75
+ "mypy>=1.0.0",
76
+ ]
77
+ docs = [
78
+ "sphinx>=7.0.0",
79
+ "sphinx-book-theme>=1.0.0",
80
+ "mkdocs>=1.5.0",
81
+ "mkdocs-material>=9.0.0",
82
+ ]
83
+ edge = [
84
+ "tensorrt>=8.6.0",
85
+ "onnxruntime-gpu>=1.16.0",
86
+ ]
87
+ all = [
88
+ "saara-ai[dev,docs,edge]",
89
+ ]
90
+
91
+ [project.scripts]
92
+ saara = "saara.cli.main:cli"
93
+
94
+ [project.urls]
95
+ Homepage = "https://github.com/nikhil49023/saara-ai"
96
+ Repository = "https://github.com/nikhil49023/saara-ai"
97
+ Documentation = "https://saara-ai.readthedocs.io"
98
+
99
+ [build-system]
100
+ requires = ["setuptools>=61.0", "wheel"]
101
+ build-backend = "setuptools.build_meta"
102
+
103
+ [tool.setuptools.packages.find]
104
+ where = ["."]
105
+ include = ["saara*"]
106
+
107
+ [tool.black]
108
+ line-length = 100
109
+ target-version = ["py310", "py311", "py312"]
110
+
111
+ [tool.ruff]
112
+ line-length = 100
113
+ select = ["E", "F", "W", "I", "N", "UP"]
114
+ ignore = ["E501"]
115
+
116
+ [tool.mypy]
117
+ python_version = "3.10"
118
+ warn_return_any = true
119
+ warn_unused_configs = true
120
+ disallow_untyped_defs = false
121
+
122
+ [tool.pytest.ini_options]
123
+ testpaths = ["tests"]
124
+ python_files = "test_*.py"
125
+ addopts = "-v --cov=saara"