Instructions to use jpmarindiaz/lfm2-flood with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jpmarindiaz/lfm2-flood with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="jpmarindiaz/lfm2-flood") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("jpmarindiaz/lfm2-flood") model = AutoModelForImageTextToText.from_pretrained("jpmarindiaz/lfm2-flood") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use jpmarindiaz/lfm2-flood with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="jpmarindiaz/lfm2-flood", filename="lfm2-flood-Q4_0.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use jpmarindiaz/lfm2-flood with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf jpmarindiaz/lfm2-flood:Q4_0 # Run inference directly in the terminal: llama-cli -hf jpmarindiaz/lfm2-flood:Q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf jpmarindiaz/lfm2-flood:Q4_0 # Run inference directly in the terminal: llama-cli -hf jpmarindiaz/lfm2-flood:Q4_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf jpmarindiaz/lfm2-flood:Q4_0 # Run inference directly in the terminal: ./llama-cli -hf jpmarindiaz/lfm2-flood:Q4_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf jpmarindiaz/lfm2-flood:Q4_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf jpmarindiaz/lfm2-flood:Q4_0
Use Docker
docker model run hf.co/jpmarindiaz/lfm2-flood:Q4_0
- LM Studio
- Jan
- vLLM
How to use jpmarindiaz/lfm2-flood with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jpmarindiaz/lfm2-flood" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jpmarindiaz/lfm2-flood", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/jpmarindiaz/lfm2-flood:Q4_0
- SGLang
How to use jpmarindiaz/lfm2-flood with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "jpmarindiaz/lfm2-flood" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jpmarindiaz/lfm2-flood", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "jpmarindiaz/lfm2-flood" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jpmarindiaz/lfm2-flood", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Ollama
How to use jpmarindiaz/lfm2-flood with Ollama:
ollama run hf.co/jpmarindiaz/lfm2-flood:Q4_0
- Unsloth Studio new
How to use jpmarindiaz/lfm2-flood with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for jpmarindiaz/lfm2-flood to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for jpmarindiaz/lfm2-flood to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for jpmarindiaz/lfm2-flood to start chatting
- Pi new
How to use jpmarindiaz/lfm2-flood with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf jpmarindiaz/lfm2-flood:Q4_0
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "jpmarindiaz/lfm2-flood:Q4_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use jpmarindiaz/lfm2-flood with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf jpmarindiaz/lfm2-flood:Q4_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default jpmarindiaz/lfm2-flood:Q4_0
Run Hermes
hermes
- Docker Model Runner
How to use jpmarindiaz/lfm2-flood with Docker Model Runner:
docker model run hf.co/jpmarindiaz/lfm2-flood:Q4_0
- Lemonade
How to use jpmarindiaz/lfm2-flood with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull jpmarindiaz/lfm2-flood:Q4_0
Run and chat with the model
lemonade run user.lfm2-flood-Q4_0
List all available models
lemonade list
lfm2-flood
Fine-tune of LiquidAI/LFM2.5-VL-450M for flood detection from Sentinel-2 satellite tile pairs (RGB + SWIR baseline + RGB + SWIR current). Output is a structured JSON flood-risk profile.
The model is intended to run on a low-resource node (a satellite or a community ground station) and downlink only the JSON payload — not raw imagery — for offline humanitarian response in flood-affected regions.
Status: experimental. Trained on 88 paired samples (110 total, 22 held out for eval). The dataset is too small and noisy for an operational alert system; this is the infrastructure, not a deployable model. See the Limitations section.
Inputs
Four images per inference, in this order:
- RGB-baseline (B4-B3-B2 true color) — the location at a pre-event timestamp
- SWIR-baseline (B12-B8-B4 false color) — same timestamp
- RGB-current — the location at the timestamp to assess
- SWIR-current — same timestamp
Each is a Sentinel-2 PNG, ~5 km × 5 km, served as base64 data URL or HF Hub URL.
Output
{
"flood_present": true,
"flood_severity": "moderate",
"water_coverage_pct_estimate": "30-60%",
"populated_area_affected": true,
"infrastructure_at_risk": true,
"river_overflow_visible": true,
"image_quality_limited": false
}
7 fields. flood_present and the four booleans are change-relative — i.e. "is there flooding vs the baseline tile", not "is there water in this tile". image_quality_limited is the abstention signal — set true on cloudy or partial-coverage tiles.
Files
| file | size | purpose |
|---|---|---|
model.safetensors |
~860 MB | merged HF checkpoint, full fine-tune of LFM2.5-VL-450M |
config.json, tokenizer*.json, chat_template.jinja, etc. |
small | standard HF transformers metadata |
lfm2-flood-Q4_0.gguf |
~245 MB | quantized backbone for llama.cpp |
mmproj-lfm2-flood-F16.gguf |
~189 MB | vision tower + projector for llama.cpp |
Quick start (llama.cpp)
# Download both files (or use `hf download`)
hf download jpmarindiaz/lfm2-flood lfm2-flood-Q4_0.gguf --local-dir .
hf download jpmarindiaz/lfm2-flood mmproj-lfm2-flood-F16.gguf --local-dir .
# Serve OpenAI-compatible endpoint
llama-server -m lfm2-flood-Q4_0.gguf --mmproj mmproj-lfm2-flood-F16.gguf -c 8192 --port 8765
Then POST 4 images to /v1/chat/completions with a JSON-schema response_format. Full client code in the humaid repo (finetune-flood/src/evaluate.ts, finetune-flood/app/server.ts).
Training
- Base model:
LiquidAI/LFM2.5-VL-450M - Backend: leap-finetune on Modal H100
- Training type: vlm_sft, full fine-tune (no LoRA — the multimodal projector needs to relearn satellite multispectral imagery)
- Hyperparameters: 3 epochs, per-device batch 2, gradient accumulation 8 (effective 16), LR 5e-5 cosine, vision-encoder LR multiplier 0.5, bf16
- Wall time: ~70 seconds on H100
- Dataset: 88 train + 22 eval pair samples from 9 documented La Mojana / Putumayo flood events. See
jpmarindiaz/flood-detection-pair-colombia.
Evaluation
Compared against the labeler's self-consistency oracle and the un-fine-tuned base model on the same 110 pair samples:
| field | opus oracle (n=30) | base LFM2.5-VL (n=110) | this model (n=110) |
|---|---|---|---|
| valid_json | 1.00 | 1.00 | 1.00 |
| fields_present | 1.00 | 1.00 | 1.00 |
| flood_present | 0.67 | 0.66 | 0.66 |
| flood_severity | 0.43 | 0.29 | 0.29 |
| water_coverage_pct_estimate | 0.70 | 0.37 | 0.35 |
| populated_area_affected | 0.73 | 0.51 | 0.51 |
| infrastructure_at_risk | 0.73 | 0.54 | 0.54 |
| river_overflow_visible | 0.67 | 0.60 | 0.60 |
| image_quality_limited | 0.83 | 0.10 | 0.90 |
| overall | 0.68 | 0.44 | 0.55 |
| avg latency (s) | 3.87 | 0.53 | 0.53 |
overall is the macro-average across the 7 fields. valid_json and fields_present are 1.0 because we use grammar-constrained JSON output via response_format: {type: "json_schema"}.
Limitations
- Sentinel-2 wet-season cloud cover. ~50% of acquisitions over La Mojana in Apr–Jun and Aug–Nov are >50% cloud. Operational pipelines (CopernicusLAC) use Sentinel-1 SAR (cloud-independent) for the same task. This model was trained only on Sentinel-2.
- Inter-labeler noise floor caps the ceiling. Opus self-consistency on the hardest schema fields is 0.43–0.70. The student model can't exceed inter-labeler agreement.
- The fine-tune learned the dataset prior, not the task. The +11-point overall gain (0.44 → 0.55) is concentrated almost entirely in
image_quality_limited(0.10 → 0.90). Other fields essentially didn't move with 88 train samples × 3 epochs. - Geographic scope: Colombia only. Locations are 8 La Mojana municipalities + 6 Putumayo. May not generalize to other flood regimes (e.g. flash floods, glacial-melt rivers, hurricane storm surge).
How it was built
The full pipeline + scripts + playbook are in the humaid repo on GitHub. Key files:
finetune-flood/PLAYBOOK.md— end-to-end command sequence (fetch → label → build → upload → train → pull → package → serve → eval)finetune-flood/REPORT.md— wrap-up findings (what worked, what didn't, the case for switching to Sentinel-1 SAR before resuming)finetune-flood/docs/— overview, pipeline, data collection, labeling, evaluation, findingsfinetune-flood/scripts/convert_mmproj_lfm2vl.py— patch around the upstreamconvert_hf_to_gguf.pyissue withlm_head.weightin full-FT merged checkpointsfinetune-flood/app/— small Hono app for testing the model interactively
Citation
Trained 2026-05-08 as part of the humaid project — offline-first humanitarian response toolkit for flood crises in Colombia. Built on:
- LFM2.5-VL-450M by Liquid AI
- leap-finetune by Liquid AI
- SimSat by DPhi Space
- The Liquid AI × DPhi Space AI in Space hackathon wildfire-prevention example by Pau Labarta Bajo
- Downloads last month
- 227
Model tree for jpmarindiaz/lfm2-flood
Base model
LiquidAI/LFM2.5-350M-Base