Skip to main content

AI Exam Preparation System with TUI, GUI, and Streamlit

Project description

PrepForge

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.


Overview

PrepForge is designed as a unified interface for:

  • Running local language models
  • Managing multiple model backends (Hugging Face and GGUF)
  • Applying LoRA adapters dynamically
  • Generating study material (notes, MCQs, plans, practice)
  • Training custom models using QLoRA / Unsloth

The system separates concerns between configuration, model loading, and interface layers.


Tech Stack

Category Technologies / Tools Purpose
Core Python 3.10+, Transformers, PEFT, HF Hub Model loading, LoRA support, model management
Inference Backend PyTorch, llama-cpp-python Running HF models (GPU/CPU) and GGUF models
Interfaces Rich, prompt_toolkit, PyQt6, Streamlit TUI, CLI input, GUI, and Web interface
Training Unsloth, TRL, Datasets Fine-tuning models using QLoRA pipelines
System Utilities fzf (optional), subprocess, JSON Model selection, CLI execution, config storage

Installation

Base Installation

pip install prepforge

Optional Features

pip install prepforge[gguf]        # GGUF (llama.cpp) support
pip install prepforge[gpu]         # CUDA / torch support
pip install prepforge[web]         # Streamlit interface
pip install prepforge[gui]         # PyQt6 GUI
pip install prepforge[train]       # Training dependencies
pip install prepforge[gguf,gpu,web,gui]

Architecture

CLI Layer (cli.py)

Handles:

  • Running interfaces
  • Model installation
  • Configuration
  • Training commands

Core Layer (core/)

  • model.py: Loads HF and GGUF models, applies LoRA
  • utils.py: Prompt building and streaming
  • train.py: Fine-tuning pipeline

Interface Layer

  • tui_app.py: Terminal UI (Rich)
  • gui_app.py: Desktop GUI (PyQt6)
  • streamlit_app.py: Web UI

Configuration Layer

Stored at:

~/.prepforce/config.json

Model Support

Hugging Face Models

  • Loaded via transformers
  • Cached automatically
  • Supports LoRA

Examples:

meta-llama/Llama-3-8B
mistralai/Mistral-7B-Instruct

GGUF Models

  • Single-file models
  • Run via llama.cpp
  • Lower resource usage

Example:

Qwen3-4B-Q4_1.gguf

LoRA Adapters

  • Lightweight fine-tuned layers
  • Applied on top of base HF models
  • Must match base architecture

Model Installation

prepforge install_model

Features:

  • Browse models from Hugging Face
  • Filter by type (GGUF / HF / LoRA)
  • Install:
    • GGUF → single file
    • HF → full snapshot
    • LoRA → adapter files

Storage:

  • GGUF → ~/models
  • HF → ~/.cache/huggingface/hub

Configuration

Set default model:

prepforge config --model <model_path_or_repo>

Set LoRA:

prepforge config --lora <adapter_path>

Interactive selection:

prepforge config

Running the Application

Modes:

  • Chat
  • Notes
  • MCQ generation
  • Study plan
  • Practice

Terminal UI

prepforge run tui

Desktop GUI

prepforge run gui

Web Interface

prepforge run streamlit

Open:

http://localhost:8501

Inference Flow

  1. Load model from config
  2. Detect backend:
    • GGUF → llama.cpp
    • HF → transformers
  3. Apply LoRA if provided
  4. Build prompt
  5. Generate response (streaming)

Training

prepforge train \
  --dataset dataset.jsonl \
  --epochs 3 \
  --output trained_model

Options:

  • --limit → limit samples
  • --subset → percentage of dataset
  • --lr → learning rate

Dataset Format

{
  "instruction": "Explain Newton's laws",
  "input": "",
  "output": "Newton's laws describe motion..."
}

Project Structure

major_project/
├── core/
│   ├── model.py
│   ├── train.py
│   └── utils.py
├── tui_app.py
├── gui_app.py
├── streamlit_app.py
├── cli.py
├── config.py

Requirements

  • Python 3.10+
  • CUDA GPU recommended for HF models

Notes

  • Models are not bundled
  • Must be installed separately
  • GGUF requires llama-cpp-python
  • LoRA must match base model

Author

Himanshu Arora


License

MIT License

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

prepforge-0.2.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prepforge-0.2.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file prepforge-0.2.0.tar.gz.

File metadata

  • Download URL: prepforge-0.2.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for prepforge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9950482d110bcf0b74836041ea1ebb0a1ff41816cd2bbc64b0f616f5e6cde981
MD5 3335c88dcb865ec22207ee9d9f1584dd
BLAKE2b-256 f287fe1f9f99947f47e64ef296a7f05f0f00994c82df1dab4f03b6b395d15932

See more details on using hashes here.

File details

Details for the file prepforge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: prepforge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for prepforge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b47dc41e467e8d5a6c2f3cfa3301843a35fab272206df155f5fe83bf00c09811
MD5 2fa902405527f5a882d81a6952daf0aa
BLAKE2b-256 02ab4812dd9241e1bf4b6909cea6ad888be4154c0c30c8fa75982c78df0ecc73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page