YeMoKoo commited on
Commit
6cc8fb3
·
verified ·
1 Parent(s): fb502e6

Fix load example: Qwen3-VL needs AutoModelForImageTextToText, not AutoModelForCausalLM

Browse files
README.md CHANGED
@@ -19,11 +19,23 @@ Reward scales are **not comparable across the two** — they come from different
19
  reward models. Compare policies by downstream task performance, not by these numbers.
20
 
21
  ```python
22
- from peft import AutoPeftModelForCausalLM
23
- model = AutoPeftModelForCausalLM.from_pretrained(
24
- "YeMoKoo/AF_RL", subfolder="scalar-firsterror-20260817", torch_dtype="bfloat16")
 
 
 
 
 
 
 
25
  ```
26
 
 
 
 
 
 
27
  Both were trained on the `first_error` split (2,662 samples) of
28
  `Gyubeum/AndroidFlux_RL_Train_Test` @ `4545695c26951a4884e8f18e6468d69cbdf9d174`,
29
  for 1 epoch with identical hyperparameters — the reward model is the only
 
19
  reward models. Compare policies by downstream task performance, not by these numbers.
20
 
21
  ```python
22
+ import torch
23
+ from transformers import AutoModelForImageTextToText
24
+ from peft import PeftModel
25
+
26
+ base = AutoModelForImageTextToText.from_pretrained(
27
+ "Qwen/Qwen3-VL-2B-Instruct",
28
+ revision="89644892e4d85e24eaac8bacfd4f463576704203",
29
+ dtype=torch.bfloat16, device_map="cuda")
30
+ model = PeftModel.from_pretrained(
31
+ base, "YeMoKoo/AF_RL", subfolder="scalar-firsterror-20260817")
32
  ```
33
 
34
+ Qwen3-VL is a vision-language model, so `AutoModelForCausalLM` /
35
+ `AutoPeftModelForCausalLM` do **not** work — use `AutoModelForImageTextToText`.
36
+ After loading, assert
37
+ `sum("lora" in n.lower() for n, _ in model.named_parameters()) == 392`.
38
+
39
  Both were trained on the `first_error` split (2,662 samples) of
40
  `Gyubeum/AndroidFlux_RL_Train_Test` @ `4545695c26951a4884e8f18e6468d69cbdf9d174`,
41
  for 1 epoch with identical hyperparameters — the reward model is the only
discrete-firsterror-20260817/README.md CHANGED
@@ -9,30 +9,32 @@ Reward model: **discrete** — judge-token `<|+|>` / `<|-|>` log-probability mar
9
  ## Load
10
 
11
  ```python
12
- from peft import AutoPeftModelForCausalLM
13
- model = AutoPeftModelForCausalLM.from_pretrained(
14
- "YeMoKoo/AF_RL", subfolder="discrete-firsterror-20260817", torch_dtype="bfloat16")
15
- ```
16
 
17
- Or with the base model loaded explicitly:
18
 
19
- ```python
20
- from transformers import AutoModelForCausalLM
21
- from peft import PeftModel
22
- base = AutoModelForCausalLM.from_pretrained(
23
- "Qwen/Qwen3-VL-2B-Instruct",
24
- revision="89644892e4d85e24eaac8bacfd4f463576704203",
25
- torch_dtype="bfloat16")
26
  model = PeftModel.from_pretrained(base, "YeMoKoo/AF_RL", subfolder="discrete-firsterror-20260817")
 
 
 
 
27
  ```
28
 
29
- The base checkpoint is pinned in `adapter_config.json`
30
- (`Qwen/Qwen3-VL-2B-Instruct` @ `89644892e4d85e24eaac8bacfd4f463576704203`) and is
31
- downloaded automatically.
 
 
 
32
 
33
- > `target_modules` is a **regex** over `model.language_model.*`. Verify the adapter
34
- > actually attached (`sum("lora" in n for n, _ in model.named_parameters()) > 0`);
35
- > a different `transformers` version can silently match zero modules.
 
36
  > Trained with `transformers==4.57.6`, `peft==0.19.1`, `torch==2.8.0`.
37
 
38
  ## Training data
 
9
  ## Load
10
 
11
  ```python
12
+ import torch
13
+ from transformers import AutoModelForImageTextToText, AutoProcessor
14
+ from peft import PeftModel
 
15
 
16
+ BASE, REV = "Qwen/Qwen3-VL-2B-Instruct", "89644892e4d85e24eaac8bacfd4f463576704203"
17
 
18
+ base = AutoModelForImageTextToText.from_pretrained(
19
+ BASE, revision=REV, dtype=torch.bfloat16, device_map="cuda")
 
 
 
 
 
20
  model = PeftModel.from_pretrained(base, "YeMoKoo/AF_RL", subfolder="discrete-firsterror-20260817")
21
+ processor = AutoProcessor.from_pretrained(BASE, revision=REV)
22
+
23
+ # sanity check: must be 392, not 0
24
+ assert sum("lora" in n.lower() for n, _ in model.named_parameters()) == 392
25
  ```
26
 
27
+ Qwen3-VL is a vision-language model (`Qwen3VLForConditionalGeneration`) and is
28
+ **not** registered in `MODEL_FOR_CAUSAL_LM_MAPPING`, so `AutoModelForCausalLM` and
29
+ `AutoPeftModelForCausalLM` do not work here — use `AutoModelForImageTextToText`.
30
+
31
+ The base checkpoint is also pinned in `adapter_config.json`
32
+ (`Qwen/Qwen3-VL-2B-Instruct` @ `89644892e4d85e24eaac8bacfd4f463576704203`).
33
 
34
+ > `target_modules` is a **regex** over `model.language_model.*`. A different
35
+ > `transformers` version can rename modules so the regex matches **zero** of them;
36
+ > the adapter then loads without any error and the model behaves exactly like the
37
+ > base. Always assert the 392 LoRA parameter count above.
38
  > Trained with `transformers==4.57.6`, `peft==0.19.1`, `torch==2.8.0`.
39
 
40
  ## Training data
scalar-firsterror-20260817/README.md CHANGED
@@ -9,30 +9,32 @@ Reward model: **scalar** — Bradley-Terry scalar head; raw scalar reward.
9
  ## Load
10
 
11
  ```python
12
- from peft import AutoPeftModelForCausalLM
13
- model = AutoPeftModelForCausalLM.from_pretrained(
14
- "YeMoKoo/AF_RL", subfolder="scalar-firsterror-20260817", torch_dtype="bfloat16")
15
- ```
16
 
17
- Or with the base model loaded explicitly:
18
 
19
- ```python
20
- from transformers import AutoModelForCausalLM
21
- from peft import PeftModel
22
- base = AutoModelForCausalLM.from_pretrained(
23
- "Qwen/Qwen3-VL-2B-Instruct",
24
- revision="89644892e4d85e24eaac8bacfd4f463576704203",
25
- torch_dtype="bfloat16")
26
  model = PeftModel.from_pretrained(base, "YeMoKoo/AF_RL", subfolder="scalar-firsterror-20260817")
 
 
 
 
27
  ```
28
 
29
- The base checkpoint is pinned in `adapter_config.json`
30
- (`Qwen/Qwen3-VL-2B-Instruct` @ `89644892e4d85e24eaac8bacfd4f463576704203`) and is
31
- downloaded automatically.
 
 
 
32
 
33
- > `target_modules` is a **regex** over `model.language_model.*`. Verify the adapter
34
- > actually attached (`sum("lora" in n for n, _ in model.named_parameters()) > 0`);
35
- > a different `transformers` version can silently match zero modules.
 
36
  > Trained with `transformers==4.57.6`, `peft==0.19.1`, `torch==2.8.0`.
37
 
38
  ## Training data
 
9
  ## Load
10
 
11
  ```python
12
+ import torch
13
+ from transformers import AutoModelForImageTextToText, AutoProcessor
14
+ from peft import PeftModel
 
15
 
16
+ BASE, REV = "Qwen/Qwen3-VL-2B-Instruct", "89644892e4d85e24eaac8bacfd4f463576704203"
17
 
18
+ base = AutoModelForImageTextToText.from_pretrained(
19
+ BASE, revision=REV, dtype=torch.bfloat16, device_map="cuda")
 
 
 
 
 
20
  model = PeftModel.from_pretrained(base, "YeMoKoo/AF_RL", subfolder="scalar-firsterror-20260817")
21
+ processor = AutoProcessor.from_pretrained(BASE, revision=REV)
22
+
23
+ # sanity check: must be 392, not 0
24
+ assert sum("lora" in n.lower() for n, _ in model.named_parameters()) == 392
25
  ```
26
 
27
+ Qwen3-VL is a vision-language model (`Qwen3VLForConditionalGeneration`) and is
28
+ **not** registered in `MODEL_FOR_CAUSAL_LM_MAPPING`, so `AutoModelForCausalLM` and
29
+ `AutoPeftModelForCausalLM` do not work here — use `AutoModelForImageTextToText`.
30
+
31
+ The base checkpoint is also pinned in `adapter_config.json`
32
+ (`Qwen/Qwen3-VL-2B-Instruct` @ `89644892e4d85e24eaac8bacfd4f463576704203`).
33
 
34
+ > `target_modules` is a **regex** over `model.language_model.*`. A different
35
+ > `transformers` version can rename modules so the regex matches **zero** of them;
36
+ > the adapter then loads without any error and the model behaves exactly like the
37
+ > base. Always assert the 392 LoRA parameter count above.
38
  > Trained with `transformers==4.57.6`, `peft==0.19.1`, `torch==2.8.0`.
39
 
40
  ## Training data