Posts

Showing posts with the label slm

Automatic Speech Recognition with Gemma

Image
I've created a complete ASR (Automatic Speech Recognition) demo using Docker Compose with the following architecture: 🏗️ Architecture Overview 3 Microservices: Ollama Service - Runs Gemma 2:2B model for text enhancement ASR Service - FastAPI backend with Whisper for transcription Web UI - Nginx-served interactive frontend 🚀 Key Features Audio Input: ✅ Browser-based recording with microphone ✅ File upload with drag & drop (MP3, WAV, M4A, OGG) Processing Pipeline: ✅ Whisper (tiny model) for fast speech-to-text ✅ Ollama Gemma 2:2B for text enhancement and correction ✅ Processing time tracking User Experience: ✅ Real-time recording with timer ✅ Health status monitoring ✅ Side-by-side comparison of raw vs enhanced text ✅ Responsive modern UI 📁 Quick Setup Create project structure: mkdir asr-demo && cd asr-demo Save all files to their respective directories: docker-compose.yml in root ASR service files in asr-service/ Web UI fil...

Code Auto Completion with Hugging Face LangChain and Phi3 SLM

Image
  Photo by energepic.com at pexel You can create your own coding auto-completion co-pilot using Hugging Face LangChain and Phi3 SLM ! Here's a breakdown of the steps involved: 1. Setting Up the Environment: Install the required libraries: Bash pip install langchain transformers datasets phi3 Download the Phi3 SLM model: Bash from transformers import AutoModelForSeq2SeqLM model_name = "princeton-ml/ph3_base" model = AutoModelForSeq2SeqLM.from_pretrained(model_name) 2. Preprocessing Code for LangChain: LangChain provides a AutoTokenizer class to preprocess code. Identify the programming language you want to support and install the corresponding tokenizer from Hugging Face. For example, for Python: Bash from langchain.llms import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained( "openai/gpt-code-code" ) Define a function to preprocess code into LangChain format. This might involve splitting the code into tokens, adding special tokens (e.g., start/e...