Organize artifacts and refresh model card

#2
by grKnight - opened
Files changed (1) hide show
  1. README.md +53 -40
README.md CHANGED
@@ -8,8 +8,9 @@ datasets:
8
  language:
9
  - en
10
  pipeline_tag: image-text-to-text
11
- tags:
12
- - vision-language-model
 
13
  - llava
14
  - astronomy
15
  - multimodal
@@ -19,11 +20,13 @@ tags:
19
  - connector
20
  ---
21
 
22
- # AstraQ-VL Stage-2 (connector + LoRA instruction tuning)
 
 
23
 
24
  A LLaVA-style vision–language model that lets **Qwen2.5-1.5B-Instruct** answer questions about
25
- astronomy images encoded by **CLIP ViT-L/14**. This is the **Stage-2** model: it warm-starts the
26
- [AstraQ-VL Stage-1 connector](https://huggingface.co/grKnight/astraq-vl-stage1) and **continues training it
27
  jointly with LoRA adapters on the Qwen LLM**, on the caption + GPT-4 QA records of
28
  [`UniverseTBD/AstroLLaVA_convos`](https://huggingface.co/datasets/UniverseTBD/AstroLLaVA_convos).
29
  The CLIP vision tower stays frozen. Trained on a **disjoint held-out test split** so it can be
@@ -33,24 +36,36 @@ Stage 1 aligned the connector with the LLM frozen — it grounds *coarse* visual
33
  hallucinates fine specifics. Stage 2 opens up the LLM (via LoRA) so the model learns to *use* the
34
  visual evidence when committing to answers — the recipe's instruction-tuning step.
35
 
36
- > ⚠️ This bundle ships the **connector + LoRA adapter only** (not full LLM weights). It is **not** a
37
  > standalone `transformers` model — it needs the custom VLM code from the
38
- > [astronomy-vlm](https://github.com/crimsonKn1ght/astronomy-vlm) repo, the two base models
39
  > (auto-downloaded from the Hub), and [`peft`](https://github.com/huggingface/peft) to run.
40
 
41
- ## Download
42
-
43
- A single bundle holds the final checkpoint and everything needed to run / reproduce it:
44
-
45
- | Bundle | Contents |
46
- |--------|----------|
47
- | `checkpoints/checkpoint-2526/` | Final AstraQ-VL Stage-2 checkpoint: connector, LoRA adapter, metadata, and training state. |
48
- | [`astraq-vl-stage2-metrics.zip`](https://huggingface.co/grKnight/astraq-vl-stage2/blob/main/astraq-vl-stage2-metrics.zip) | Stage-2 metrics artifact. |
 
 
49
 
50
  `checkpoint-2526/` contains the continued-trained connector (`connector.safetensors`), the trained
51
  LoRA adapter (`lora/adapter_model.safetensors` + `adapter_config.json`), optimizer/scheduler state
52
  (`training_state.pt`), and `meta.json` (step + final loss). **Both** the connector and the LoRA are
53
- required at inference.
 
 
 
 
 
 
 
 
 
 
54
 
55
  ## Architecture
56
 
@@ -96,10 +111,10 @@ end of the single epoch, consistent with the 1-epoch choice:
96
  |------|----:|----:|----:|----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|
97
  | held-out loss | 1.605 | 1.571 | 1.548 | 1.526 | 1.508 | 1.494 | 1.479 | 1.471 | 1.462 | 1.456 | 1.454 | 1.452 | **1.452** |
98
 
99
- ![AstraQ-VL Stage-2 held-out loss curve](eval_loss_curve.png)
100
 
101
- Regenerate with `python scripts/eval_loss_curve.py --config configs/finetune_astrollava_stage2.yaml
102
- --checkpoint-dir astraq-vl-stage2/checkpoints --records-json datasets/astrollava_llava/test.json
103
  --image-dir datasets/astrollava_llava/images --num-samples 512 --plot` (full series in
104
  `eval_loss_curve.csv`).
105
 
@@ -107,34 +122,33 @@ Regenerate with `python scripts/eval_loss_curve.py --config configs/finetune_ast
107
 
108
  ```bash
109
  # 1. get the code
110
- git clone https://github.com/crimsonKn1ght/astronomy-vlm && cd astronomy-vlm
111
  pip install -r requirements.txt # includes peft
112
 
113
- # 2. download + unzip the bundle
114
- hf download grKnight/astraq-vl-stage2 --include "checkpoints/checkpoint-2526/**" --local-dir astraq-vl-stage2
115
- # no unzip is needed; checkpoint files are downloaded under astraq-vl-stage2/checkpoints/
116
 
117
  # 3. answer a question about an image (CLIP + Qwen auto-download; peft loads the LoRA)
118
  python inference.py \
119
- --config configs/finetune_astrollava_stage2.yaml \
120
- --checkpoint astraq-vl-stage2/checkpoints/checkpoint-2526 \
121
  --image your_astro_image.jpg \
122
  --prompt "What type of object is this and what is notable about it?" \
123
  --temperature 0
124
  ```
125
 
126
- Pass the Stage-2 **config** so the LoRA modules are built before the adapter weights load; the loader
127
- then restores both the connector and the LoRA automatically. The bundled
128
- `predictions_test_stage2.jsonl` holds the held-out outputs with their reference captions.
129
 
130
  ## Capabilities & limitations
131
 
132
  Stage 2 fine-tunes the LLM (LoRA) jointly with the connector, so — unlike Stage-1 — the language
133
  model itself learns from the QA pairs rather than improvising specifics from its frozen prior. The
134
  intended effect is **fewer hallucinated fine details** (catalog numbers, instruments, dates) on
135
- question-answering prompts, on top of Stage-1's coarse visual grounding. Compare the bundled
136
- `predictions_test_stage2.jsonl` with Stage-1's `predictions_test_ep3.jsonl` (held out, same images)
137
- to see the difference.
138
 
139
  Limitations carried over from the design: CLIP's 224×224 input discards fine astronomical detail;
140
  the base LLM is small (1.5B); and LoRA is a low-rank adaptation, not a full fine-tune. Evaluation is
@@ -142,15 +156,15 @@ a held-out generation set, not a full quantitative benchmark — read results qu
142
 
143
  ## Reproduction
144
 
145
- The bundle's `REPRODUCE.md` pins the exact code commit, base models, the seeded dataset-build
146
- command, the training command, and package versions (`torch`, `transformers`, `peft`). The split is
147
- seeded, so the build reproduces the exact train/test partition.
148
 
149
  ```
150
- prereq: AstraQ-VL Stage-1 connector checkpoint-3789 (grKnight/astraq-vl-stage1 ep3 bundle)
151
  build: python scripts/build_astrollava_trainset.py --include-qa --max-image-size 384 --test-fraction 0.02 --seed 42
152
- train: python train.py --config configs/finetune_astrollava_stage2.yaml
153
- eval: python scripts/batch_inference.py --config configs/finetune_astrollava_stage2.yaml --records-json datasets/astrollava_llava/test.json --num-samples 0 ...
154
  ```
155
 
156
  ## License & attribution
@@ -159,6 +173,5 @@ eval: python scripts/batch_inference.py --config configs/finetune_astrollava_s
159
  - **Training data:** [`UniverseTBD/AstroLLaVA_convos`](https://huggingface.co/datasets/UniverseTBD/AstroLLaVA_convos)
160
  (CC-BY-SA-4.0); imagery from NASA APOD, ESO, and NASA/ESA Hubble.
161
  - **Base models:** Qwen2.5-1.5B-Instruct (Apache-2.0), CLIP ViT-L/14 (OpenAI, MIT).
162
- - **Builds on:** [AstraQ-VL Stage-1](https://huggingface.co/grKnight/astraq-vl-stage1) and the
163
- AstroLLaVA work ([arXiv:2504.08583](https://arxiv.org/abs/2504.08583)).
164
- ```
 
8
  language:
9
  - en
10
  pipeline_tag: image-text-to-text
11
+ tags:
12
+ - astraq-vl
13
+ - vision-language-model
14
  - llava
15
  - astronomy
16
  - multimodal
 
20
  - connector
21
  ---
22
 
23
+ # AstraQ-VL Stage-2 (connector + LoRA instruction tuning)
24
+
25
+ AstraQ-VL Stage-2 is the public name for this connector-plus-LoRA checkpoint.
26
 
27
  A LLaVA-style vision–language model that lets **Qwen2.5-1.5B-Instruct** answer questions about
28
+ astronomy images encoded by **CLIP ViT-L/14**. This is the **AstraQ-VL Stage-2** model: it warm-starts the
29
+ [AstraQ-VL Stage-1 connector](https://huggingface.co/grKnight/astraq-vl-stage1) and **continues training it
30
  jointly with LoRA adapters on the Qwen LLM**, on the caption + GPT-4 QA records of
31
  [`UniverseTBD/AstroLLaVA_convos`](https://huggingface.co/datasets/UniverseTBD/AstroLLaVA_convos).
32
  The CLIP vision tower stays frozen. Trained on a **disjoint held-out test split** so it can be
 
36
  hallucinates fine specifics. Stage 2 opens up the LLM (via LoRA) so the model learns to *use* the
37
  visual evidence when committing to answers — the recipe's instruction-tuning step.
38
 
39
+ > ⚠️ This repository ships the **connector + LoRA adapter only** (not full LLM weights). It is **not** a
40
  > standalone `transformers` model — it needs the custom VLM code from the
41
+ > [astraq-vl](https://github.com/crimsonKn1ght/astraq-vl) repo, the two base models
42
  > (auto-downloaded from the Hub), and [`peft`](https://github.com/huggingface/peft) to run.
43
 
44
+ ## Download
45
+
46
+ The repository contains checkpoints saved every 200 steps and the final checkpoint at step 2526.
47
+ For inference, download the final checkpoint directory:
48
+
49
+ | Artifact | Contents |
50
+ |----------|----------|
51
+ | [`checkpoints/checkpoint-2526/`](https://huggingface.co/grKnight/astraq-vl-stage2/tree/main/checkpoints/checkpoint-2526) | Final connector, LoRA adapter, metadata, and training state. |
52
+ | [`astraq-vl-stage2-metrics.zip`](https://huggingface.co/grKnight/astraq-vl-stage2/blob/main/metrics/astraq-vl-stage2-metrics.zip) | Stage-2 aggregate and per-sample metrics. |
53
+ | [`eval_loss_curve.zip`](https://huggingface.co/grKnight/astraq-vl-stage2/blob/main/metrics/eval-loss-curve/eval_loss_curve.zip) | Held-out loss curve in CSV, JSON, and PNG formats. |
54
 
55
  `checkpoint-2526/` contains the continued-trained connector (`connector.safetensors`), the trained
56
  LoRA adapter (`lora/adapter_model.safetensors` + `adapter_config.json`), optimizer/scheduler state
57
  (`training_state.pt`), and `meta.json` (step + final loss). **Both** the connector and the LoRA are
58
+ required at inference.
59
+
60
+ ## Evaluation artifacts
61
+
62
+ | Artifact | Scope | Contents |
63
+ |----------|-------|----------|
64
+ | [`astraq-vl-stage2-full-heldout-eval-v1.zip`](https://huggingface.co/grKnight/astraq-vl-stage2/blob/main/evaluations/full-heldout/astraq-vl-stage2-full-heldout-eval-v1.zip) | **Full held-out: captions + QA** | Predictions and aggregate/per-sample metrics for all 3,271 held-out records: 586 caption records and 2,685 QA records, plus comparisons, config, test split, and reproduction notes. |
65
+ | [`phase0_stage2_results.zip`](https://huggingface.co/grKnight/astraq-vl-stage2/blob/main/evaluations/phase0/phase0_stage2_results.zip) | **Phase 0 (captions only)** | Caption predictions for 591 held-out images, with NLI and SBERT aggregate/per-sample scores; 586 images have reference captions used for scoring. |
66
+
67
+ The Phase 0 archive does **not** include the held-out QA records. Use the full-heldout artifact for
68
+ the combined caption + QA evaluation.
69
 
70
  ## Architecture
71
 
 
111
  |------|----:|----:|----:|----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|-----:|
112
  | held-out loss | 1.605 | 1.571 | 1.548 | 1.526 | 1.508 | 1.494 | 1.479 | 1.471 | 1.462 | 1.456 | 1.454 | 1.452 | **1.452** |
113
 
114
+ ![AstraQ-VL Stage-2 held-out loss curve](metrics/eval-loss-curve/eval_loss_curve.png)
115
 
116
+ Regenerate with `python scripts/eval_loss_curve.py --config configs/finetune_astraq_vl_stage2.yaml
117
+ --checkpoint-dir checkpoints/astraq-vl-stage2 --records-json datasets/astrollava_llava/test.json
118
  --image-dir datasets/astrollava_llava/images --num-samples 512 --plot` (full series in
119
  `eval_loss_curve.csv`).
120
 
 
122
 
123
  ```bash
124
  # 1. get the code
125
+ git clone https://github.com/crimsonKn1ght/astraq-vl && cd astraq-vl
126
  pip install -r requirements.txt # includes peft
127
 
128
+ # 2. download the final checkpoint directory
129
+ hf download grKnight/astraq-vl-stage2 --include "checkpoints/checkpoint-2526/**" --local-dir astraq-vl-stage2
 
130
 
131
  # 3. answer a question about an image (CLIP + Qwen auto-download; peft loads the LoRA)
132
  python inference.py \
133
+ --config configs/finetune_astraq_vl_stage2.yaml \
134
+ --checkpoint astraq-vl-stage2/checkpoints/checkpoint-2526 \
135
  --image your_astro_image.jpg \
136
  --prompt "What type of object is this and what is notable about it?" \
137
  --temperature 0
138
  ```
139
 
140
+ Pass the Stage-2 **config** so the LoRA modules are built before the adapter weights load; the loader
141
+ then restores both the connector and the LoRA automatically. Caption-only predictions are in the
142
+ Phase 0 archive; combined caption + QA predictions are in the full-heldout archive.
143
 
144
  ## Capabilities & limitations
145
 
146
  Stage 2 fine-tunes the LLM (LoRA) jointly with the connector, so — unlike Stage-1 — the language
147
  model itself learns from the QA pairs rather than improvising specifics from its frozen prior. The
148
  intended effect is **fewer hallucinated fine details** (catalog numbers, instruments, dates) on
149
+ question-answering prompts, on top of Stage-1's coarse visual grounding. Compare Stage 2's
150
+ `predictions_full_heldout.jsonl` with the corresponding Stage-1 held-out predictions to inspect the
151
+ difference on the same held-out split.
152
 
153
  Limitations carried over from the design: CLIP's 224×224 input discards fine astronomical detail;
154
  the base LLM is small (1.5B); and LoRA is a low-rank adaptation, not a full fine-tune. Evaluation is
 
156
 
157
  ## Reproduction
158
 
159
+ The full-heldout evaluation archive contains `REPRODUCE_FULL_HELDOUT.md`, the Stage-2 config, and
160
+ the exact `test.json` split used for that evaluation. The split is seeded, so the build command below
161
+ reproduces the train/test partition.
162
 
163
  ```
164
+ prereq: Stage-1 connector checkpoint-3789 (grKnight/astraq-vl-stage1 ep3 bundle)
165
  build: python scripts/build_astrollava_trainset.py --include-qa --max-image-size 384 --test-fraction 0.02 --seed 42
166
+ train: python train.py --config configs/finetune_astraq_vl_stage2.yaml
167
+ eval: python scripts/batch_inference.py --config configs/finetune_astraq_vl_stage2.yaml --records-json datasets/astrollava_llava/test.json --num-samples 0 ...
168
  ```
169
 
170
  ## License & attribution
 
173
  - **Training data:** [`UniverseTBD/AstroLLaVA_convos`](https://huggingface.co/datasets/UniverseTBD/AstroLLaVA_convos)
174
  (CC-BY-SA-4.0); imagery from NASA APOD, ESO, and NASA/ESA Hubble.
175
  - **Base models:** Qwen2.5-1.5B-Instruct (Apache-2.0), CLIP ViT-L/14 (OpenAI, MIT).
176
+ - **Builds on:** [AstraQ-VL Stage-1](https://huggingface.co/grKnight/astraq-vl-stage1) and the
177
+ AstroLLaVA work ([arXiv:2504.08583](https://arxiv.org/abs/2504.08583)).