This project runs a fully offline local LLM chat app from a USB drive on Windows using portable WinPython.
It is designed for restricted environments (no internet, no local installs).
- Put at least one
.ggufmodel file inmodels\. - Ensure portable Python exists under
WinPython\(for exampleWinPython\python-3.10.x.amd64\python.exe). - Install dependencies into that portable Python:
WinPython\python-3.10.x.amd64\python.exe -m pip install -r requirements.txt
- Double-click
Start_AI.bat. - In chat, type your question (
clearresets,exitquits).
LocalLLM/
├─ Start_AI.bat
├─ requirements.txt
├─ src/
│ └─ chat.py
├─ models/
│ └─ your-model.gguf
└─ WinPython/
└─ python-3.10.x.amd64/ (or similar folder containing python.exe)
- Loads the first
.ggufmodel frommodels/automatically. - Runs a terminal chat assistant with streaming output.
- Uses a system prompt that makes the AI behave like a university Machine Learning tutor.
- Manages context safely so large pasted text is less likely to crash the session.
Copy this project folder to your USB root (or any USB path), then ensure:
models/contains at least one.gguffile.WinPython/contains a portable Python withpython.exeinside.- Preferred path pattern:
WinPython\python-3.10.x.amd64\python.exe
- The launcher also falls back to searching recursively under
WinPython\.
- Preferred path pattern:
You must install llama-cpp-python into the portable WinPython environment.
If you can run online once on a staging machine:
WinPython\python-3.10.x.amd64\python.exe -m pip install -r requirements.txtThen move the fully prepared folder to USB.
- On a machine with internet, download wheels for your exact Python version/architecture:
python -m pip download -r requirements.txt -d wheels- Copy the
wheels/folder onto USB (inside project root). - On the restricted Windows machine, install from local wheels only:
WinPython\python-3.10.x.amd64\python.exe -m pip install --no-index --find-links wheels -r requirements.txtNotes:
- Wheel compatibility must match your WinPython version (for example cp310/cp311/cp313).
llama-cpp-pythonmay require selecting a compatible prebuilt wheel.
Double-click:
Start_AI.bat
The script:
- changes terminal color to green-on-black (
color 0A) - finds portable Python under
WinPython\ - runs
src\chat.py - pauses on error so the window does not disappear immediately
In the chat:
exitorquit: close appclear: reset conversation memory
- Ensure
python.exeexists underWinPython\... - Keep
Start_AI.batin project root
- Place at least one
.gguffile inmodels\
- Install dependencies into the same portable Python used by
Start_AI.bat - Re-check wheel compatibility with your Python version
- Use a smaller quantized GGUF model
- Close other programs
- Optionally tune env vars before launch:
LOCAL_LLM_CTX(default4096)LOCAL_LLM_MAX_NEW_TOKENS(default512)LOCAL_LLM_CONTEXT_RESERVE(default256)
- This app is local/offline by design; no cloud API keys are required.
- Keep model/license files and Python runtime compliant with your organization policies.