prepforge 0.1.0__tar.gz → 0.2.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 (28) hide show
  1. prepforge-0.2.0/PKG-INFO +306 -0
  2. prepforge-0.2.0/README.md +276 -0
  3. prepforge-0.2.0/major_project/cli.py +358 -0
  4. prepforge-0.2.0/major_project/core/model.py +95 -0
  5. prepforge-0.1.0/major_project/streamlit_app.py → prepforge-0.2.0/major_project/core/train.py +52 -11
  6. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/gui_app.py +49 -15
  7. prepforge-0.2.0/major_project/streamlit_app.py +210 -0
  8. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/tui_app.py +53 -22
  9. prepforge-0.2.0/prepforge.egg-info/PKG-INFO +306 -0
  10. {prepforge-0.1.0 → prepforge-0.2.0}/prepforge.egg-info/requires.txt +3 -0
  11. {prepforge-0.1.0 → prepforge-0.2.0}/pyproject.toml +2 -1
  12. prepforge-0.1.0/PKG-INFO +0 -149
  13. prepforge-0.1.0/README.md +0 -121
  14. prepforge-0.1.0/major_project/cli.py +0 -186
  15. prepforge-0.1.0/major_project/core/model.py +0 -112
  16. prepforge-0.1.0/major_project/core/train.py +0 -149
  17. prepforge-0.1.0/prepforge.egg-info/PKG-INFO +0 -149
  18. {prepforge-0.1.0 → prepforge-0.2.0}/LICENSE +0 -0
  19. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/__init__.py +0 -0
  20. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/config.py +0 -0
  21. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/core/__init__.py +0 -0
  22. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/core/config_store.py +0 -0
  23. {prepforge-0.1.0 → prepforge-0.2.0}/major_project/core/utils.py +0 -0
  24. {prepforge-0.1.0 → prepforge-0.2.0}/prepforge.egg-info/SOURCES.txt +0 -0
  25. {prepforge-0.1.0 → prepforge-0.2.0}/prepforge.egg-info/dependency_links.txt +0 -0
  26. {prepforge-0.1.0 → prepforge-0.2.0}/prepforge.egg-info/entry_points.txt +0 -0
  27. {prepforge-0.1.0 → prepforge-0.2.0}/prepforge.egg-info/top_level.txt +0 -0
  28. {prepforge-0.1.0 → prepforge-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,306 @@
1
+ Metadata-Version: 2.4
2
+ Name: prepforge
3
+ Version: 0.2.0
4
+ Summary: AI Exam Preparation System with TUI, GUI, and Streamlit
5
+ Author: Himanshu Arora
6
+ License-Expression: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: transformers
13
+ Requires-Dist: peft
14
+ Requires-Dist: rich
15
+ Requires-Dist: prompt_toolkit
16
+ Provides-Extra: gui
17
+ Requires-Dist: PyQt6; extra == "gui"
18
+ Provides-Extra: web
19
+ Requires-Dist: streamlit; extra == "web"
20
+ Provides-Extra: train
21
+ Requires-Dist: datasets; extra == "train"
22
+ Requires-Dist: trl; extra == "train"
23
+ Provides-Extra: gpu
24
+ Requires-Dist: torch; extra == "gpu"
25
+ Provides-Extra: fast
26
+ Requires-Dist: unsloth; extra == "fast"
27
+ Provides-Extra: gguf
28
+ Requires-Dist: llama-cpp-python; extra == "gguf"
29
+ Dynamic: license-file
30
+
31
+ # PrepForge
32
+
33
+ PrepForge is a modular AI-powered exam preparation system that provides multiple interfaces (TUI, GUI, and Web) for interacting with large language models. It supports both Hugging Face transformer models and GGUF-based models via llama.cpp, along with optional LoRA adapters and a built-in training pipeline.
34
+
35
+ ---
36
+
37
+ ## Overview
38
+
39
+ PrepForge is designed as a unified interface for:
40
+
41
+ - Running local language models
42
+ - Managing multiple model backends (Hugging Face and GGUF)
43
+ - Applying LoRA adapters dynamically
44
+ - Generating study material (notes, MCQs, plans, practice)
45
+ - Training custom models using QLoRA / Unsloth
46
+
47
+ The system separates concerns between configuration, model loading, and interface layers.
48
+
49
+ ---
50
+
51
+ ## Tech Stack
52
+
53
+ | Category | Technologies / Tools | Purpose |
54
+ |--------------------|----------------------------------------------|--------|
55
+ | Core | Python 3.10+, Transformers, PEFT, HF Hub | Model loading, LoRA support, model management |
56
+ | Inference Backend | PyTorch, llama-cpp-python | Running HF models (GPU/CPU) and GGUF models |
57
+ | Interfaces | Rich, prompt_toolkit, PyQt6, Streamlit | TUI, CLI input, GUI, and Web interface |
58
+ | Training | Unsloth, TRL, Datasets | Fine-tuning models using QLoRA pipelines |
59
+ | System Utilities | fzf (optional), subprocess, JSON | Model selection, CLI execution, config storage |
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ ### Base Installation
65
+
66
+ ```bash
67
+ pip install prepforge
68
+ ```
69
+
70
+ ### Optional Features
71
+
72
+ ```bash
73
+ pip install prepforge[gguf] # GGUF (llama.cpp) support
74
+ pip install prepforge[gpu] # CUDA / torch support
75
+ pip install prepforge[web] # Streamlit interface
76
+ pip install prepforge[gui] # PyQt6 GUI
77
+ pip install prepforge[train] # Training dependencies
78
+ pip install prepforge[gguf,gpu,web,gui]
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Architecture
84
+
85
+ ### CLI Layer (`cli.py`)
86
+ Handles:
87
+ - Running interfaces
88
+ - Model installation
89
+ - Configuration
90
+ - Training commands
91
+
92
+ ### Core Layer (`core/`)
93
+ - `model.py`: Loads HF and GGUF models, applies LoRA
94
+ - `utils.py`: Prompt building and streaming
95
+ - `train.py`: Fine-tuning pipeline
96
+
97
+ ### Interface Layer
98
+ - `tui_app.py`: Terminal UI (Rich)
99
+ - `gui_app.py`: Desktop GUI (PyQt6)
100
+ - `streamlit_app.py`: Web UI
101
+
102
+ ### Configuration Layer
103
+ Stored at:
104
+
105
+ ```
106
+ ~/.prepforce/config.json
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Model Support
112
+
113
+ ### Hugging Face Models
114
+ - Loaded via `transformers`
115
+ - Cached automatically
116
+ - Supports LoRA
117
+
118
+ Examples:
119
+ ```
120
+ meta-llama/Llama-3-8B
121
+ mistralai/Mistral-7B-Instruct
122
+ ```
123
+
124
+ ---
125
+
126
+ ### GGUF Models
127
+ - Single-file models
128
+ - Run via llama.cpp
129
+ - Lower resource usage
130
+
131
+ Example:
132
+ ```
133
+ Qwen3-4B-Q4_1.gguf
134
+ ```
135
+
136
+ ---
137
+
138
+ ### LoRA Adapters
139
+ - Lightweight fine-tuned layers
140
+ - Applied on top of base HF models
141
+ - Must match base architecture
142
+
143
+ ---
144
+
145
+ ## Model Installation
146
+
147
+ ```bash
148
+ prepforge install_model
149
+ ```
150
+
151
+ Features:
152
+ - Browse models from Hugging Face
153
+ - Filter by type (GGUF / HF / LoRA)
154
+ - Install:
155
+ - GGUF → single file
156
+ - HF → full snapshot
157
+ - LoRA → adapter files
158
+
159
+ Storage:
160
+ - GGUF → `~/models`
161
+ - HF → `~/.cache/huggingface/hub`
162
+
163
+ ---
164
+
165
+ ## Configuration
166
+
167
+ Set default model:
168
+
169
+ ```bash
170
+ prepforge config --model <model_path_or_repo>
171
+ ```
172
+
173
+ Set LoRA:
174
+
175
+ ```bash
176
+ prepforge config --lora <adapter_path>
177
+ ```
178
+
179
+ Interactive selection:
180
+
181
+ ```bash
182
+ prepforge config
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Running the Application
188
+
189
+ Modes:
190
+ - Chat
191
+ - Notes
192
+ - MCQ generation
193
+ - Study plan
194
+ - Practice
195
+
196
+ ### Terminal UI
197
+
198
+ ```bash
199
+ prepforge run tui
200
+ ```
201
+
202
+ ---
203
+
204
+ ### Desktop GUI
205
+
206
+ ```bash
207
+ prepforge run gui
208
+ ```
209
+
210
+ ---
211
+
212
+ ### Web Interface
213
+
214
+ ```bash
215
+ prepforge run streamlit
216
+ ```
217
+
218
+ Open:
219
+ ```
220
+ http://localhost:8501
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Inference Flow
226
+
227
+ 1. Load model from config
228
+ 2. Detect backend:
229
+ - GGUF → llama.cpp
230
+ - HF → transformers
231
+ 3. Apply LoRA if provided
232
+ 4. Build prompt
233
+ 5. Generate response (streaming)
234
+
235
+ ---
236
+
237
+ ## Training
238
+
239
+ ```bash
240
+ prepforge train \
241
+ --dataset dataset.jsonl \
242
+ --epochs 3 \
243
+ --output trained_model
244
+ ```
245
+
246
+ Options:
247
+ - `--limit` → limit samples
248
+ - `--subset` → percentage of dataset
249
+ - `--lr` → learning rate
250
+
251
+ ---
252
+
253
+ ## Dataset Format
254
+
255
+ ```json
256
+ {
257
+ "instruction": "Explain Newton's laws",
258
+ "input": "",
259
+ "output": "Newton's laws describe motion..."
260
+ }
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Project Structure
266
+
267
+ ```
268
+ major_project/
269
+ ├── core/
270
+ │ ├── model.py
271
+ │ ├── train.py
272
+ │ └── utils.py
273
+ ├── tui_app.py
274
+ ├── gui_app.py
275
+ ├── streamlit_app.py
276
+ ├── cli.py
277
+ ├── config.py
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Requirements
283
+
284
+ - Python 3.10+
285
+ - CUDA GPU recommended for HF models
286
+
287
+ ---
288
+
289
+ ## Notes
290
+
291
+ - Models are not bundled
292
+ - Must be installed separately
293
+ - GGUF requires `llama-cpp-python`
294
+ - LoRA must match base model
295
+
296
+ ---
297
+
298
+ ## Author
299
+
300
+ Himanshu Arora
301
+
302
+ ---
303
+
304
+ ## License
305
+
306
+ MIT License
@@ -0,0 +1,276 @@
1
+ # PrepForge
2
+
3
+ PrepForge is a modular AI-powered exam preparation system that provides multiple interfaces (TUI, GUI, and Web) for interacting with large language models. It supports both Hugging Face transformer models and GGUF-based models via llama.cpp, along with optional LoRA adapters and a built-in training pipeline.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ PrepForge is designed as a unified interface for:
10
+
11
+ - Running local language models
12
+ - Managing multiple model backends (Hugging Face and GGUF)
13
+ - Applying LoRA adapters dynamically
14
+ - Generating study material (notes, MCQs, plans, practice)
15
+ - Training custom models using QLoRA / Unsloth
16
+
17
+ The system separates concerns between configuration, model loading, and interface layers.
18
+
19
+ ---
20
+
21
+ ## Tech Stack
22
+
23
+ | Category | Technologies / Tools | Purpose |
24
+ |--------------------|----------------------------------------------|--------|
25
+ | Core | Python 3.10+, Transformers, PEFT, HF Hub | Model loading, LoRA support, model management |
26
+ | Inference Backend | PyTorch, llama-cpp-python | Running HF models (GPU/CPU) and GGUF models |
27
+ | Interfaces | Rich, prompt_toolkit, PyQt6, Streamlit | TUI, CLI input, GUI, and Web interface |
28
+ | Training | Unsloth, TRL, Datasets | Fine-tuning models using QLoRA pipelines |
29
+ | System Utilities | fzf (optional), subprocess, JSON | Model selection, CLI execution, config storage |
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ ### Base Installation
35
+
36
+ ```bash
37
+ pip install prepforge
38
+ ```
39
+
40
+ ### Optional Features
41
+
42
+ ```bash
43
+ pip install prepforge[gguf] # GGUF (llama.cpp) support
44
+ pip install prepforge[gpu] # CUDA / torch support
45
+ pip install prepforge[web] # Streamlit interface
46
+ pip install prepforge[gui] # PyQt6 GUI
47
+ pip install prepforge[train] # Training dependencies
48
+ pip install prepforge[gguf,gpu,web,gui]
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Architecture
54
+
55
+ ### CLI Layer (`cli.py`)
56
+ Handles:
57
+ - Running interfaces
58
+ - Model installation
59
+ - Configuration
60
+ - Training commands
61
+
62
+ ### Core Layer (`core/`)
63
+ - `model.py`: Loads HF and GGUF models, applies LoRA
64
+ - `utils.py`: Prompt building and streaming
65
+ - `train.py`: Fine-tuning pipeline
66
+
67
+ ### Interface Layer
68
+ - `tui_app.py`: Terminal UI (Rich)
69
+ - `gui_app.py`: Desktop GUI (PyQt6)
70
+ - `streamlit_app.py`: Web UI
71
+
72
+ ### Configuration Layer
73
+ Stored at:
74
+
75
+ ```
76
+ ~/.prepforce/config.json
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Model Support
82
+
83
+ ### Hugging Face Models
84
+ - Loaded via `transformers`
85
+ - Cached automatically
86
+ - Supports LoRA
87
+
88
+ Examples:
89
+ ```
90
+ meta-llama/Llama-3-8B
91
+ mistralai/Mistral-7B-Instruct
92
+ ```
93
+
94
+ ---
95
+
96
+ ### GGUF Models
97
+ - Single-file models
98
+ - Run via llama.cpp
99
+ - Lower resource usage
100
+
101
+ Example:
102
+ ```
103
+ Qwen3-4B-Q4_1.gguf
104
+ ```
105
+
106
+ ---
107
+
108
+ ### LoRA Adapters
109
+ - Lightweight fine-tuned layers
110
+ - Applied on top of base HF models
111
+ - Must match base architecture
112
+
113
+ ---
114
+
115
+ ## Model Installation
116
+
117
+ ```bash
118
+ prepforge install_model
119
+ ```
120
+
121
+ Features:
122
+ - Browse models from Hugging Face
123
+ - Filter by type (GGUF / HF / LoRA)
124
+ - Install:
125
+ - GGUF → single file
126
+ - HF → full snapshot
127
+ - LoRA → adapter files
128
+
129
+ Storage:
130
+ - GGUF → `~/models`
131
+ - HF → `~/.cache/huggingface/hub`
132
+
133
+ ---
134
+
135
+ ## Configuration
136
+
137
+ Set default model:
138
+
139
+ ```bash
140
+ prepforge config --model <model_path_or_repo>
141
+ ```
142
+
143
+ Set LoRA:
144
+
145
+ ```bash
146
+ prepforge config --lora <adapter_path>
147
+ ```
148
+
149
+ Interactive selection:
150
+
151
+ ```bash
152
+ prepforge config
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Running the Application
158
+
159
+ Modes:
160
+ - Chat
161
+ - Notes
162
+ - MCQ generation
163
+ - Study plan
164
+ - Practice
165
+
166
+ ### Terminal UI
167
+
168
+ ```bash
169
+ prepforge run tui
170
+ ```
171
+
172
+ ---
173
+
174
+ ### Desktop GUI
175
+
176
+ ```bash
177
+ prepforge run gui
178
+ ```
179
+
180
+ ---
181
+
182
+ ### Web Interface
183
+
184
+ ```bash
185
+ prepforge run streamlit
186
+ ```
187
+
188
+ Open:
189
+ ```
190
+ http://localhost:8501
191
+ ```
192
+
193
+ ---
194
+
195
+ ## Inference Flow
196
+
197
+ 1. Load model from config
198
+ 2. Detect backend:
199
+ - GGUF → llama.cpp
200
+ - HF → transformers
201
+ 3. Apply LoRA if provided
202
+ 4. Build prompt
203
+ 5. Generate response (streaming)
204
+
205
+ ---
206
+
207
+ ## Training
208
+
209
+ ```bash
210
+ prepforge train \
211
+ --dataset dataset.jsonl \
212
+ --epochs 3 \
213
+ --output trained_model
214
+ ```
215
+
216
+ Options:
217
+ - `--limit` → limit samples
218
+ - `--subset` → percentage of dataset
219
+ - `--lr` → learning rate
220
+
221
+ ---
222
+
223
+ ## Dataset Format
224
+
225
+ ```json
226
+ {
227
+ "instruction": "Explain Newton's laws",
228
+ "input": "",
229
+ "output": "Newton's laws describe motion..."
230
+ }
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Project Structure
236
+
237
+ ```
238
+ major_project/
239
+ ├── core/
240
+ │ ├── model.py
241
+ │ ├── train.py
242
+ │ └── utils.py
243
+ ├── tui_app.py
244
+ ├── gui_app.py
245
+ ├── streamlit_app.py
246
+ ├── cli.py
247
+ ├── config.py
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Requirements
253
+
254
+ - Python 3.10+
255
+ - CUDA GPU recommended for HF models
256
+
257
+ ---
258
+
259
+ ## Notes
260
+
261
+ - Models are not bundled
262
+ - Must be installed separately
263
+ - GGUF requires `llama-cpp-python`
264
+ - LoRA must match base model
265
+
266
+ ---
267
+
268
+ ## Author
269
+
270
+ Himanshu Arora
271
+
272
+ ---
273
+
274
+ ## License
275
+
276
+ MIT License