How mantistobogg/gemma-sprint-project works
Project Type and Purpose
• This is a Python-based, containerized machine-learning pipeline (no user interface) that orchestrates multiple NLP models to analyze user comments (sentiment and sarcasm) and generate context-aware, domain-enriched responses for enterprise consulting use-cases.
File Structure
• Top-level:
• Dockerfile + requirements.txt → containerized deployment of the entire pipeline.
• datasets/ → raw input CSV/JSON datasets (UScomments_final_cleaned.csv, IT_glossory_final_v4.csv, Sarcasm_Headlines_Dataset.json).
• src/ → main application entrypoint (gemma_v5.py) and helper modules (sentiment_model.py).
• tokenizer/ → custom tokenization logic (tokenzier_v1.py).
• gptj_integration/ & minilm_integration/ → scripts to load and train GPT-J and MiniLM models, plus persisted artifacts (term_embeddings.pt).
• Patterns → Single “orchestrator” script calls four model modules (DistilBERT, sarcasm detector, MiniLM, GPT-J/GEMMA-2B-IT) in sequence or in parallel.
README for Insights
• Confirms multi-LLM stack (DistilBERT for sentiment, sarcasm detection model, MiniLM for IT terms, GPT-J & GEMMA-2B-IT for response generation).
• Highlights containerization (Docker + Colima), Apple-Silicon PyTorch/MPS optimizations, logging, checkpointing.
Main Components & Relationships
a. Data Ingestion & Preprocessing
• Input datasets → cleaning & tokenization (tokenizer/tokenzier_v1.py).
b. Model Inference Modules
1) Sentiment Classifier (DistilBERT via src/sentiment_model.py)
2) Sarcasm Detector (Hugging Face model, integrated similarly)
3) IT-Term Embedder (MiniLM via minilm_integration/)
4) Generative LLMs (GPT-J & GEMMA-2B-IT via gptj_integration/)
c. Orchestration Layer
• gemma_v5.py stitches together inputs/outputs, handles routing logic (e.g., negative/sarcastic → urgent response).
d. Persistence & Observability
• Checkpoints/ logs directories (per README, though not shown in file tree) capture training/inference state.
e. Containerization & Deployment
• Dockerfile builds image hosting the orchestrator and all model dependencies, exposes API or CLI at port 8080.
Architectural Patterns & Design Principles
• Modular, pipeline-based design: each model is a separate component with a clear interface.
• Separation of concerns: tokenizer, model loaders, inference logic, and orchestration in distinct directories.
• Containerized reproducibility: ensures consistent environments across development and production.
• Hardware‐specific optimizations (MPS backend for Mac ARM64).
Detail & Coverage
• Every directory/module as an individual node if it plays a distinct role.
• Don’t omit the Dockerfile: it’s the boundary for production deployment.