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.1.tar.gz (17.1 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.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prepforge-0.2.1.tar.gz
  • Upload date:
  • Size: 17.1 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.1.tar.gz
Algorithm Hash digest
SHA256 53d61c5b656353227ae45a332e93f3e998b8d65697953edcce8f6e96e7af8413
MD5 eb4d6898b178ab1c9ab6e3647662cdb0
BLAKE2b-256 6a0536f5899cc345020542cefd7fcfdfcdc337ececa3f423ee151257e04c9cd0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prepforge-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 913143d0517c1f751804f742fc9f2b713ff3308e419cd514fe6c55be18c386a7
MD5 aed27c8a09d70a0c3efdc580e44f2890
BLAKE2b-256 cc46255712107fb9f7fbacccd38ec3e7f8ae018f451f433c42fe3d54c70df6b2

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