--- license: mit base_model: google/gemma-4-e4b-it library_name: peft tags: - gemma4 - solar-energy - community-solar - function-calling - multimodal - lora - unsloth - qlora - ollama - edge-ai - energy - sustainability - hackathon datasets: - solarhive-community-solar-1k language: - en pipeline_tag: image-text-to-text model-index: - name: SolarHive-E4B-LoRA results: - task: type: question-answering name: Domain Q&A metrics: - name: Accuracy type: accuracy value: 1.0 verified: false - task: type: text-generation name: Tool Calling metrics: - name: Accuracy type: accuracy value: 1.0 verified: false --- ![SolarHive](SolarHive_HeaderImage_1920x1080_HFModelCard.png) # SolarHive E4B Ollama — Edge Solar Energy Intelligence **QLoRA fine-tuned Gemma 4 E4B (8B)**, merged to 16-bit safetensors for **edge deployment via Ollama**. Community energy data never leaves the neighborhood. This repository contains **merged safetensors** (base model + LoRA adapters baked together). Ollama imports safetensors directly — no GGUF conversion needed. Built for the [Gemma 4 Good Hackathon](https://kaggle.com/competitions/gemma-4-good-hackathon) (Google DeepMind x Kaggle). | | | |---|---| | **Base Model** | [google/gemma-4-e4b-it](https://kaggle.com/models/google/gemma-4) | | **Architecture** | Dense + PLE — 8B total, 4.5B effective | | **Fine-Tuning** | QLoRA via [Unsloth](https://unsloth.ai) | | **Training Data** | 1,029 community solar energy examples | | **Converged Loss** | **0.952** | | **Benchmark** | 7/8 (5/5 domain Q&A + 2/3 tool calling) | | **Training Time** | 282 seconds (~4.7 minutes) | | **Compute** | Google Colab Pro | | **License** | MIT (adapters) / Gemma Terms (base model) | --- ## Model Overview SolarHive E4B is the **edge companion** to [SolarHive 26B A4B](https://huggingface.co/Truthseeker87/solarhive-26b-a4b-lora). While the 26B model powers cloud inference with full multimodal VQA, the E4B model is optimized for local deployment via Ollama on consumer hardware. **Privacy-first:** Running Gemma 4 locally means community energy data never leaves the neighborhood. No cloud dependency, no internet requirement, no data privacy concerns. A village in rural India, a suburb in Michigan, and a coastal town recovering from a hurricane all get the same intelligence. This repository contains **LoRA adapters only** — you need the base Gemma 4 E4B model to use them. --- ## Training Details | Parameter | Value | |-----------|-------| | Method | QLoRA via Unsloth `FastVisionModel` | | LoRA rank | 16 | | LoRA alpha | 16 | | LoRA dropout | 0 | | Target modules | All linear layers | | Learning rate | 2e-4 | | Optimizer | AdamW 8-bit | | Warmup steps | 5 | | Epochs | 3 | | Max sequence length | 2048 | | Precision | BF16 | | Seed | 3407 | | Trainable parameters | 41.2M / 8.0B (0.51%) | ### Training Loss | Metric | Value | |--------|-------| | Converged loss (last 20 steps) | **0.952** | | Final step loss | 1.088 | | Minimum loss | 0.455 | | Total steps | 195 | | Training time | 282 seconds | ### Training Data Same 1,029 examples as the 26B A4B model: - 413 hand-crafted examples spanning 15+ US cities and 9 energy domains - 501 API-grounded examples from live Open-Meteo, PVWatts, OWM, and EIA data - 100 tool-calling examples (50 with tools, 50 without) See the [SolarHive Dataset](https://huggingface.co/datasets/Truthseeker87/solarhive-community-solar-1k) for full documentation. ### Hardware - **GPU:** NVIDIA RTX PRO 6000 Blackwell Server Edition (96 GB GDDR7) - **Platform:** Google Colab G4 VM - **Platform:** Google Colab Pro --- ## Benchmark Results ### Domain Q&A (5/5) | Question | Result | |----------|--------| | Solar production when humidity exceeds 80%? | Correct | | Battery SOC threshold for grid export? | Correct | | Home #3 underperforming 22% — diagnostic checklist? | Correct | | Winter snow on panels — prioritize actions? | Correct | | Grid frequency 59.8 Hz — microgrid implications? | Correct | ### Tool Calling (2/3) | Question | Expected | Called | Status | |----------|----------|-------|--------| | Current battery state? | `get_battery_state` | `get_battery_status` | Fail | | Solar production in Seattle? | `get_solar_production` or `get_weather` | `get_solar_production` | Pass | | General panel maintenance tips? | None | None | Pass | --- ## How to Use ### Loading with Unsloth ```python from unsloth import FastVisionModel import torch model, processor = FastVisionModel.from_pretrained( model_name="google/gemma-4-e4b-it", adapter_name="Truthseeker87/solarhive-e4b-lora", # This repo dtype=torch.bfloat16, device_map="auto", ) FastVisionModel.for_inference(model) ``` ### Edge Deployment via Ollama ```bash # After converting to GGUF (see solarhive_finetune.py Cell 13): ollama create solarhive -f Modelfile ollama run solarhive "What's the best time to run my dishwasher today?" ``` --- ## Companion Repositories | Model | Repository | Purpose | |-------|-----------|---------| | **SolarHive 26B A4B LoRA** | [solarhive-26b-a4b-lora](https://huggingface.co/Truthseeker87/solarhive-26b-a4b-lora) | Cloud inference with full multimodal + function calling | | **SolarHive E4B Ollama** | This repo | Edge deployment via Ollama (merged safetensors) | | **SolarHive Dataset** | [solarhive-community-solar-1k](https://huggingface.co/datasets/Truthseeker87/solarhive-community-solar-1k) | 1,029 training examples | | **GitHub** | [the-gemma4-good-hackathon-solarhive](https://github.com/youshen-lim/the-gemma4-good-hackathon-solarhive) | Full source code, notebooks, data principles | --- ## Links - **GitHub:** [youshen-lim/the-gemma4-good-hackathon-solarhive](https://github.com/youshen-lim/the-gemma4-good-hackathon-solarhive) - **Kaggle:** [The Gemma 4 Good Hackathon](https://kaggle.com/competitions/gemma-4-good-hackathon) *Built with Gemma 4 in Ann Arbor, Michigan. April 2026.* *Gemma is a trademark of Google LLC.*