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.2.tar.gz (17.8 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.2-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prepforge-0.2.2.tar.gz
  • Upload date:
  • Size: 17.8 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.2.tar.gz
Algorithm Hash digest
SHA256 3b02a0565ef1ba3ba1d9d60645ee0fbdbd526452500a084b8d78ca8c7b07ae91
MD5 098464fdeaea6c3ad47884c4189653c1
BLAKE2b-256 34f4266ed496ec79f293d9904e9522137dacd56e050825c57b3f71066d182c73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prepforge-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 412ebe1be236e02f8ca891e8444661788f246f4096c7e438f00837fe391c0870
MD5 ef8312f54ede26c3c3cba72e3e1fb5bf
BLAKE2b-256 d08ec0e528dae6fc7b8196638559b90033439d2ff9fb3c74e6b8b0740f242694

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