SamHung commited on
Commit
77f2d52
·
verified ·
1 Parent(s): e440eec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +131 -15
README.md CHANGED
@@ -1,22 +1,138 @@
1
  ---
2
- base_model: unsloth/llama-3.2-11b-vision-instruct-bnb-4bit
3
- tags:
4
- - text-generation-inference
5
- - transformers
6
- - unsloth
7
- - mllama
8
- - trl
9
- license: apache-2.0
10
  language:
11
- - en
 
 
 
 
 
 
 
 
 
 
 
12
  ---
13
 
14
- # Uploaded model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- - **Developed by:** SamHung
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** unsloth/llama-3.2-11b-vision-instruct-bnb-4bit
19
 
20
- This mllama model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
 
 
 
 
 
 
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
1
  ---
2
+ base_model: unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit
3
+ library_name: peft
4
+ license: llama3.2
 
 
 
 
 
5
  language:
6
+ - en
7
+ pipeline_tag: image-to-text
8
+ datasets:
9
+ - AIOmarRehan/space-multimodal-dataset
10
+ tags:
11
+ - lora
12
+ - peft
13
+ - unsloth
14
+ - mllama
15
+ - vision-language
16
+ - image-captioning
17
+ - astronomy
18
  ---
19
 
20
+ # AstroVision LoRA — astronomy image captioning
21
+
22
+ LoRA adapter for `Llama-3.2-11B-Vision-Instruct`, trained on 250 astronomy
23
+ image/caption pairs on a single free-tier T4.
24
+
25
+ **Full model card, training code, evaluation and limitations:**
26
+ [`Samuelsunshine/astrovision-lora-debugging`](https://github.com/Samuelsunshine/astrovision-lora-debugging)
27
+
28
+ The repository is two things: this pipeline, and a written audit of five defects
29
+ in the published pipeline it reproduces — one of which made that project's
30
+ public demo serve base weights instead of its fine-tune, silently.
31
+ [Read the audit](https://github.com/Samuelsunshine/astrovision-lora-debugging/blob/main/DEBUGGING.md).
32
+
33
+ ## Licence
34
+
35
+ **Llama 3.2 Community License.** This adapter is a derivative of
36
+ Llama-3.2-11B-Vision-Instruct and inherits that licence — not Apache 2.0, which
37
+ is what the auto-generated card originally said here. See
38
+ [the licence](https://github.com/meta-llama/llama-models/blob/main/models/llama3_2/LICENSE).
39
+
40
+ The training and evaluation *code* in the linked repository is MIT. The dataset's
41
+ source imagery has unestablished provenance; check before downstream use.
42
+
43
+ ## Results
44
+
45
+ Tesla T4, 2026-08-21, 25 held-out images, greedy decoding. Raw log
46
+ [committed in the repository](https://github.com/Samuelsunshine/astrovision-lora-debugging/blob/main/evidence/runs/2026-08-21-t4-mainline.json).
47
+
48
+ | Metric | Value |
49
+ |---|---|
50
+ | BLEU | 0.0722 |
51
+ | ROUGE-1 / ROUGE-2 / ROUGE-L | 0.3735 / 0.1405 / 0.3361 |
52
+ | `length_ratio` | 0.9561 |
53
+ | Best validation loss | 0.7232 (at the final step) |
54
+
55
+ Validation loss fell monotonically with its minimum at step 30, so the model is
56
+ **undertrained** at this budget rather than overfit. 30 steps was chosen to match
57
+ the compute of the pipeline being reproduced.
58
+
59
+ **BLEU is a weak fit for captioning** and these numbers are not a quality claim.
60
+ An image has many correct descriptions, and two correct captions with disjoint
61
+ vocabulary both score near zero. They are reported because they are reproducible
62
+ and comparable across this project's own runs.
63
+
64
+ ## Limitations — please read before trusting a caption
65
+
66
+ **This is not an astronomy tool.** It was trained on 250 images across five
67
+ loosely-defined subjects (Earth from orbit, Mars, Mars rovers, the Milky Way,
68
+ Hubble) for 30 optimizer steps. It reproduces the *writing style* of that corpus.
69
+ It has no astronomical knowledge beyond what the base model already had.
70
+
71
+ **It is confidently wrong, demonstrated.** From the held-out set, unedited:
72
+
73
+ > **Reference:** A close-up photograph of a Mars rover undergoing calibration
74
+ > tests inside a NASA facility **on Earth**.
75
+ > **Prediction:** A photograph of the Mars rover exploring the **Martian
76
+ > terrain** under the reddish-orange sky.
77
+
78
+ A laboratory on Earth described as the surface of Mars, fluently, with no
79
+ hedging. Two of five logged samples make errors of this kind.
80
+
81
+ **Do not use it for** identification of objects, missions, instruments or
82
+ locations; measurement or any scientific claim; accessibility descriptions,
83
+ where a confident wrong caption is worse than none; or education without review.
84
+
85
+ **Out of domain it degrades quietly.** Given a photograph that is not astronomy
86
+ imagery it will still produce an astronomy-flavoured caption, because that is the
87
+ only register it was trained in. Fluency here is unrelated to correctness.
88
+
89
+ ## Usage
90
+
91
+ ```python
92
+ from peft import PeftModel
93
+ from unsloth import FastVisionModel
94
+
95
+ model, tokenizer = FastVisionModel.from_pretrained(
96
+ "unsloth/Llama-3.2-11B-Vision-Instruct-bnb-4bit",
97
+ load_in_4bit=True,
98
+ use_gradient_checkpointing="unsloth",
99
+ )
100
+ model = PeftModel.from_pretrained(model, "SamHung/astrovision-lora")
101
+ FastVisionModel.for_inference(model)
102
+ ```
103
+
104
+ Use `PeftModel.from_pretrained` to load a trained adapter.
105
+ `FastVisionModel.get_peft_model(model, lora_adapter=...)` reads as though it
106
+ would do the same and does not — it constructs a *new* adapter and ignores the
107
+ keyword, and because LoRA initialises `B` to zero the result is
108
+ mathematically identical to the base model, with no error raised. That failure
109
+ is Finding 4 in the audit, and
110
+ [`scripts/verify_adapter_loading.py`](https://github.com/Samuelsunshine/astrovision-lora-debugging/blob/main/scripts/verify_adapter_loading.py)
111
+ exists to catch it: it checks the artifacts are present, that `‖lora_B‖ > 0`,
112
+ and that enabling the adapter actually changes the output.
113
+
114
+ Inference should go through `generate_caption()` from the repository, which
115
+ slices the prompt off in token space and always states `do_sample` explicitly —
116
+ decoding the full `generate()` output echoes the instruction into every
117
+ prediction and roughly doubles measured length.
118
+
119
+ ## Training
120
+
121
+ LoRA `r=16`, `alpha=16`, `dropout=0`, `bias="none"`, on vision and language
122
+ layers, attention and MLP. 30 steps at an effective batch of 8, `lr=2e-4`,
123
+ `adamw_8bit`, fp16, 4-bit NF4 base. 200 train / 25 validation / 25 test,
124
+ `seed=42`, split **before** any training dataset was built and asserted disjoint
125
+ at runtime. 67,174,400 trainable parameters. 20.1 minutes on a T4, peak 9.227 GB
126
+ of 14.563 GB.
127
 
128
+ ## Provenance
 
 
129
 
130
+ Coursework reproduction. The dataset is
131
+ [`AIOmarRehan/space-multimodal-dataset`](https://huggingface.co/datasets/AIOmarRehan/space-multimodal-dataset)
132
+ and the pipeline reproduced is
133
+ [`AIOmarRehan/Unsloth_Llama_3.2_11B_Vision_Instruct_Astronomy`](https://github.com/AIOmarRehan/Unsloth_Llama_3.2_11B_Vision_Instruct_Astronomy)
134
+ (MIT, © Omar Rehan). Three data/evaluation defects in that pipeline were found
135
+ and fixed here, and two further findings documented; the audited code and every
136
+ execution log cited as evidence are the original author's.
137
 
138
+ Trained with [Unsloth](https://github.com/unslothai/unsloth) and TRL.