Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LLMForge

LLMForge is a modular LLMOps pipeline originally designed for Reddit-based dataset curation and LoRA fine-tuning on TinyLLaMA-1.1B. It automates ingestion, cleaning, training, and Hugging Face syncing β€” all backed by Prefect, Modal, and CI/CD best practices.


βœ… What’s New (June 2025)

We’ve added a one-line fine-tuning CLI flow using Modal GPU compute and any Hugging Face dataset.

./llmforge finetune \
  --dataset-repo yourusername/your-dataset \
  --model-repo yourusername/your-model-name \
  --hf-auth ./hf_token.txt \
  --push-to-hub

No setup beyond a HF token file and basic venv install. Full walkthrough and screenshots below πŸ‘‡


🧠 Why This Update Matters

This update streamlines LLMForge into a modular LoRA trainer for the OSS community:

  • πŸ”₯ No MLOps knowledge needed to fine-tune & push your own model
  • 🧼 Old full-pipeline logic is retained but commented for now
  • πŸ” Fast launch, easy to build on top of

βš™οΈ Key Features

  • πŸ”Ž Reddit-based prompt-completion dataset creation
  • 🧹 Toxicity filtering using Detoxify
  • βš™οΈ LoRA fine-tuning on Modal with GPU (T4)
  • ☁️ Hugging Face Dataset + Model Hub syncing
  • πŸ” Prefect orchestration pipeline (legacy)
  • πŸš€ New! One-command fine-tuning using unsloth via CLI + Modal
  • πŸ§ͺ CI setup with pytest and GitHub Actions
  • πŸ“§ Email alerts for pipeline (optional)

πŸ†• New: Simple Finetune CLI

After cloning the repo:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Place your Hugging Face token in a file named hf_token.txt.

Then run:

./llmforge finetune \
  --dataset-repo yourusername/your-dataset(whatever dataset repo name you want to give) \
  --model-repo yourusername/your-model-name(same naming conventions like dataset) \
  --hf-auth ./hf_token.txt \
  --push-to-hub

That's it. Modal will handle the GPU job and push the model to your HF.


🧼 Notes on Code Cleanup

  • tinylama and old full-pipeline fine-tuning logic are commented (not deleted).
  • The 12-hour looped pipeline is inactive, but logic is retained for future revival.
  • modal secret creation is handled dynamically using your HF token.

πŸ”§ Architecture Overview

Module Role
src/ Pipeline + finetuning logic
tasks/ Prefect-wrapped tasks for orchestration
tests/ Test coverage
llmforge CLI to trigger training

πŸ› οΈ Features Implemented

Feature Status
Reddit Ingestion with PRAW βœ…
Toxicity Filtering (Detoxify) βœ…
Prompt-Completion Generation βœ…
Hugging Face Dataset Push βœ…
LoRA Fine-tuning on Modal βœ…
Hugging Face Model Push βœ…
CLI-based Finetune Trigger βœ…
CI + pytest test integration βœ…
Email Alerts βœ…
Streamlit Inference UI (local) βœ…

πŸ“ Project Structure

.
β”œβ”€β”€ hf_uploader.py
β”œβ”€β”€ inference.py
β”œβ”€β”€ LICENSE
β”œβ”€β”€ llmforge                   # CLI wrapper for launching fine-tune jobs
β”œβ”€β”€ prefect.yaml
β”œβ”€β”€ __pycache__
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ run_pipeline.py
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ data_ingestion.py
β”‚   β”œβ”€β”€ data_processor.py
β”‚   β”œβ”€β”€ email.py
β”‚   β”œβ”€β”€ finetune.py
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── __pycache__
β”œβ”€β”€ tasks/
β”‚   β”œβ”€β”€ data_ingestion_task.py
β”‚   β”œβ”€β”€ data_processor_task.py
β”‚   β”œβ”€β”€ finetune_task.py
β”‚   └── __pycache__
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── test_pipeline.py
β”œβ”€β”€ venv
└──

---

πŸ“· Screenshots

πŸ”„ One-command Modal GPU Job

460599508-74a9533e-0a70-4cda-a368-5f9862588a57

βœ… Model Pushed to Hugging Face

hf_model_push

πŸ§ͺ CI + Prefect Pipelines

ci_pass prefect_worker

πŸŽ›οΈ Streamlit Inference UI

streamlit

Model and Dataset Pushed to Hugging Face after CLI run

Screenshot from 2025-07-24 23-45-55 Screenshot from 2025-07-24 23-46-00

Terminal outputs after I ran CLI command

Screenshot from 2025-07-24 23-07-25 Screenshot from 2025-07-24 23-07-31 Screenshot from 2025-07-24 23-07-43

πŸ§ͺ Testing

pytest tests/

βœ… All tests pass for ETL logic and CLI triggers


⚠️ Dev Notes

LLMForge was built on a 4GB GPU laptop:

  • Modal handles all remote fine-tuning
  • The 12-hr pipeline is currently disabled for cost reasons
  • Adapter merging was skipped for memory savings

Despite that:

  • It’s cloud-ready and reproducible
  • Works on real Reddit + HF datasets
  • Fully OSS and tweakable

🧠 Future Extensions

  • Merge adapters for complete model export
  • Auto-deploy Streamlit via Modal or Render
  • Reactivate scheduled flows (Prefect)
  • Add Rouge/BLEU scoring post-finetune
  • Support data balancing + multi-source ingestion

πŸ§‘β€πŸ’» Author

Hindol R. Choudhury MLOps β€’ LLM Infra β€’ Applied AI πŸ“« LinkedIn


About

LLMForge is a modular, automated LLMOps pipeline for Reddit-based data curation and LoRA fine-tuning of TinyLLaMA-1.1B. It features real-world MLOps orchestration with Prefect and Modal, running every 12 hours to ingest, clean, train, and sync models to Hugging Face, fully CI/CD-integrated.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages