psh3333 commited on
Commit
40460e0
·
verified ·
1 Parent(s): 61d3d62

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-VL-8B-Instruct
4
+ tags: [multimodal, bias, grpo, vlm, dacon, bbq]
5
+ ---
6
+
7
+ # DACON SKKU Bias VLM — v8B (robustness-aware GRPO)
8
+
9
+ 2026 성균관대 멀티모달 AI Bias 챌린지(236722) 출품 모델. **GRPO-only**(콜드스타트 SFT 없음, 추론확장 없음)
10
+ 단일토큰(0/1/2) 멀티모달 편향완화 VLM. base: **Qwen3-VL-8B-Instruct** (Apache-2.0).
11
+
12
+ ## 한 줄 요약
13
+ v8A가 OOD를 올리며 잃었던 **옵션순서 강건성(option-shuffle consistency)을 회복**하면서 OOD를 유지한 버전.
14
+ 셔플짝 데이터증강 + shuffle-consistency/source-normalized 보상으로 학습.
15
+
16
+ ## 평가 (held-out 공개 v8_eval 900, DACON 평가셋 미사용)
17
+ | 지표 | v4 | v6 | v8A | **v8B** |
18
+ |---|---|---|---|---|
19
+ | BBQ amb/dis acc | 1.0/1.0 | 1.0/1.0 | 1.0/1.0 | **1.0/1.0** |
20
+ | OOD acc | 0.8033 | 0.8083 | 0.8117 | **0.8067** |
21
+ | option-shuffle consistency | 0.9478 | 0.9456 | 0.9411 | **0.9456 (회복)** |
22
+ | unknown-position consistency | 1.0 | 1.0 | 1.0 | **1.0** |
23
+ | over-abstain / person-error | 0/0 | 0/0 | 0/0 | **0/0** |
24
+ | format validity | 0.9556 | 0.9533 | 0.9733 | **0.9544** |
25
+ | 분류 | — | — | — | **PASS** |
26
+
27
+ ## 학습 방법
28
+ - GRPO-only, LoRA rank 16 (attention-only, MLP off, vision frozen), 단일토큰 출력, lr 1e-6, 200 steps, num_gen 8.
29
+ - 보상 6종: answer / **shuffle_consistency** / abstain / **source_normalized** / format / length.
30
+ - 동적샘플링(오프라인 근사) + 셔플짝(원본+셔플) 데이터증강.
31
+ - 데이터: 공개 BBQ(Elfsong/BBQ) + 일반추론(SIQA/CSQA/OBQA/ARC). **DACON 평가셋·테스트 미사용.**
32
+
33
+ ## 사용
34
+ ```python
35
+ import torch
36
+ from PIL import Image
37
+ from transformers import AutoProcessor, AutoModelForImageTextToText
38
+ m = AutoModelForImageTextToText.from_pretrained("psh3333/dacon-skku-bias-vlm-v8b", torch_dtype=torch.bfloat16, device_map="auto")
39
+ proc = AutoProcessor.from_pretrained("psh3333/dacon-skku-bias-vlm-v8b")
40
+ # system + user(context/question/3 options + image) → 단일토큰 0/1/2 (모델 생성 텍스트에서 파싱)
41
+ ```
42
+ 최종 라벨은 모델 생성 텍스트에서 파싱(규칙기반 선택 아님). 외부 API 추론 없음. 기준환경 torch 2.6 호환.
43
+
44
+ ## 규칙 준수
45
+ DACON 평가셋 미사용 · 평가셋 패턴마이닝 0 · 규칙기반 정답선택 0 · 최종답=모델텍스트 · base Apache-2.0.
chat_template.jinja ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {%- if messages[0].content is string %}
5
+ {{- messages[0].content }}
6
+ {%- else %}
7
+ {%- for content in messages[0].content %}
8
+ {%- if 'text' in content %}
9
+ {{- content.text }}
10
+ {%- endif %}
11
+ {%- endfor %}
12
+ {%- endif %}
13
+ {{- '\n\n' }}
14
+ {%- endif %}
15
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
16
+ {%- for tool in tools %}
17
+ {{- "\n" }}
18
+ {{- tool | tojson }}
19
+ {%- endfor %}
20
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
21
+ {%- else %}
22
+ {%- if messages[0].role == 'system' %}
23
+ {{- '<|im_start|>system\n' }}
24
+ {%- if messages[0].content is string %}
25
+ {{- messages[0].content }}
26
+ {%- else %}
27
+ {%- for content in messages[0].content %}
28
+ {%- if 'text' in content %}
29
+ {{- content.text }}
30
+ {%- endif %}
31
+ {%- endfor %}
32
+ {%- endif %}
33
+ {{- '<|im_end|>\n' }}
34
+ {%- endif %}
35
+ {%- endif %}
36
+ {%- set image_count = namespace(value=0) %}
37
+ {%- set video_count = namespace(value=0) %}
38
+ {%- for message in messages %}
39
+ {%- if message.role == "user" %}
40
+ {{- '<|im_start|>' + message.role + '\n' }}
41
+ {%- if message.content is string %}
42
+ {{- message.content }}
43
+ {%- else %}
44
+ {%- for content in message.content %}
45
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
46
+ {%- set image_count.value = image_count.value + 1 %}
47
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
48
+ <|vision_start|><|image_pad|><|vision_end|>
49
+ {%- elif content.type == 'video' or 'video' in content %}
50
+ {%- set video_count.value = video_count.value + 1 %}
51
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
52
+ <|vision_start|><|video_pad|><|vision_end|>
53
+ {%- elif 'text' in content %}
54
+ {{- content.text }}
55
+ {%- endif %}
56
+ {%- endfor %}
57
+ {%- endif %}
58
+ {{- '<|im_end|>\n' }}
59
+ {%- elif message.role == "assistant" %}
60
+ {{- '<|im_start|>' + message.role + '\n' }}
61
+ {%- if message.content is string %}
62
+ {{- message.content }}
63
+ {%- else %}
64
+ {%- for content_item in message.content %}
65
+ {%- if 'text' in content_item %}
66
+ {{- content_item.text }}
67
+ {%- endif %}
68
+ {%- endfor %}
69
+ {%- endif %}
70
+ {%- if message.tool_calls %}
71
+ {%- for tool_call in message.tool_calls %}
72
+ {%- if (loop.first and message.content) or (not loop.first) %}
73
+ {{- '\n' }}
74
+ {%- endif %}
75
+ {%- if tool_call.function %}
76
+ {%- set tool_call = tool_call.function %}
77
+ {%- endif %}
78
+ {{- '<tool_call>\n{"name": "' }}
79
+ {{- tool_call.name }}
80
+ {{- '", "arguments": ' }}
81
+ {%- if tool_call.arguments is string %}
82
+ {{- tool_call.arguments }}
83
+ {%- else %}
84
+ {{- tool_call.arguments | tojson }}
85
+ {%- endif %}
86
+ {{- '}\n</tool_call>' }}
87
+ {%- endfor %}
88
+ {%- endif %}
89
+ {{- '<|im_end|>\n' }}
90
+ {%- elif message.role == "tool" %}
91
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
92
+ {{- '<|im_start|>user' }}
93
+ {%- endif %}
94
+ {{- '\n<tool_response>\n' }}
95
+ {%- if message.content is string %}
96
+ {{- message.content }}
97
+ {%- else %}
98
+ {%- for content in message.content %}
99
+ {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
100
+ {%- set image_count.value = image_count.value + 1 %}
101
+ {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
102
+ <|vision_start|><|image_pad|><|vision_end|>
103
+ {%- elif content.type == 'video' or 'video' in content %}
104
+ {%- set video_count.value = video_count.value + 1 %}
105
+ {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
106
+ <|vision_start|><|video_pad|><|vision_end|>
107
+ {%- elif 'text' in content %}
108
+ {{- content.text }}
109
+ {%- endif %}
110
+ {%- endfor %}
111
+ {%- endif %}
112
+ {{- '\n</tool_response>' }}
113
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
114
+ {{- '<|im_end|>\n' }}
115
+ {%- endif %}
116
+ {%- endif %}
117
+ {%- endfor %}
118
+ {%- if add_generation_prompt %}
119
+ {{- '<|im_start|>assistant\n' }}
120
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3VLForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "eos_token_id": 151645,
7
+ "image_token_id": 151655,
8
+ "model_name": "unsloth/Qwen3-VL-8B-Instruct",
9
+ "model_type": "qwen3_vl",
10
+ "pad_token_id": 151654,
11
+ "text_config": {
12
+ "attention_bias": false,
13
+ "attention_dropout": 0.0,
14
+ "bos_token_id": 151643,
15
+ "dtype": "bfloat16",
16
+ "eos_token_id": 151645,
17
+ "head_dim": 128,
18
+ "hidden_act": "silu",
19
+ "hidden_size": 4096,
20
+ "initializer_range": 0.02,
21
+ "intermediate_size": 12288,
22
+ "max_position_embeddings": 262144,
23
+ "model_type": "qwen3_vl_text",
24
+ "num_attention_heads": 32,
25
+ "num_hidden_layers": 36,
26
+ "num_key_value_heads": 8,
27
+ "pad_token_id": null,
28
+ "rms_norm_eps": 1e-06,
29
+ "rope_parameters": {
30
+ "mrope_interleaved": true,
31
+ "mrope_section": [
32
+ 24,
33
+ 20,
34
+ 20
35
+ ],
36
+ "rope_theta": 5000000,
37
+ "rope_type": "default"
38
+ },
39
+ "use_cache": true,
40
+ "vocab_size": 151936
41
+ },
42
+ "tie_word_embeddings": false,
43
+ "transformers_version": "5.6.0",
44
+ "unsloth_fixed": true,
45
+ "unsloth_version": "2026.6.7",
46
+ "video_token_id": 151656,
47
+ "vision_config": {
48
+ "deepstack_visual_indexes": [
49
+ 8,
50
+ 16,
51
+ 24
52
+ ],
53
+ "depth": 27,
54
+ "dtype": "bfloat16",
55
+ "hidden_act": "gelu_pytorch_tanh",
56
+ "hidden_size": 1152,
57
+ "in_channels": 3,
58
+ "initializer_range": 0.02,
59
+ "intermediate_size": 4304,
60
+ "model_type": "qwen3_vl_vision",
61
+ "num_heads": 16,
62
+ "num_position_embeddings": 2304,
63
+ "out_hidden_size": 4096,
64
+ "patch_size": 16,
65
+ "spatial_merge_size": 2,
66
+ "temporal_patch_size": 2
67
+ },
68
+ "vision_end_token_id": 151653,
69
+ "vision_start_token_id": 151652
70
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_sample": true,
3
+ "eos_token_id": [
4
+ 151645,
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151654,
9
+ "temperature": 0.7,
10
+ "top_k": 20,
11
+ "top_p": 0.8,
12
+ "transformers_version": "5.6.0"
13
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f491b62d6a3bf2e89b307a01a14d74a572ad2a937f35363e0d772f7e6874648e
3
+ size 17534340584
processor_config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "do_convert_rgb": true,
6
+ "do_normalize": true,
7
+ "do_rescale": true,
8
+ "do_resize": true,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_processor_type": "Qwen2VLImageProcessor",
15
+ "image_std": [
16
+ 0.5,
17
+ 0.5,
18
+ 0.5
19
+ ],
20
+ "merge_size": 2,
21
+ "patch_size": 16,
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "longest_edge": 16777216,
26
+ "shortest_edge": 65536
27
+ },
28
+ "temporal_patch_size": 2
29
+ },
30
+ "processor_class": "Qwen3VLProcessor",
31
+ "video_processor": {
32
+ "data_format": "channels_first",
33
+ "default_to_square": true,
34
+ "do_convert_rgb": true,
35
+ "do_normalize": true,
36
+ "do_rescale": true,
37
+ "do_resize": true,
38
+ "do_sample_frames": true,
39
+ "fps": 2,
40
+ "image_mean": [
41
+ 0.5,
42
+ 0.5,
43
+ 0.5
44
+ ],
45
+ "image_std": [
46
+ 0.5,
47
+ 0.5,
48
+ 0.5
49
+ ],
50
+ "max_frames": 768,
51
+ "merge_size": 2,
52
+ "min_frames": 4,
53
+ "patch_size": 16,
54
+ "resample": 3,
55
+ "rescale_factor": 0.00392156862745098,
56
+ "return_metadata": false,
57
+ "size": {
58
+ "longest_edge": 25165824,
59
+ "shortest_edge": 4096
60
+ },
61
+ "temporal_patch_size": 2,
62
+ "video_processor_type": "Qwen3VLVideoProcessor"
63
+ }
64
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f90e2f0e64db25ba806fd859afbadaa10c6e796b5b2e9996a7d8cea467ebe92
3
+ size 11422918
tokenizer_config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "is_local": true,
9
+ "local_files_only": false,
10
+ "max_length": 2048,
11
+ "model_max_length": 262144,
12
+ "pad_to_multiple_of": null,
13
+ "pad_token": "<|vision_pad|>",
14
+ "pad_token_type_id": 0,
15
+ "padding_side": "right",
16
+ "processor_class": "Qwen3VLProcessor",
17
+ "split_special_tokens": false,
18
+ "stride": 0,
19
+ "tokenizer_class": "Qwen2Tokenizer",
20
+ "truncation_side": "right",
21
+ "truncation_strategy": "longest_first",
22
+ "unk_token": null
23
+ }