AGEII fine-tuned Gemma 4 and RF-DETR
This repository contains the full merged Gemma 4 12B fine-tuned checkpoint and the trained RF-DETR Medium detector, uploaded directly from the A5000 server. Model files preserve the original verified training exports.
Files
| File or directory | Contents |
|---|---|
gemma_model.pth |
Full merged BF16 Gemma checkpoint (25,932,982,415 bytes) |
gemma_model.json |
Architecture identity, training provenance and SHA-256 checksum |
gemma_model_processor/ |
Processor, tokenizer, chat template and configurations |
adapter/ |
Original trained LoRA adapter, configuration and training manifest |
rf_model.pth |
Trained RF-DETR Medium checkpoint (134,105,701 bytes) |
rf_model_labels.json |
Ordered 22-class detector labels |
rfdetr-medium-ood-v1/ |
RF checkpoint under its original filename, evaluation and training metadata |
adapter_io.py |
AGEII loader for the full Gemma checkpoint and portable adapters |
UPLOAD_MANIFEST.json |
Per-file sizes and SHA-256 checksums of the uploaded model artifacts |
The two RF checkpoint paths contain identical bytes. Keep the label file with the RF model.
Gemma format and loading
gemma_model.pth uses the project format gemma-full-state-dict-v1. It includes model configuration, generation configuration, training provenance and all merged tensors. A separate base-weight download is unnecessary. The repository root is not a standard Transformers save_pretrained() directory; use the supplied full-checkpoint loader.
The full-model loader requires PyTorch, Transformers 5.19.0 and Accelerate >=1.10,<2. Processor use additionally needs Pillow and compatible torchvision. Use a compatible PyTorch/torchvision installation for your hardware. PEFT is only needed for the separate LoRA adapter path.
Download with huggingface_hub:
from huggingface_hub import snapshot_download
root = snapshot_download(
repo_id="Atlearia/Gemma_4_finetuned",
local_dir="ageii-models",
)
From the downloaded directory:
from pathlib import Path
from transformers import AutoProcessor
from adapter_io import load_full_pth_model
root = Path(".")
model = load_full_pth_model(
root / "gemma_model.pth",
model_id="google/gemma-4-12B-it",
revision="707f0a3b8a3c7ad586ed01e27eafbad8a27dd0f7",
device="cpu", # Or a GPU with sufficient memory for full BF16 weights.
)
processor = AutoProcessor.from_pretrained(
root / "gemma_model_processor",
local_files_only=True,
)
The loader verifies the full-file SHA-256, pinned identity and completed training manifest before reconstructing the model. Keep the checkpoint, matching JSON sidecar and processor directory together. The full checkpoint is not quantized; its weights alone exceed the A5000's 24 GB VRAM, so use sufficient system RAM or a larger GPU for this artifact.
For the RF detector, use rf_model.pth with RFDETRMedium and the supplied ordered labels. The recorded training environment used rfdetr==1.11.2; the complete environment and evaluation results are under rfdetr-medium-ood-v1/.
Training provenance
Gemma starts from google/gemma-4-12B-it at revision 707f0a3b8a3c7ad586ed01e27eafbad8a27dd0f7. The completed run used 40 LoRA steps, 155 training examples and 22 validation examples. Language attention LoRA was trained while base weights and multimodal projectors were frozen. Held-out assistant-token loss was 0.12035474926233292.
Supervision used weak teacher-generated hazard labels. This validation loss does not establish hazard accuracy, grounding accuracy or severity calibration. See gemma_model.json and adapter/training_manifest.json for the original training records.
Integrity
Gemma SHA-256: fc0b1f17cdf4e5d2cc8f46aff669c1aa53c58eb398f303a1db14912f6153ac92.
RF SHA-256: da22cd0f3c3389716a2a2f402c3bb54dc16eb84ecc821c445b9bd8518359cabf.
The upload checks source artifacts against the original transfer/training checksums and verifies Hub file sizes and content hashes at the resulting immutable commit.
RF-DETR evaluation results
The fixed selected checkpoint was evaluated on 1,000 validation and 1,000
held-out test images using RF-DETR 1.11.2, BF16, batch size 8, confidence cutoff 0
and COCO maxDets 100. The source reports are in
rfdetr-medium-ood-v1/evaluation_metrics.json.
| Detection metric | Validation | Test |
|---|---|---|
| COCO AP, IoU 0.50:0.95 | 0.53415 | 0.54938 |
| AP, IoU 0.50 | 0.72258 | 0.73967 |
| Average recall, max 100 detections | 0.72954 | 0.73873 |
These are detection/localization metrics, not danger accuracy or severity calibration. Small objects and people remain weaknesses. There is no measured matched-label pretrained baseline or verified recording-disjoint evaluation; the results do not establish clear-path false-alert rates or unseen-route accuracy.
Upstream licenses and modification notice
Google's Gemma 4 model card
identifies Gemma 4 as Apache 2.0.
RF-DETR Medium is an Apache-designated core model in
Roboflow's licensing documentation.
licenses/APACHE-2.0.txt and licenses/RF-DETR-LICENSE.txt preserve the
license text and RF upstream attribution. licenses/SOURCES.json records the
source locations and pinned Gemma revision; the pinned Gemma repository did not
supply a separate LICENSE or NOTICE file. Dataset rights are not reassigned here.
Modification notice: Gemma weights contain the AGEII language-attention LoRA training changes described above, merged into the complete base checkpoint. The original adapter is retained. RF-DETR Medium contains AGEII OOD v1 fine-tuning. These are modified trained artifacts, not untouched upstream releases. No independent hazard-accuracy claim or blanket relicensing of training data is made.
requirements-inference.txt provides the corresponding Gemma inference dependency
pins. Install a hardware-compatible CUDA PyTorch/torchvision pair separately.