Try me! 💬

Osama's RAG-powered AI clone

Hello! 👋 Thanks for visiting my portfolio. Feel free to ask me anything!

Echo Chamber

PythonHuggingFacePyTorchTransformersMachine LearningNLP

Architecture Overview

Hover over the highlighted elements in the diagram to reveal additional details.

Data Input
WhatsApp Chat Exports
(.txt files)
Data Preprocessing
Load chats from raw/ directory
Clean up messages sensitive data. media, links)
Combine consecutive messages of the same sender
Split conversations into chunks of X messages
Base Model
google/gemma-2-9b-it
(Multi-lingual Support)
Preprocessing output
Output to preprocessed/ directory
Fine-tuning Process
Load data from preprocessed/ directory
Split conversations using overlapping windows
Load base model from HuggingFace
Tokenize data & apply train/test split
Fine tune with LoRA Config
LoRA Config
LORA_R = 8
LORA_ALPHA = 16
LORA_DROPOUT = 0.05
TRAINING_EPOCHS = 5
LEARNING_RATE = 2e-4
BATCH_SIZE = 1
Fine-tuning output
Output weights to /fine_tuned_model directory
Model Deployment
Load weights from /fine_tuned_model directory
Load base model from HuggingFace
Merge base model with weights
Push model to HuggingFace Repository
Fine-tuned Model
[username]/[repo-name]'
Setup Inference Endpoint with the final model
Model ready to be invoked through
https://[ENDPOINT_ID].[REGION].aws.endpoints.huggingface.cloud
HuggingFace

Project Details

Echo Chamber is a machine learning project that creates and deploys a fine-tuned LLM that adopts your personal style of conversation. It uses HuggingFace transformers to load a base model, fine-tunes it with WhatsApp chat history, and pushes the trained model to a HuggingFace repository for deployment and inference.

Project Overview

  • Data Preparation: Convert WhatsApp chat exports to structured JSON format
  • Fine-Tuning: Train the model on your conversation data
  • Deployment: Push the fine-tuned model to Hugging Face for inference

Base Model Selection

  • google/gemma-2-9b-it selected for multi-lingual support
  • Supports mixture of English, Arabic & "Arabizi" chats
  • Optimized for conversational AI with instruction tuning

Fine-Tuning Process

  • Cloud fine-tuning with RunPod for privacy and cost efficiency
  • Instance configuration: 48GB VRAM, 32 vCPU, 125GB RAM, 50GB Disk, 100GB Pod Volume
  • Latest PyTorch template for optimal performance

Model Deployment

  • Automated model publishing to HuggingFace Hub
  • Inference endpoint setup with customizable configuration
  • RESTful API for interacting with personalized model
  • Scalable deployment ready for production use

Future Improvements

  • Support for group chat analysis and training
  • Additional data cleaning and preprocessing options
  • Automated evaluation of fine-tuned model quality