Image-Text-to-Text
GGUF
English
herbarium
biodiversity
vision-language
structured-output
llama.cpp
gbif
conversational
Instructions to use CapPow/herb-visor with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use CapPow/herb-visor with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="CapPow/herb-visor", filename="herb-visor-4b-f16.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 Settings
- llama.cpp
How to use CapPow/herb-visor with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf CapPow/herb-visor:F16 # Run inference directly in the terminal: llama cli -hf CapPow/herb-visor:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf CapPow/herb-visor:F16 # Run inference directly in the terminal: llama cli -hf CapPow/herb-visor:F16
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 CapPow/herb-visor:F16 # Run inference directly in the terminal: ./llama-cli -hf CapPow/herb-visor:F16
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 CapPow/herb-visor:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf CapPow/herb-visor:F16
Use Docker
docker model run hf.co/CapPow/herb-visor:F16
- LM Studio
- Jan
- vLLM
How to use CapPow/herb-visor with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "CapPow/herb-visor" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CapPow/herb-visor", "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/CapPow/herb-visor:F16
- Ollama
How to use CapPow/herb-visor with Ollama:
ollama run hf.co/CapPow/herb-visor:F16
- Unsloth Studio
How to use CapPow/herb-visor 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 CapPow/herb-visor 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 CapPow/herb-visor to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for CapPow/herb-visor to start chatting
- Atomic Chat new
- Docker Model Runner
How to use CapPow/herb-visor with Docker Model Runner:
docker model run hf.co/CapPow/herb-visor:F16
- Lemonade
How to use CapPow/herb-visor with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull CapPow/herb-visor:F16
Run and chat with the model
lemonade run user.herb-visor-F16
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,160 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3-VL-4B-Instruct
|
| 4 |
+
pipeline_tag: image-text-to-text
|
| 5 |
+
library_name: gguf
|
| 6 |
+
tags:
|
| 7 |
+
- herbarium
|
| 8 |
+
- biodiversity
|
| 9 |
+
- vision-language
|
| 10 |
+
- structured-output
|
| 11 |
+
- gguf
|
| 12 |
+
- llama.cpp
|
| 13 |
+
- gbif
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# Herb-VISOR
|
| 19 |
+
|
| 20 |
+
**Visual Inspector for Specimen Observation & Recognition**
|
| 21 |
+
|
| 22 |
+
A 4B vision-language model that reads herbarium specimen images and emits structured, controlled-vocabulary JSON describing visible attributes (foliage, stem type, reproductive presence, and reference markers such as labels, barcodes, and scale bars). It reports what is visible on the sheet; it does not perform taxonomic identification.
|
| 23 |
+
|
| 24 |
+
Given a specimen image and its taxon name, the model returns schema-valid JSON with no prompt engineering.
|
| 25 |
+
|
| 26 |
+
- **Base model:** [Qwen/Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) (Apache 2.0)
|
| 27 |
+
- **Method:** full-weight fine-tune, teacher-student distillation
|
| 28 |
+
- **Format:** GGUF (llama.cpp-native), runs offline on an 8 GB-class GPU
|
| 29 |
+
- **Code, validation, and documentation:** [GitHub repository](https://github.com/CapPow/herb-visor)
|
| 30 |
+
|
| 31 |
+
## Files
|
| 32 |
+
|
| 33 |
+
| File | Purpose |
|
| 34 |
+
|---|---|
|
| 35 |
+
| `herb-visor-4b-q8.gguf` | model weights, q8 (recommended; runs in ~8 GB VRAM) |
|
| 36 |
+
| `herb-visor-4b-f16.gguf` | model weights, f16 |
|
| 37 |
+
| `herb-visor-4b-mmproj-f16.gguf` | vision projector (required for image input) |
|
| 38 |
+
|
| 39 |
+
The mmproj file is required. Pair it with either weight file.
|
| 40 |
+
|
| 41 |
+
## Usage
|
| 42 |
+
|
| 43 |
+
Start a server with llama.cpp:
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
llama-server \
|
| 47 |
+
--model herb-visor-4b-q8.gguf \
|
| 48 |
+
--mmproj herb-visor-4b-mmproj-f16.gguf \
|
| 49 |
+
--temp 0 \
|
| 50 |
+
-c 8192 \
|
| 51 |
+
--host 127.0.0.1 --port 8080
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
The inference contract is deliberately minimal: no system prompt, no schema
|
| 55 |
+
instructions. The only text input is the taxon binomial (standard casing, e.g.
|
| 56 |
+
`Acer pseudoplatanus`), with the specimen image attached. Use `temperature 0`
|
| 57 |
+
for deterministic output. The model also returns valid JSON without a taxon
|
| 58 |
+
name; the name is included to aid reproductive-trait alignment.
|
| 59 |
+
|
| 60 |
+
A minimal client ([`infer.py`](https://github.com/CapPow/herb-visor/blob/main/infer.py), pure Python standard library):
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
python infer.py path/to/specimen.jpg "Acer pseudoplatanus"
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
Or via the OpenAI-compatible endpoint. Build the request payload in Python
|
| 67 |
+
(a base64 image is too large to pass as a shell argument), then send it:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
python3 <<'PY'
|
| 71 |
+
import json, base64
|
| 72 |
+
img = base64.b64encode(open("path/to/specimen.jpg", "rb").read()).decode()
|
| 73 |
+
payload = {
|
| 74 |
+
"messages": [{
|
| 75 |
+
"role": "user",
|
| 76 |
+
"content": [
|
| 77 |
+
{"type": "text", "text": "Acer pseudoplatanus"},
|
| 78 |
+
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{img}"}}
|
| 79 |
+
]
|
| 80 |
+
}],
|
| 81 |
+
"temperature": 0
|
| 82 |
+
}
|
| 83 |
+
open("/tmp/req.json", "w").write(json.dumps(payload))
|
| 84 |
+
PY
|
| 85 |
+
|
| 86 |
+
curl -s http://localhost:8080/v1/chat/completions \
|
| 87 |
+
-H "Content-Type: application/json" \
|
| 88 |
+
--data-binary @/tmp/req.json | python -m json.tool
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
### Example output
|
| 92 |
+
|
| 93 |
+
For a pressed *Acer pseudoplatanus* sheet:
|
| 94 |
+
|
| 95 |
+
```json
|
| 96 |
+
{
|
| 97 |
+
"type": "PH",
|
| 98 |
+
"attached_photo": false,
|
| 99 |
+
"structures": {
|
| 100 |
+
"foliage": "present",
|
| 101 |
+
"foliage_type": "leaf",
|
| 102 |
+
"stem": "woody",
|
| 103 |
+
"phenology": {
|
| 104 |
+
"flower": false, "fruit": false, "pollen_cone": false,
|
| 105 |
+
"seed_cone": false, "sporulating": false, "reproductive_unknown": false
|
| 106 |
+
}
|
| 107 |
+
},
|
| 108 |
+
"refs": {
|
| 109 |
+
"label": true, "barcode": false, "stamp": false,
|
| 110 |
+
"crc": true, "scale_bar": true
|
| 111 |
+
}
|
| 112 |
+
}
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
The full output schema is in the [repository](https://github.com/CapPow/herb-visor/blob/main/schema/schema.json).
|
| 116 |
+
|
| 117 |
+
## Training
|
| 118 |
+
|
| 119 |
+
The model was trained by distilling a larger teacher (Qwen3.6-27B, `Qwen3.6-27B-UD-Q5_K_XL`), whose structured-JSON captions were the training ground truth. Training used two phases: phase 1 with full schema instructions in the prompt, and phase 2 with only the image and taxon name. Phase 2 bakes the schema into the weights, so end users need no prompt beyond the binomial. On the held-out test set, output was schema-valid, strict-parsed, controlled-vocabulary JSON in all 643 of 643 cases.
|
| 120 |
+
|
| 121 |
+
## Evaluation
|
| 122 |
+
|
| 123 |
+
Accuracy was measured against human-validated labels on a 100-specimen blind sample (a single non-specialist annotator scored each field cold from the image, with no access to model predictions). Per-field accuracy is strong on reference markers and foliage; the weaker fields are stem type and stamp detection.
|
| 124 |
+
|
| 125 |
+
| Field | Accuracy |
|
| 126 |
+
|---|---|
|
| 127 |
+
| `structures.foliage` | 0.97 |
|
| 128 |
+
| `structures.stem` | 0.79 |
|
| 129 |
+
| `attached_photo` | 0.95 |
|
| 130 |
+
| `refs.label` | 0.99 |
|
| 131 |
+
| `refs.barcode` | 1.00 |
|
| 132 |
+
| `refs.stamp` | 0.70 |
|
| 133 |
+
| `refs.crc` | 1.00 |
|
| 134 |
+
| `refs.scale_bar` | 1.00 |
|
| 135 |
+
| `repro_visible` (category-level) | 0.88 |
|
| 136 |
+
|
| 137 |
+
Whole-specimen strict exact match (all 10 fields correct at once) was 0.438, against 0.484 for the 27B teacher. Distillation preserved teacher behavior closely, including its errors; the student did not exceed the teacher.
|
| 138 |
+
|
| 139 |
+
Speed: roughly 5.0 s/img for this model versus 68.6 s/img for the 27B teacher on the same hardware (single stream).
|
| 140 |
+
|
| 141 |
+
Full methodology, the label-free taxonomic-consistency check, and reproduction instructions are in the [GitHub repository](https://github.com/CapPow/herb-visor).
|
| 142 |
+
|
| 143 |
+
## Limitations
|
| 144 |
+
|
| 145 |
+
- `repro_visible` is validated at the category level only (a reproductive structure is present). Fine-grained phenology (flower vs fruit vs cone type) was not human-validated.
|
| 146 |
+
- Ground truth is a single non-specialist annotator (n=100); some apparent errors are annotator-limited. Treat reported accuracies as a conservative floor.
|
| 147 |
+
- Output is a curator-assist candidate, not authoritative write-back.
|
| 148 |
+
- `type` is always `PH` on herbarium input and is not a discriminative result.
|
| 149 |
+
|
| 150 |
+
## License and attribution
|
| 151 |
+
|
| 152 |
+
This model is a full-weight fine-tune of [Qwen/Qwen3-VL-4B-Instruct](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct), which is licensed under Apache License 2.0. Herb-VISOR is released under the same Apache 2.0 license. The weights were modified by fine-tuning on distilled teacher captions over herbarium specimen images.
|
| 153 |
+
|
| 154 |
+
Repository code is released under the MIT license. Training images are GBIF-derived and follow their source-institution terms; they are not redistributed here.
|
| 155 |
+
|
| 156 |
+
## Citation
|
| 157 |
+
|
| 158 |
+
```
|
| 159 |
+
[PLACEHOLDER: citation block]
|
| 160 |
+
```
|