A finetuned FunctionGemma 270M model which can parse transaction SMS from banks and an API server to deploy and update your budget tracker.
Find a file
kartikay-bagla 3f193f7447 removed todo
2025-12-25 19:05:29 +05:30
.github/workflows Add Docker Hub CI workflow and update README 2025-12-25 14:52:55 +05:30
dataset-creation Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
finetune-functiongemma Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
models Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
sms-parser-api Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
.env.example Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
.env.full.example Add multiple docker-compose configurations 2025-12-25 15:01:15 +05:30
.flake8 Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
.gitignore Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
.python-version Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
docker-compose.dockerhub.yml Add multiple docker-compose configurations 2025-12-25 15:01:15 +05:30
docker-compose.full.yml Add multiple docker-compose configurations 2025-12-25 15:01:15 +05:30
docker-compose.yml Add multiple docker-compose configurations 2025-12-25 15:01:15 +05:30
Dockerfile.sms-parser-api Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
find_min_filter_words.py Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
MODEL_CARD.md Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
pyproject.toml Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30
README.md Add multiple docker-compose configurations 2025-12-25 15:01:15 +05:30
uv.lock Initial commit: Bank SMS parsing with fine-tuned FunctionGemma 2025-12-25 14:51:16 +05:30

Bank SMS Parsing

Extract and import bank transactions from SMS messages using a fine-tuned FunctionGemma model.

Pipeline

SMS Messages (JSON export)
         │
         ▼
┌──────────────────┐
│ dataset-creation │  Filter SMS → Classify via LLMs
└────────┬─────────┘
         │
         ▼
┌────────────────────────┐
│ finetune-functiongemma │  Train FunctionGemma-270M
└────────┬───────────────┘
         │
         ▼
┌────────────────┐
│ sms-parser-api │  FastAPI → llama.cpp → Actual Budget
└────────────────┘

Components

Folder Description
dataset-creation Filter SMS and create training datasets using multiple LLM providers
finetune-functiongemma Fine-tune FunctionGemma for transaction extraction
sms-parser-api FastAPI server to process SMS and import to Actual Budget

Docker Compose Options

Three docker-compose configurations are available:

File Description Use Case
docker-compose.yml Builds API locally Development, customization
docker-compose.dockerhub.yml Pulls pre-built image Quick setup, production
docker-compose.full.yml Complete stack with Actual Budget Self-hosted everything

Quick Start (Pre-built Image)

# 1. Download the model from HuggingFace
huggingface-cli download kartikaybagla/functiongemma-bank-sms-parser \
    functiongemma-270m-bank-sms-parser-Q4_K_M.gguf \
    --local-dir ./models

# 2. Configure environment
cp .env.example .env
# Edit .env with your Actual Budget API settings

# 3. Start services
docker-compose -f docker-compose.dockerhub.yml up -d

API available at http://localhost:8000

Full Stack (Self-Hosted Actual Budget)

Complete setup with Actual Budget, HTTP API, model server, and SMS parser:

# 1. Download the model
huggingface-cli download kartikaybagla/functiongemma-bank-sms-parser \
    functiongemma-270m-bank-sms-parser-Q4_K_M.gguf \
    --local-dir ./models

# 2. Start Actual Budget first
docker-compose -f docker-compose.full.yml up -d actual-budget

# 3. Go to http://localhost:5006 and set up your budget
#    - Create a password
#    - Create/import a budget
#    - Note down your budget sync ID

# 4. Configure environment
cp .env.full.example .env.full
# Edit .env.full:
#   - ACTUAL_SERVER_PASSWORD: password you just created
#   - ACTUAL_API_KEY: generate with `openssl rand -hex 32`
#   - DEFAULT_BUDGET_SYNC_ID: from Actual Budget settings
#   - DEFAULT_ACCOUNT_ID: account to import transactions to

# 5. Start all services
docker-compose -f docker-compose.full.yml --env-file .env.full up -d

Services:

  • Actual Budget: http://localhost:5006
  • Actual HTTP API: http://localhost:5007 (docs at /api-docs/)
  • Model Server: http://localhost:1234
  • SMS Parser API: http://localhost:8000

Local Build (Development)

# Build and run from source
docker-compose up -d

Requirements (Development)

  • Python 3.11+
  • uv package manager
  • PyTorch (for fine-tuning only)

Development Setup

# Install dependencies
uv sync

# Filter SMS messages
cd dataset-creation
uv run python filter_sms.py

# Start API server (requires model running via LM Studio or llama.cpp)
cd sms-parser-api
uv run uvicorn main:app --reload

PyTorch for Fine-tuning

# NVIDIA (CUDA 11.8):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

# AMD (ROCm 6.2):
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.2

See finetune-functiongemma/README.md for training details.