Update model card with full details, training config, usage
Browse files
README.md
CHANGED
|
@@ -1,200 +1,96 @@
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
tags:
|
| 4 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
#
|
| 8 |
|
| 9 |
-
|
| 10 |
|
|
|
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 23 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 24 |
-
- **Model type:** [More Information Needed]
|
| 25 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 26 |
-
- **License:** [More Information Needed]
|
| 27 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
|
|
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
|
| 53 |
-
##
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
[More Information Needed]
|
| 58 |
-
|
| 59 |
-
## Bias, Risks, and Limitations
|
| 60 |
-
|
| 61 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 62 |
-
|
| 63 |
-
[More Information Needed]
|
| 64 |
-
|
| 65 |
-
### Recommendations
|
| 66 |
-
|
| 67 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 68 |
-
|
| 69 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 70 |
-
|
| 71 |
-
## How to Get Started with the Model
|
| 72 |
-
|
| 73 |
-
Use the code below to get started with the model.
|
| 74 |
-
|
| 75 |
-
[More Information Needed]
|
| 76 |
-
|
| 77 |
-
## Training Details
|
| 78 |
-
|
| 79 |
-
### Training Data
|
| 80 |
-
|
| 81 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 82 |
-
|
| 83 |
-
[More Information Needed]
|
| 84 |
-
|
| 85 |
-
### Training Procedure
|
| 86 |
-
|
| 87 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 88 |
-
|
| 89 |
-
#### Preprocessing [optional]
|
| 90 |
-
|
| 91 |
-
[More Information Needed]
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
#### Training Hyperparameters
|
| 95 |
-
|
| 96 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 97 |
-
|
| 98 |
-
#### Speeds, Sizes, Times [optional]
|
| 99 |
-
|
| 100 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 101 |
-
|
| 102 |
-
[More Information Needed]
|
| 103 |
-
|
| 104 |
-
## Evaluation
|
| 105 |
-
|
| 106 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 107 |
-
|
| 108 |
-
### Testing Data, Factors & Metrics
|
| 109 |
-
|
| 110 |
-
#### Testing Data
|
| 111 |
-
|
| 112 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 113 |
-
|
| 114 |
-
[More Information Needed]
|
| 115 |
-
|
| 116 |
-
#### Factors
|
| 117 |
-
|
| 118 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 119 |
-
|
| 120 |
-
[More Information Needed]
|
| 121 |
-
|
| 122 |
-
#### Metrics
|
| 123 |
-
|
| 124 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 125 |
-
|
| 126 |
-
[More Information Needed]
|
| 127 |
-
|
| 128 |
-
### Results
|
| 129 |
-
|
| 130 |
-
[More Information Needed]
|
| 131 |
-
|
| 132 |
-
#### Summary
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
## Model Examination [optional]
|
| 137 |
-
|
| 138 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 139 |
-
|
| 140 |
-
[More Information Needed]
|
| 141 |
-
|
| 142 |
-
## Environmental Impact
|
| 143 |
-
|
| 144 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 145 |
-
|
| 146 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 147 |
-
|
| 148 |
-
- **Hardware Type:** [More Information Needed]
|
| 149 |
-
- **Hours used:** [More Information Needed]
|
| 150 |
-
- **Cloud Provider:** [More Information Needed]
|
| 151 |
-
- **Compute Region:** [More Information Needed]
|
| 152 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 153 |
-
|
| 154 |
-
## Technical Specifications [optional]
|
| 155 |
-
|
| 156 |
-
### Model Architecture and Objective
|
| 157 |
-
|
| 158 |
-
[More Information Needed]
|
| 159 |
-
|
| 160 |
-
### Compute Infrastructure
|
| 161 |
-
|
| 162 |
-
[More Information Needed]
|
| 163 |
-
|
| 164 |
-
#### Hardware
|
| 165 |
-
|
| 166 |
-
[More Information Needed]
|
| 167 |
-
|
| 168 |
-
#### Software
|
| 169 |
-
|
| 170 |
-
[More Information Needed]
|
| 171 |
-
|
| 172 |
-
## Citation [optional]
|
| 173 |
-
|
| 174 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 175 |
-
|
| 176 |
-
**BibTeX:**
|
| 177 |
-
|
| 178 |
-
[More Information Needed]
|
| 179 |
-
|
| 180 |
-
**APA:**
|
| 181 |
-
|
| 182 |
-
[More Information Needed]
|
| 183 |
-
|
| 184 |
-
## Glossary [optional]
|
| 185 |
-
|
| 186 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 187 |
-
|
| 188 |
-
[More Information Needed]
|
| 189 |
-
|
| 190 |
-
## More Information [optional]
|
| 191 |
-
|
| 192 |
-
[More Information Needed]
|
| 193 |
-
|
| 194 |
-
## Model Card Authors [optional]
|
| 195 |
-
|
| 196 |
-
[More Information Needed]
|
| 197 |
-
|
| 198 |
-
## Model Card Contact
|
| 199 |
-
|
| 200 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
library_name: transformers
|
| 3 |
tags:
|
| 4 |
+
- lora
|
| 5 |
+
- peft
|
| 6 |
+
- vision
|
| 7 |
+
- safety
|
| 8 |
+
- drone
|
| 9 |
+
- pixtral
|
| 10 |
+
- unsloth
|
| 11 |
+
base_model: unsloth/pixtral-12b-2409-bnb-4bit
|
| 12 |
+
license: apache-2.0
|
| 13 |
+
pipeline_tag: image-text-to-text
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# Helpstral — LoRA Fine-tuned Pixtral 12B for Drone Safety Assessment
|
| 17 |
|
| 18 |
+
LoRA adapter for real-time pedestrian safety classification from drone camera images, built for the [Louise AI Safety Drone Escort](https://github.com/benbarrett735-png/Mistral-Worldwide-Hackathon) system.
|
| 19 |
|
| 20 |
+
## What it does
|
| 21 |
|
| 22 |
+
Given a drone camera frame during an escort mission, the model outputs a structured threat assessment:
|
| 23 |
|
| 24 |
+
- **threat_level** (1–10) — evidence-based risk score
|
| 25 |
+
- **status** — SAFE, CAUTION, or DISTRESS
|
| 26 |
+
- **people_count** — number of people visible in frame
|
| 27 |
+
- **user_moving** — whether the escorted person appears to be walking
|
| 28 |
+
- **proximity_alert** — whether another person is within ~3m of the user
|
| 29 |
+
- **observations** — what the model sees (lighting, obstacles, people)
|
| 30 |
+
- **pattern** — temporal reasoning from multi-frame context
|
| 31 |
+
- **reasoning** — explanation connecting image + location data
|
| 32 |
+
- **action** — CONTINUE_MONITORING, INCREASE_SCAN_RATE, ALERT_USER, EMERGENCY_HOVER, etc.
|
| 33 |
|
| 34 |
+
This powers operator-in-the-loop alerts: when the user stops moving for 10+ seconds or another person is in close proximity, mission control receives a review request.
|
| 35 |
|
| 36 |
+
## Training
|
| 37 |
|
| 38 |
+
| Parameter | Value |
|
| 39 |
+
|-----------|-------|
|
| 40 |
+
| Base model | Pixtral 12B (Unsloth 4-bit) |
|
| 41 |
+
| Method | LoRA (PEFT), trained with Unsloth |
|
| 42 |
+
| LoRA rank (r) | 64 |
|
| 43 |
+
| LoRA alpha | 128 |
|
| 44 |
+
| Target modules | language model attention (q_proj, v_proj, etc.) |
|
| 45 |
+
| Task type | CAUSAL_LM |
|
| 46 |
+
| PEFT version | 0.18.1 |
|
| 47 |
|
| 48 |
+
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
**Inference server (Colab):** See [`helpstral/serve_colab.ipynb`](https://github.com/benbarrett735-png/Mistral-Worldwide-Hackathon/blob/main/helpstral/serve_colab.ipynb) in the Louise repo. Run it on a T4 GPU, then set `HELPSTRAL_ENDPOINT=<ngrok_url>` in `.env`.
|
| 51 |
|
| 52 |
+
**Load locally:**
|
| 53 |
|
| 54 |
+
```python
|
| 55 |
+
import torch
|
| 56 |
+
from transformers import AutoProcessor, LlavaForConditionalGeneration, BitsAndBytesConfig
|
| 57 |
+
from peft import PeftModel
|
| 58 |
+
from PIL import Image
|
| 59 |
|
| 60 |
+
processor = AutoProcessor.from_pretrained("mistral-community/pixtral-12b")
|
| 61 |
+
model = LlavaForConditionalGeneration.from_pretrained(
|
| 62 |
+
"mistral-community/pixtral-12b",
|
| 63 |
+
quantization_config=BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16),
|
| 64 |
+
device_map="auto",
|
| 65 |
+
)
|
| 66 |
+
model = PeftModel.from_pretrained(model, "BenBarr/helpstral")
|
| 67 |
+
model = model.merge_and_unload().eval()
|
| 68 |
|
| 69 |
+
img = Image.open("drone_frame.jpg").convert("RGB")
|
| 70 |
+
chat = [{"role": "user", "content": [
|
| 71 |
+
{"type": "image"},
|
| 72 |
+
{"type": "text", "text": "Analyze this drone camera frame. Output JSON: threat_level, status, people_count, user_moving, proximity_alert, observations, pattern, reasoning, action."},
|
| 73 |
+
]}]
|
| 74 |
+
prompt = processor.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
| 75 |
+
inputs = processor(text=prompt, images=[img], return_tensors="pt").to(model.device)
|
| 76 |
|
| 77 |
+
with torch.no_grad():
|
| 78 |
+
out = model.generate(**inputs, max_new_tokens=400, do_sample=False)
|
| 79 |
|
| 80 |
+
result = processor.batch_decode(out, skip_special_tokens=True)[0]
|
| 81 |
+
# Parse JSON from result...
|
| 82 |
+
```
|
| 83 |
|
| 84 |
+
## Architecture
|
| 85 |
|
| 86 |
+
Helpstral sits in the Louise multi-agent drone escort system:
|
| 87 |
|
| 88 |
+
- **Helpstral** (this model) — safety/threat assessment from camera images
|
| 89 |
+
- **Flystral** — flight control from camera images ([BenBarr/flystral](https://huggingface.co/BenBarr/flystral))
|
| 90 |
+
- **Louise** — conversational safety companion (Ministral 3B)
|
| 91 |
|
| 92 |
+
When the fine-tuned endpoint is available, Helpstral uses this adapter. When offline, it falls back to Pixtral 12B via the Mistral API with function calling (queries real OpenStreetMap data for streetlight density, etc.).
|
| 93 |
|
| 94 |
+
## Developed by
|
| 95 |
|
| 96 |
+
Ben Barrett — Mistral Worldwide Hackathon 2026
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|