anonamename commited on
Commit
a625ab1
·
verified ·
1 Parent(s): d359357

Upload turing-motors/Heron-NVILA-Lite-33B

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. README.md +150 -0
  3. __init__.py +0 -0
  4. auto_processor.py +330 -0
  5. base_projector.py +228 -0
  6. builder.py +245 -0
  7. config.json +318 -0
  8. configuration_vila.py +93 -0
  9. constants.py +43 -0
  10. conversation.py +191 -0
  11. distributed.py +73 -0
  12. evaluation.jsonl +1 -0
  13. llm/added_tokens.json +29 -0
  14. llm/config.json +30 -0
  15. llm/generation_config.json +14 -0
  16. llm/merges.txt +0 -0
  17. llm/model-00001-of-00014.safetensors +3 -0
  18. llm/model-00002-of-00014.safetensors +3 -0
  19. llm/model-00003-of-00014.safetensors +3 -0
  20. llm/model-00004-of-00014.safetensors +3 -0
  21. llm/model-00005-of-00014.safetensors +3 -0
  22. llm/model-00006-of-00014.safetensors +3 -0
  23. llm/model-00007-of-00014.safetensors +3 -0
  24. llm/model-00008-of-00014.safetensors +3 -0
  25. llm/model-00009-of-00014.safetensors +3 -0
  26. llm/model-00010-of-00014.safetensors +3 -0
  27. llm/model-00011-of-00014.safetensors +3 -0
  28. llm/model-00012-of-00014.safetensors +3 -0
  29. llm/model-00013-of-00014.safetensors +3 -0
  30. llm/model-00014-of-00014.safetensors +3 -0
  31. llm/model.safetensors.index.json +778 -0
  32. llm/special_tokens_map.json +41 -0
  33. llm/tokenizer.json +3 -0
  34. llm/tokenizer_config.json +252 -0
  35. llm/vocab.json +0 -0
  36. loss.py +48 -0
  37. main.py +0 -0
  38. media.py +129 -0
  39. media_encoder.py +101 -0
  40. mm_projector/config.json +10 -0
  41. mm_projector/model.safetensors +3 -0
  42. mm_utils.py +572 -0
  43. model_utils_packing.py +35 -0
  44. modeling_vila.py +1228 -0
  45. prediction.jsonl +103 -0
  46. qwen2_jp.jinja +11 -0
  47. siglip_encoder.py +288 -0
  48. tokenizer_utils.py +182 -0
  49. trainer_state.json +3983 -0
  50. utils.py +212 -0
.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
+ llm/tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-32B-Instruct/blob/main/LICENSE
4
+ language:
5
+ - ja
6
+ - en
7
+ tags:
8
+ - vila
9
+ - nvila
10
+ - conversational
11
+ - multimodal
12
+ base_model:
13
+ - Qwen/Qwen2.5-32B-Instruct
14
+ - google/siglip2-so400m-patch16-512
15
+ ---
16
+ # Heron-NVILA-Lite-33B
17
+
18
+ Heron-NVILA-Lite-33B is a vision language model trained for Japanese, based on the [NVILA](https://arxiv.org/abs/2412.04468)-Lite architecture.
19
+
20
+ ## Model Overview
21
+
22
+ * **Developer**: [Turing Inc.](https://www.turing-motors.com/)
23
+ * **Vision Encoder**: [siglip2-so400m-patch16-512](https://huggingface.co/google/siglip2-so400m-patch16-512)
24
+ * **Projector**: mlp_downsample_2x2_fix
25
+ * **LLM**: [Qwen2.5-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct)
26
+ * **Supported Languages**: Japanese, English
27
+
28
+ ## Setup
29
+
30
+ ```bash
31
+ # I have confirmed that 4.46.0 and 4.49.0 also work. Other versions of Transformer may also work, but I have not tested them.
32
+ pip install transformers==4.45.0 accelerate opencv-python torchvision einops pillow
33
+ pip install git+https://github.com/bfshi/scaling_on_scales.git
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from transformers import AutoConfig, AutoModel
40
+
41
+ model_path = "turing-motors/Heron-NVILA-Lite-33B"
42
+
43
+ # you can use config
44
+ config = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
45
+ model = AutoModel.from_config(config, trust_remote_code=True, device_map="auto")
46
+
47
+ # or directly from_pretrained
48
+ model = AutoModel.from_pretrained(model_path, trust_remote_code=True, device_map="auto")
49
+
50
+ # show chat_template
51
+ print(model.tokenizer.chat_template)
52
+
53
+ # examples generate with raw text
54
+ response = model.generate_content(["こんにちは"])
55
+ print(response)
56
+ print("---" * 40)
57
+
58
+ # examples generate with text + image
59
+ from PIL import Image
60
+ import requests
61
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
62
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
63
+ response = model.generate_content([image, "画像を説明してください。"])
64
+ print(response)
65
+ print("---" * 40)
66
+
67
+ # examples generate using generation_config
68
+ from PIL import Image
69
+ import requests
70
+ from transformers import GenerationConfig
71
+ generation_config = {
72
+ "max_new_tokens": 512,
73
+ "temperature": 0.5,
74
+ "do_sample": True,
75
+ }
76
+ generation_config = GenerationConfig(**generation_config)
77
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
78
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
79
+ response = model.generate_content(
80
+ [image, "画像を説明してください。"],
81
+ generation_config=generation_config
82
+ )
83
+ print(response)
84
+ print("---" * 40)
85
+
86
+ # examples generate with text + image + text + image + text
87
+ from PIL import Image
88
+ import requests
89
+ url_list = [
90
+ "https://images.unsplash.com/photo-1694831404826-3400c48c188d?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
91
+ "https://images.unsplash.com/photo-1693240876439-473af88b4ed7?q=80&w=1974&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
92
+ ]
93
+ images = [
94
+ Image.open(requests.get(url, stream=True).raw).convert("RGB") for url in url_list
95
+ ]
96
+ response = model.generate_content([
97
+ images[0],
98
+ "これは日本の画像です",
99
+ images[1],
100
+ "これはオーストリアの画像です",
101
+ "各画像の違いを説明して"])
102
+ print(response)
103
+ print("---" * 40)
104
+ ```
105
+
106
+ ## Training Summary
107
+
108
+ | Stage | Training | Data Sources | Samples |
109
+ |--------|-------------------------------|-------------------------------|-------------|
110
+ | Stage1 | Projector | [Japanese image text pairs](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-japanese-image-text-pairs), [LLaVA-Pretrain](https://huggingface.co/datasets/liuhaotian/LLaVA-Pretrain) | 1.1M |
111
+ | Stage2 | Projector, LLM | Filtered [MOMIJI](https://huggingface.co/datasets/turing-motors/MOMIJI) (CC-MAIN-2024-42) | 3M |
112
+ | | | [Japanese image text pairs (subset)](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-japanese-image-text-pairs), [Japanese interleaved data (subset)](https://gitlab.llm-jp.nii.ac.jp/datasets/llm-jp-japanese-interleaved-data), [mmc4-core (subset)](https://github.com/allenai/mmc4), [coyo-700m (subset)](https://huggingface.co/datasets/kakaobrain/coyo-700m), [wikipedia_ja](https://huggingface.co/datasets/turing-motors/Wikipedia-Vision-JA), [llava_pretrain_ja](https://huggingface.co/datasets/turing-motors/LLaVA-Pretrain-JA), [stair_captions](http://captions.stair.center/) | 20M |
113
+ | Stage3 | Vision Encoder, Projector, LLM | [llava-instruct-v1_5-en-subset-358k](https://huggingface.co/datasets/llm-jp/llava-instruct-v1_5-en-subset-358k), [llava-instruct-ja](https://huggingface.co/datasets/llm-jp/llava-instruct-ja), [japanese-photos-conv](https://huggingface.co/datasets/llm-jp/japanese-photos-conversation), [ja-vg-vqa](https://huggingface.co/datasets/llm-jp/ja-vg-vqa-conversation), [synthdog-ja (subset)](https://huggingface.co/datasets/naver-clova-ix/synthdog-ja), [ai2d](https://huggingface.co/datasets/lmms-lab/ai2d), [synthdog-en](https://huggingface.co/datasets/naver-clova-ix/synthdog-en), [sherlock](https://github.com/allenai/sherlock) | 1.1M |
114
+
115
+ ## Evaluation
116
+
117
+ I used [llm-jp-eval-mm](https://github.com/llm-jp/llm-jp-eval-mm) for this evaluation. Scores for models other than Heron-NVILA-Lite and Sarashina2-Vision-14B were taken from [llm-jp-eval-mm leaderboard](https://llm-jp.github.io/llm-jp-eval-mm/) as of March 2025 and the [Asagi website](https://uehara-mech.github.io/asagi-vlm?v=1). Heron-NVILA-Lite and Sarashina2-Vision-14B were evaluated using llm-as-a-judge with "gpt-4o-2024-05-13". Sarashina2-Vision-14B was evaluated on the [official blog](https://www.sbintuitions.co.jp/blog/entry/2025/03/17/111703) using "gpt-4o-2024-08-06"; please note that due to differing evaluation conditions, the results for Sarashina2-Vision-14B should be treated as reference only.
118
+
119
+ | Model | LLM Size | Heron-Bench overall LLM (%) | JA-VLM-Bench-In-the-Wild LLM (/5.0) | JA-VG-VQA-500 LLM (/5.0) |
120
+ |--------------------------------|----------|------------------------------|-------------------------------------|--------------------------|
121
+ | **[Heron-NVILA-Lite-1B](https://huggingface.co/turing-motors/Heron-NVILA-Lite-1B)** | 0.5B | 45.9 | 2.92 | 3.16 |
122
+ | **[Heron-NVILA-Lite-2B](https://huggingface.co/turing-motors/Heron-NVILA-Lite-2B)** | 1.5B | 52.8 | 3.52 | 3.50 |
123
+ | **[Heron-NVILA-Lite-15B](https://huggingface.co/turing-motors/Heron-NVILA-Lite-15B)** | 14B | 59.6 | 4.2 | 3.82 |
124
+ | **Heron-NVILA-Lite-33B** | 32B | 61.1 | 4.0 | 3.85 |
125
+ | [LLaVA-CALM2-SigLIP](https://huggingface.co/cyberagent/llava-calm2-siglip) | 7B | 43.3 | 3.15 | 3.21 |
126
+ | [Llama-3-EvoVLM-JP-v2](https://huggingface.co/SakanaAI/Llama-3-EvoVLM-JP-v2) | 8B | 39.3 | 2.92 | 2.96 |
127
+ | [VILA-jp](https://huggingface.co/llm-jp/llm-jp-3-vila-14b) | 13B | 57.2 | 3.69 | 3.62 |
128
+ | [Asagi-14B](https://huggingface.co/MIL-UT/Asagi-14B) | 13B | 55.8 | 3.44 | 3.84 |
129
+ | [Sarashina2-Vision-14B](https://huggingface.co/sbintuitions/sarashina2-vision-14b) | 13B | 50.9 | 4.1 | 3.43 |
130
+ | [Qwen2-VL 7B Instruct](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct) | 7B | 55.5 | 3.61 | 3.6 |
131
+ | GPT-4o | - | 87.6 | 3.85 | 3.58 |
132
+
133
+
134
+ ## Risks and Limitations
135
+
136
+ This model is experimental and has not been thoroughly calibrated for ethical compliance or legal standards. Caution is advised for sensitive applications.
137
+
138
+ ## License
139
+
140
+ - Model weights are licensed under [Apache License 2.0](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct/blob/main/LICENSE).
141
+ - Users must comply with [OpenAI terms of use](https://openai.com/policies/terms-of-use) due to the inclusion of GPT-4-generated synthetic data.
142
+
143
+ ## Acknowledgements
144
+
145
+ This model is based on results obtained from a project, JPNP20017, subsidized by the New Energy and Industrial Technology Development Organization (NEDO).
146
+
147
+ I would like to acknowledge the use of the following open-source repositories:
148
+
149
+ - [VILA](https://github.com/NVlabs/VILA)
150
+ - [llm-jp-eval-mm](https://github.com/llm-jp/llm-jp-eval-mm)
__init__.py ADDED
File without changes
auto_processor.py ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import os
3
+ import os.path as osp
4
+ import warnings
5
+ from collections import defaultdict
6
+ from typing import List, Union
7
+
8
+ import torch
9
+ from transformers import AutoConfig, AutoImageProcessor, AutoModel, AutoProcessor, AutoTokenizer
10
+ from transformers.feature_extraction_utils import BatchFeature
11
+ from transformers.image_utils import ImageInput, VideoInput
12
+ from transformers.processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
13
+ from transformers.tokenization_utils_base import PreTokenizedInput, TextInput
14
+ from transformers.utils import logging
15
+
16
+ from .constants import DEFAULT_IMAGE_TOKEN, MEDIA_TOKENS
17
+ from .media import Image, Video, extract_media
18
+ from .mm_utils import process_image, process_images
19
+ from .tokenizer_utils import tokenize_conversation
20
+
21
+ def fetch_image_url_or_fpath(url_or_fpath):
22
+ if url_or_fpath.startswith("http") or url_or_fpath.startswith("https"):
23
+ import tempfile
24
+ import requests
25
+
26
+ # Download the image to a temporary file
27
+ temp_dir = tempfile.mkdtemp()
28
+ temp_file = os.path.join(temp_dir, os.path.basename(url_or_fpath))
29
+
30
+ response = requests.get(url_or_fpath, stream=True)
31
+ response.raise_for_status()
32
+
33
+ with open(temp_file, "wb") as f:
34
+ for chunk in response.iter_content(chunk_size=8192):
35
+ f.write(chunk)
36
+
37
+ return temp_file
38
+ elif url_or_fpath.startswith("file://"):
39
+ fpath = url_or_fpath.replace("file://", "")
40
+ assert osp.exists(fpath), f"File {fpath} does not exist"
41
+ return fpath
42
+ elif osp.exists(url_or_fpath):
43
+ assert osp.isfile(url_or_fpath), f"File {url_or_fpath} is not a file"
44
+ return url_or_fpath
45
+ else:
46
+ raise ValueError(f"Unsupported image path: {url_or_fpath}")
47
+
48
+
49
+ def __pad_fn(input_ids_list, padding_value=0, target_len=None, padding_side="left"):
50
+ # tensor shape is (batch_size, seq_len)
51
+ max_len = max([ids.shape[1] for ids in input_ids_list])
52
+ if target_len is not None:
53
+ assert target_len >= max_len, "target_len must be greater than or equal to max_len"
54
+ max_len = target_len
55
+
56
+ new_input_ids_list = []
57
+ for i, input_ids in enumerate(input_ids_list):
58
+ pad_tensor = torch.ones_like(input_ids) * padding_value
59
+ curr_len = input_ids.shape[1]
60
+ pad_tensor = pad_tensor[:, : max_len - curr_len]
61
+ if padding_side == "right":
62
+ input_ids = torch.cat((input_ids, pad_tensor), dim=1)
63
+ else:
64
+ input_ids = torch.cat((pad_tensor, input_ids), dim=1)
65
+ new_input_ids_list.append(input_ids)
66
+ return torch.cat(new_input_ids_list, dim=0)
67
+
68
+
69
+ class VILAProcessorKwargs(ProcessingKwargs, total=False):
70
+ _defaults = {
71
+ "text_kwargs": {
72
+ "padding": False,
73
+ },
74
+ }
75
+
76
+
77
+
78
+
79
+ class VILAProcessor(ProcessorMixin):
80
+ # attributes = ["image_processor", "tokenizer"]
81
+ attributes = []
82
+ # valid_kwargs = ["chat_template"]
83
+ valid_kwargs = []
84
+ # image_processor_class = "VILAImageProcessor"
85
+ # tokenizer_class = ("VILATokenizer", "VILATokenizerFast")
86
+
87
+ def __init__(self, image_processor=None, tokenizer=None, chat_template=None, config=None, **kwargs):
88
+ # self.image_token = "<|image_pad|>" if not hasattr(tokenizer, "image_token") else tokenizer.image_token
89
+ # self.video_token = "<|video_pad|>" if not hasattr(tokenizer, "video_token") else tokenizer.video_token
90
+ self.image_token = MEDIA_TOKENS["image"]
91
+ self.video_token = MEDIA_TOKENS["video"]
92
+ self.config = config
93
+ self.image_processor = image_processor
94
+ self.tokenizer = tokenizer
95
+
96
+ super().__init__(image_processor, tokenizer, chat_template=chat_template)
97
+
98
+ @classmethod
99
+ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
100
+ if os.path.isdir(pretrained_model_name_or_path):
101
+ pretrained_model_name_or_path = pretrained_model_name_or_path
102
+ else:
103
+ print(f"pretrained_model_name_or_path {pretrained_model_name_or_path} is not a directory, downloading")
104
+ from huggingface_hub import snapshot_download
105
+
106
+ pretrained_model_name_or_path = snapshot_download(pretrained_model_name_or_path)
107
+
108
+ image_processor = AutoImageProcessor.from_pretrained(
109
+ osp.join(pretrained_model_name_or_path, "vision_tower"), trust_remote_code=True
110
+ )
111
+ tokenizer = AutoTokenizer.from_pretrained(
112
+ osp.join(pretrained_model_name_or_path, "llm"), trust_remote_code=True
113
+ )
114
+ config = AutoConfig.from_pretrained(pretrained_model_name_or_path, trust_remote_code=True)
115
+ return cls(image_processor=image_processor, tokenizer=tokenizer, config=config)
116
+
117
+ def __repr__(self):
118
+ return (
119
+ f"VILAProcessor(image_processor={self.image_processor}, tokenizer={self.tokenizer}, config={self.config})"
120
+ )
121
+
122
+ def __call__(
123
+ self,
124
+ conversation,
125
+ images: ImageInput = None,
126
+ text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None,
127
+ videos: VideoInput = None,
128
+ **kwargs: Unpack[VILAProcessorKwargs],
129
+ ) -> BatchFeature:
130
+ if images is not None:
131
+ warnings.warn("images is not supported in __call__")
132
+
133
+ input_ids = []
134
+ media = defaultdict(list)
135
+ media_config = defaultdict(dict)
136
+ for conv in conversation:
137
+ feat = self.__single_call__(conv, images, text, videos, **kwargs)
138
+ input_ids.append(feat.input_ids)
139
+ for name in feat.media:
140
+ media[name] += feat.media[name]
141
+ for name in feat.media_config:
142
+ media_config[name].update(feat.media_config[name])
143
+
144
+ return BatchFeature(
145
+ data={
146
+ # "input_ids": torch.nn.utils.rnn.pad_sequence(input_ids, batch_first=True, padding_value=self.pad_token_id),
147
+ "input_ids": __pad_fn(
148
+ input_ids,
149
+ padding_value=self.tokenizer.pad_token_id,
150
+ padding_side="left",
151
+ ),
152
+ "media": media,
153
+ "media_config": media_config,
154
+ }
155
+ )
156
+
157
+ def __single_call__(
158
+ self,
159
+ conversation,
160
+ images: ImageInput = None,
161
+ text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None,
162
+ videos: VideoInput = None,
163
+ **kwargs: Unpack[VILAProcessorKwargs],
164
+ ) -> BatchFeature:
165
+ # TODO: should be merged with llava_arch.py/generate_content()
166
+ # TODO (extract and preprocess should be done together, as the preprocess of image and video can be different, i.e. when dynamic res is used)
167
+ conversation = copy.deepcopy(conversation)
168
+ media = extract_media(conversation, self.config)
169
+ # Process media
170
+ media_config = defaultdict(dict)
171
+ for name in media:
172
+ if name == "image":
173
+ if len(media["image"]) == 1 and self.config.image_aspect_ratio in ["dynamic", "dynamic_s2"]:
174
+ self.config.image_processor = self.image_processor
175
+ if self.config.image_aspect_ratio == "dynamic":
176
+ images = process_image(media["image"][0], self.config, None, enable_dynamic_res=True).half()
177
+ conversation[0]["value"] = conversation[0]["value"].replace(
178
+ DEFAULT_IMAGE_TOKEN, f"{DEFAULT_IMAGE_TOKEN}\n" * images.shape[0]
179
+ )
180
+ else:
181
+ if type(self.config.s2_scales) is str:
182
+ self.config.s2_scales = list(map(int, self.config.s2_scales.split(",")))
183
+ images, block_sizes = process_image(
184
+ media["image"][0], self.config, None, enable_dynamic_s2=True
185
+ )
186
+ images = images.half()
187
+ media_config[name]["block_sizes"] = [block_sizes]
188
+ else:
189
+ images = process_images(media["image"], self.vision_tower.image_processor, self.config).half()
190
+ media[name] = [image for image in images]
191
+ elif name == "video":
192
+ media[name] = [
193
+ process_images(images, self.vision_tower.image_processor, self.config).half()
194
+ for images in media[name]
195
+ ]
196
+ else:
197
+ raise ValueError(f"Unsupported media type: {name}")
198
+ input_ids = tokenize_conversation(conversation, self.tokenizer, add_generation_prompt=True).cuda().unsqueeze(0)
199
+ # Set up the generation config
200
+ return BatchFeature(data={"input_ids": input_ids, "media": media, "media_config": media_config})
201
+
202
+ def batch_decode(self, *args, **kwargs):
203
+ """
204
+ This method forwards all its arguments to Qwen2TokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
205
+ refer to the docstring of this method for more information.
206
+ """
207
+ return self.tokenizer.batch_decode(*args, **kwargs)
208
+
209
+ def decode(self, *args, **kwargs):
210
+ """
211
+ This method forwards all its arguments to Qwen2TokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
212
+ the docstring of this method for more information.
213
+ """
214
+ return self.tokenizer.decode(*args, **kwargs)
215
+
216
+ def post_process_image_text_to_text(self, generated_outputs):
217
+ """
218
+ Post-process the output of the model to decode the text.
219
+
220
+ Args:
221
+ generated_outputs (`torch.Tensor` or `np.ndarray`):
222
+ The output of the model `generate` function. The output is expected to be a tensor of shape `(batch_size, sequence_length)`
223
+ or `(sequence_length,)`.
224
+
225
+ Returns:
226
+ `List[str]`: The decoded text.
227
+ """
228
+ return self.tokenizer.batch_decode(
229
+ generated_outputs, skip_special_tokens=True, clean_up_tokenization_spaces=False
230
+ )
231
+
232
+ @property
233
+ def model_input_names(self):
234
+ tokenizer_input_names = self.tokenizer.model_input_names
235
+ image_processor_input_names = self.image_processor.model_input_names
236
+ return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))
237
+
238
+ # inputs = processor(conversation=llavaconv, padding=True, return_tensors="pt")
239
+ def apply_chat_template(self, conversation, add_generation_prompt=True, **kwargs):
240
+ vila_conv = []
241
+ for chat in conversation:
242
+ vila_chat = {"from": "", "value": []}
243
+ if chat["role"] == "user":
244
+ # user allows to input image and text
245
+ vila_chat["from"] = "human"
246
+ for content in chat["content"]:
247
+ if content["type"] == "image":
248
+ if "path" in content:
249
+ # VILA style
250
+ vila_chat["value"].append(Image(fetch_image_url_or_fpath(content["path"])))
251
+ elif "image" in content:
252
+ # Qwen style
253
+ vila_chat["value"].append(Image(fetch_image_url_or_fpath(content["image"])))
254
+ else:
255
+ raise ValueError(f"Unsupported content type `image`: {content}, `image` and `path` are required")
256
+ elif content["type"] == "text":
257
+ vila_chat["value"].append(content["text"])
258
+ # NOTE(ligeng): video supports are needed here
259
+ else:
260
+ raise ValueError(f"Unsupported content type: {content['type']}")
261
+ elif chat["role"] == "assistant":
262
+ vila_chat["from"] = "gpt"
263
+ for content in chat["content"]:
264
+ assert content["type"] == "text", f"Unsupported content type: {content['type']}"
265
+ vila_chat["value"].append(content["text"])
266
+ vila_conv.append(vila_chat)
267
+
268
+ return vila_conv
269
+
270
+
271
+ if __name__ == "__main__":
272
+ # gpt style: user, assistant
273
+ # vila style: human, gpt
274
+ gpt_conv = [
275
+ {
276
+ "role": "user",
277
+ "content": [
278
+ {"type": "image", "path": "demo_images/demo_img_1.png"},
279
+ {"type": "text", "text": "Describe this image."},
280
+ ],
281
+ }
282
+ ]
283
+
284
+ llavaconv = [
285
+ {
286
+ "from": "human",
287
+ "value": [
288
+ PIL.Image.open("demo_images/demo_img_1.png"),
289
+ "Describe this image.",
290
+ ],
291
+ }
292
+ ]
293
+
294
+ processor = AutoProcessor.from_pretrained(output_dir, trust_remote_code=True)
295
+ inputs = processor.apply_chat_template(conversation=gpt_conv, padding=True, return_tensors="pt")
296
+ # model = llava.load("Efficient-Large-Model/qwen25_2B_3x3-sft").cuda()
297
+ # print(model)
298
+ model_path = "NVILA-Lite-2B-hf-preview"
299
+ model = AutoModel.from_pretrained(model_path, trust_remote_code=True, device_map="auto")
300
+ # res = model.generate_content(["how are you today?"])
301
+ # print(model.config)
302
+ # print(model.tokenizer)
303
+ # print(res)
304
+ # exit(0)
305
+
306
+ processor = VILAProcessor(
307
+ config=model.config,
308
+ image_processor=model.vision_tower.image_processor,
309
+ tokenizer=model.tokenizer,
310
+ )
311
+
312
+ # TODO: add padding, return_tensors,
313
+ inputs = processor(conversation=llavaconv, padding=True, return_tensors="pt")
314
+ print(inputs.keys(), inputs.input_ids.shape, [_.shape for _ in inputs.image])
315
+ print("vila conv pass")
316
+
317
+ inputs = processor.apply_chat_template(conversation=gpt_conv, padding=True, return_tensors="pt")
318
+ print(inputs.keys(), inputs.input_ids.shape, [_.shape for _ in inputs.image])
319
+ print("gpt conv pass")
320
+
321
+ output_ids = model.generate(
322
+ input_ids=inputs.input_ids,
323
+ media={
324
+ "image": inputs.image,
325
+ },
326
+ media_config={"image": {}},
327
+ generation_config=model.generation_config,
328
+ max_new_tokens=100,
329
+ )
330
+ print(output_ids)
base_projector.py ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ import re
18
+
19
+ import torch
20
+ import torch.nn as nn
21
+ from transformers import AutoConfig, AutoModel, PretrainedConfig, PreTrainedModel
22
+
23
+
24
+ class IdentityMap(nn.Module):
25
+ def __init__(self):
26
+ super().__init__()
27
+
28
+ def forward(self, x, *args, **kwargs):
29
+ return x
30
+
31
+ @property
32
+ def config(self):
33
+ return {"mm_projector_type": "identity"}
34
+
35
+
36
+ class SimpleResBlock(nn.Module):
37
+ def __init__(self, channels):
38
+ super().__init__()
39
+ self.pre_norm = nn.LayerNorm(channels)
40
+
41
+ self.proj = nn.Sequential(nn.Linear(channels, channels), nn.GELU(), nn.Linear(channels, channels))
42
+
43
+ def forward(self, x):
44
+ x = self.pre_norm(x)
45
+ return x + self.proj(x)
46
+
47
+
48
+ class DownSampleBlock(nn.Module):
49
+ def forward(self, x):
50
+ vit_embeds = x
51
+ h = w = int(vit_embeds.shape[1] ** 0.5)
52
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], h, w, -1)
53
+ vit_embeds = self.flat_square(vit_embeds)
54
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], -1, vit_embeds.shape[-1])
55
+ return vit_embeds
56
+
57
+ def flat_square(self, x):
58
+ n, w, h, c = x.size()
59
+ if w % 2 == 1:
60
+ x = torch.concat([x, torch.zeros((n, 1, h, c), dtype=x.dtype).to(x.device)], dim=1).contiguous()
61
+ n, w, h, c = x.size()
62
+ if h % 2 == 1:
63
+ x = torch.concat([x, torch.zeros((n, w, 1, c), dtype=x.dtype).to(x.device)], dim=2).contiguous()
64
+ n, w, h, c = x.size()
65
+ x = x.contiguous()
66
+ x = x.view(n, w, int(h / 2), int(c * 2))
67
+ x = x.permute(0, 2, 1, 3).contiguous()
68
+ x = x.view(n, int(h / 2), int(w / 2), int(c * 4))
69
+ x = x.permute(0, 2, 1, 3).contiguous()
70
+ return x
71
+
72
+
73
+ class DownSample2x2BlockFix(nn.Module):
74
+ def forward(self, x):
75
+ vit_embeds = x
76
+ h = w = int(vit_embeds.shape[1] ** 0.5)
77
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], h, w, -1)
78
+ vit_embeds = flat_square_2x2(vit_embeds)
79
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], -1, vit_embeds.shape[-1])
80
+ return vit_embeds
81
+
82
+
83
+ def flat_square_2x2(x):
84
+ n, w, h, c = x.size()
85
+ if w % 2 == 1:
86
+ x = torch.concat([x, torch.zeros((n, 1, h, c), dtype=x.dtype).to(x.device)], dim=1).contiguous()
87
+ n, w, h, c = x.size()
88
+ x = x.contiguous()
89
+ if h % 2 == 1:
90
+ x = torch.concat([x, torch.zeros((n, w, 1, c), dtype=x.dtype).to(x.device)], dim=2).contiguous()
91
+ n, w, h, c = x.size()
92
+ x = x.view(n, w, int(h / 2), int(c * 2))
93
+ x = x.permute(0, 2, 1, 3).contiguous()
94
+ x = x.view(n, int(h / 2), int(w / 2), int(c * 4))
95
+ x = x.permute(0, 2, 1, 3).contiguous()
96
+ return x
97
+
98
+
99
+ class DownSample3x3BlockFix(nn.Module):
100
+ def forward(self, x):
101
+ vit_embeds = x
102
+ h = w = int(vit_embeds.shape[1] ** 0.5)
103
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], h, w, -1)
104
+ vit_embeds = flat_square_3x3(vit_embeds)
105
+ vit_embeds = vit_embeds.reshape(vit_embeds.shape[0], -1, vit_embeds.shape[-1])
106
+ return vit_embeds
107
+
108
+
109
+ def flat_square_3x3(x):
110
+ n, w, h, c = x.size()
111
+ if w % 3 != 0:
112
+ x = torch.concat([x, torch.zeros((n, 3 - (w % 3), h, c), dtype=x.dtype).to(x.device)], dim=1).contiguous()
113
+ n, w, h, c = x.size()
114
+ x = x.contiguous()
115
+ if h % 3 != 0:
116
+ x = torch.concat([x, torch.zeros((n, w, 3 - (h % 3), c), dtype=x.dtype).to(x.device)], dim=2).contiguous()
117
+ n, w, h, c = x.size()
118
+ x = x.view(n, w, int(h / 3), int(c * 3))
119
+ x = x.permute(0, 2, 1, 3).contiguous()
120
+ x = x.view(n, int(h / 3), int(w / 3), int(c * 9))
121
+ x = x.permute(0, 2, 1, 3).contiguous()
122
+ return x
123
+
124
+
125
+ class MultimodalProjectorConfig(PretrainedConfig):
126
+ model_type = "v2l_projector"
127
+
128
+ def __init__(self, mm_projector_type: str = None, **kwargs):
129
+ super().__init__()
130
+ self.mm_projector_type = mm_projector_type
131
+
132
+
133
+ class MultimodalProjector(PreTrainedModel):
134
+ config_class = MultimodalProjectorConfig
135
+
136
+ def __init__(self, mm_projector_cfg: MultimodalProjectorConfig, config: PretrainedConfig):
137
+ super().__init__(mm_projector_cfg)
138
+ mm_projector_type = mm_projector_cfg.mm_projector_type
139
+ self.downsample_rate = 1
140
+ if mm_projector_type == "identity":
141
+ self.layers = IdentityMap()
142
+ elif mm_projector_type == "linear":
143
+ self.layers = nn.Linear(config.mm_hidden_size, config.hidden_size)
144
+ elif mm_projector_type == "mlp_downsample":
145
+ self.layers = nn.Sequential(
146
+ DownSampleBlock(),
147
+ nn.LayerNorm(config.mm_hidden_size * 4),
148
+ nn.Linear(config.mm_hidden_size * 4, config.hidden_size),
149
+ nn.GELU(),
150
+ nn.Linear(config.hidden_size, config.hidden_size),
151
+ )
152
+ self.downsample_rate = 2
153
+ elif mm_projector_type == "mlp_downsample_2x2_fix":
154
+ self.layers = nn.Sequential(
155
+ DownSample2x2BlockFix(),
156
+ nn.LayerNorm(config.mm_hidden_size * 4),
157
+ nn.Linear(config.mm_hidden_size * 4, config.hidden_size),
158
+ nn.GELU(),
159
+ nn.Linear(config.hidden_size, config.hidden_size),
160
+ )
161
+ self.downsample_rate = 2
162
+ elif mm_projector_type == "mlp_downsample_3x3_fix":
163
+ self.layers = nn.Sequential(
164
+ DownSample3x3BlockFix(),
165
+ nn.LayerNorm(config.mm_hidden_size * 9),
166
+ nn.Linear(config.mm_hidden_size * 9, config.mm_hidden_size * 3),
167
+ nn.GELU(),
168
+ nn.LayerNorm(config.mm_hidden_size * 3),
169
+ nn.Linear(config.mm_hidden_size * 3, config.hidden_size),
170
+ nn.GELU(),
171
+ nn.Linear(config.hidden_size, config.hidden_size),
172
+ )
173
+ self.downsample_rate = 3
174
+ elif mm_projector_type == "mlp_downsample_3x3_s2":
175
+ self.layers = nn.Sequential(
176
+ DownSample3x3BlockFix(),
177
+ nn.LayerNorm(config.mm_hidden_size * 9),
178
+ nn.Linear(config.mm_hidden_size * 9, config.mm_hidden_size * 3),
179
+ nn.GELU(),
180
+ nn.LayerNorm(config.mm_hidden_size * 3),
181
+ nn.Linear(config.mm_hidden_size * 3, config.mm_hidden_size),
182
+ nn.GELU(),
183
+ nn.LayerNorm(config.mm_hidden_size),
184
+ nn.Linear(config.mm_hidden_size, config.mm_hidden_size // 3),
185
+ nn.GELU(),
186
+ nn.LayerNorm(config.mm_hidden_size // 3),
187
+ nn.Linear(config.mm_hidden_size // 3, config.hidden_size),
188
+ nn.GELU(),
189
+ nn.Linear(config.hidden_size, config.hidden_size),
190
+ )
191
+ elif mm_projector_type == "mlp_downsample_3x3_s2_new":
192
+ self.layers = nn.Sequential(
193
+ DownSample3x3BlockFix(),
194
+ nn.LayerNorm(config.mm_hidden_size * 9),
195
+ nn.Linear(config.mm_hidden_size * 9, config.mm_hidden_size * 4),
196
+ nn.GELU(),
197
+ nn.LayerNorm(config.mm_hidden_size * 4),
198
+ nn.Linear(config.mm_hidden_size * 4, config.mm_hidden_size * 2),
199
+ nn.GELU(),
200
+ nn.LayerNorm(config.mm_hidden_size * 2),
201
+ nn.Linear(config.mm_hidden_size * 2, config.mm_hidden_size),
202
+ nn.GELU(),
203
+ nn.LayerNorm(config.mm_hidden_size),
204
+ nn.Linear(config.mm_hidden_size, config.mm_hidden_size // 3),
205
+ nn.GELU(),
206
+ nn.LayerNorm(config.mm_hidden_size // 3),
207
+ nn.Linear(config.mm_hidden_size // 3, config.hidden_size),
208
+ nn.GELU(),
209
+ nn.Linear(config.hidden_size, config.hidden_size),
210
+ )
211
+ else:
212
+ mlp_gelu_match = re.match(r"^mlp(\d+)x_gelu$", mm_projector_type)
213
+ if mlp_gelu_match:
214
+ mlp_depth = int(mlp_gelu_match.group(1))
215
+ modules = [nn.Linear(config.mm_hidden_size, config.hidden_size)]
216
+ for _ in range(1, mlp_depth):
217
+ modules.append(nn.GELU())
218
+ modules.append(nn.Linear(config.hidden_size, config.hidden_size))
219
+ self.layers = nn.Sequential(*modules)
220
+ else:
221
+ raise ValueError(f"Unknown projector type: {mm_projector_type}")
222
+
223
+ def forward(self, x, *args, **kwargs):
224
+ return self.layers(x)
225
+
226
+
227
+ # AutoConfig.register("v2l_projector", MultimodalProjectorConfig)
228
+ # AutoModel.register(MultimodalProjectorConfig, MultimodalProjector)
builder.py ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ import math
18
+ import os
19
+ import os.path as osp
20
+ import warnings
21
+ from dataclasses import asdict
22
+ from typing import Any, Dict, List, Optional, Sequence, Tuple
23
+
24
+ import torch
25
+ import transformers
26
+ from huggingface_hub import file_exists, repo_exists
27
+ from huggingface_hub.utils import HFValidationError
28
+ from transformers import (
29
+ AutoConfig,
30
+ AutoModelForCausalLM,
31
+ AutoTokenizer,
32
+ PretrainedConfig,
33
+ PreTrainedModel,
34
+ PreTrainedTokenizer,
35
+ )
36
+
37
+ # from .conversation import *
38
+ from .conversation import SeparatorStyle, default_conversation
39
+
40
+ SENTINEL_TOKEN = "<vila/sentinel>"
41
+ MEDIA_TOKENS = {
42
+ "image": "<image>",
43
+ "video": "<vila/video>",
44
+ }
45
+
46
+ # from llava.model.utils import packing
47
+ # from llava.utils.logging import logger
48
+ # from llava.utils.tokenizer import infer_stop_tokens
49
+
50
+ DUMMY_CONVERSATION = [
51
+ {"from": "human", "value": "question"},
52
+ {"from": "gpt", "value": "answer"},
53
+ ] * 10
54
+
55
+
56
+ def tokenizer_image_token(prompt, tokenizer, return_tensors=None):
57
+ return tokenizer(prompt, return_tensors=return_tensors).input_ids[0]
58
+
59
+
60
+ def has_tokenizer(repo_id_or_path: str) -> bool:
61
+ # Check if the tokenizer is in a local directory
62
+ if osp.exists(osp.join(repo_id_or_path, "tokenizer_config.json")):
63
+ return True
64
+
65
+ # Check if the tokenizer is in a Hugging Face Hub repo
66
+ try:
67
+ return repo_exists(repo_id_or_path) and file_exists(repo_id_or_path, "tokenizer_config.json")
68
+ except HFValidationError:
69
+ return False
70
+
71
+
72
+ def _maybe_add_sentinel_token(tokenizer: transformers.PreTrainedTokenizer) -> None:
73
+ if not hasattr(tokenizer, "sentinel_token"):
74
+ tokenizer.add_tokens([SENTINEL_TOKEN], special_tokens=True)
75
+ tokenizer.sentinel_token = SENTINEL_TOKEN
76
+ tokenizer.sentinel_token_id = tokenizer.convert_tokens_to_ids(SENTINEL_TOKEN)
77
+
78
+
79
+ def tokenize_conversation_legacy(
80
+ messages: Sequence[Dict[str, str]],
81
+ tokenizer: transformers.PreTrainedTokenizer,
82
+ add_generation_prompt: bool = False,
83
+ overrides: Optional[Dict[str, str]] = None,
84
+ no_system_prompt: bool = False,
85
+ ) -> torch.Tensor:
86
+ conv = default_conversation.copy()
87
+ roles = {"human": conv.roles[0], "gpt": conv.roles[1]}
88
+
89
+ if no_system_prompt:
90
+ conv.system = ""
91
+
92
+ # Skip the first message if it is not from human
93
+ if messages[0]["from"] != "human":
94
+ messages = messages[1:]
95
+
96
+ # Add a generation prompt if needed
97
+ if add_generation_prompt:
98
+ messages.append({"from": "gpt", "value": None})
99
+
100
+ conv.messages = []
101
+ for turn, message in enumerate(messages):
102
+ role = roles[message["from"]]
103
+ assert role == conv.roles[turn % 2]
104
+ if overrides is not None and message["from"] in overrides:
105
+ conv.append_message(role, overrides[message["from"]])
106
+ else:
107
+ conv.append_message(role, message["value"])
108
+
109
+ return tokenizer_image_token(conv.get_prompt(), tokenizer, return_tensors="pt")
110
+
111
+
112
+ def tokenize_conversation(
113
+ messages: Sequence[Dict[str, str]],
114
+ tokenizer: transformers.PreTrainedTokenizer,
115
+ add_generation_prompt: bool = False,
116
+ overrides: Optional[Dict[str, str]] = None,
117
+ no_system_prompt: bool = False,
118
+ ) -> torch.Tensor:
119
+ # Normalize the conversation before tokenization
120
+ for message in messages:
121
+ message["value"] = message["value"].strip()
122
+
123
+ if default_conversation.sep_style != SeparatorStyle.AUTO:
124
+ return tokenize_conversation_legacy(
125
+ messages,
126
+ tokenizer,
127
+ add_generation_prompt=add_generation_prompt,
128
+ overrides=overrides,
129
+ no_system_prompt=no_system_prompt,
130
+ )
131
+
132
+ conversation = []
133
+ for m in messages:
134
+ message = {}
135
+ if m["from"] == "human":
136
+ message["role"] = "user"
137
+ elif m["from"] == "gpt":
138
+ message["role"] = "assistant"
139
+ else:
140
+ raise ValueError(f"Unexpected sender '{m['from']}' in conversation entry.")
141
+
142
+ message["content"] = m["value"]
143
+ if overrides is not None and m["from"] in overrides:
144
+ message["content"] = overrides[m["from"]]
145
+ conversation.append(message)
146
+
147
+ if no_system_prompt:
148
+ conversation = [{"role": "system", "content": ""}] + conversation
149
+
150
+ text = tokenizer.apply_chat_template(
151
+ conversation,
152
+ add_generation_prompt=add_generation_prompt,
153
+ tokenize=False,
154
+ )
155
+ return tokenizer_image_token(text, tokenizer, return_tensors="pt")
156
+
157
+
158
+ def infer_stop_tokens(tokenizer: transformers.PreTrainedTokenizer) -> List[str]:
159
+ _maybe_add_sentinel_token(tokenizer)
160
+ template = tokenize_conversation(DUMMY_CONVERSATION, tokenizer, overrides={"gpt": SENTINEL_TOKEN})
161
+
162
+ stop_tokens = {tokenizer.eos_token}
163
+ for k in range(template.size(0) - 1):
164
+ if template[k] == tokenizer.sentinel_token_id:
165
+ stop_token = tokenizer.decode(template[k + 1])
166
+ stop_tokens.add(stop_token)
167
+ return list(stop_tokens)
168
+
169
+
170
+ def context_length_extension(config):
171
+ orig_ctx_len = getattr(config, "max_position_embeddings", None)
172
+ model_max_length = getattr(config, "model_max_length", None)
173
+ if orig_ctx_len and model_max_length > orig_ctx_len:
174
+ print(f"Scaling RoPE from {orig_ctx_len} to {model_max_length}")
175
+ scaling_factor = float(math.ceil(model_max_length / orig_ctx_len))
176
+ config.rope_scaling = {"type": "linear", "factor": scaling_factor}
177
+ return config
178
+
179
+
180
+ def build_llm_and_tokenizer(
181
+ model_name_or_path: str,
182
+ config: PretrainedConfig,
183
+ attn_implementation=None,
184
+ model_max_length=None,
185
+ *args,
186
+ **kwargs,
187
+ ) -> Tuple[PreTrainedModel, PreTrainedTokenizer]:
188
+ # print(model_name_or_path)
189
+ llm_cfg = AutoConfig.from_pretrained(model_name_or_path)
190
+ llm_cfg._attn_implementation = attn_implementation
191
+ llm_cfg.model_max_length = model_max_length
192
+ if model_max_length is not None:
193
+ context_length_extension(llm_cfg)
194
+
195
+ # Quantization related
196
+ quantization_restore_from_checkpoint = False
197
+
198
+ if quantization_restore_from_checkpoint:
199
+ fp8_model_name_or_path = kwargs.pop("fp8_llm_cfg", None)
200
+
201
+ llm = AutoModelForCausalLM.from_pretrained(
202
+ fp8_model_name_or_path, config=llm_cfg, torch_dtype=eval(config.model_dtype), *args, **kwargs
203
+ )
204
+ else:
205
+ llm = AutoModelForCausalLM.from_pretrained(
206
+ model_name_or_path, config=llm_cfg, torch_dtype=eval(config.model_dtype), *args, **kwargs
207
+ )
208
+ # NOTE(ligeng): not sure whether it affects the training
209
+ # packing.patch(llm)
210
+
211
+ # Locate the tokenizer.
212
+ llm_path = model_name_or_path
213
+ if not has_tokenizer(llm_path):
214
+ llm_path = osp.join(llm_path, "llm")
215
+ if not has_tokenizer(llm_path):
216
+ raise ValueError(f"Cannot find tokenizer in {llm_path}.")
217
+
218
+ tokenizer = AutoTokenizer.from_pretrained(llm_path, padding_side="right", use_fast=True, legacy=False)
219
+ if model_max_length is not None:
220
+ tokenizer.model_max_length = model_max_length
221
+
222
+ # Load chat template if specified.
223
+ if getattr(config, "chat_template", None) is not None:
224
+ print(f"Using chat template: {config.chat_template}")
225
+ fpath = os.path.join(os.path.dirname(__file__), "chat_templates", f"{config.chat_template}.jinja")
226
+ if not os.path.exists(fpath):
227
+ fpath = os.path.join(os.path.dirname(model_name_or_path), f"{config.chat_template}.jinja")
228
+ with open(fpath) as fd:
229
+ chat_template = fd.read()
230
+ tokenizer.chat_template = chat_template.replace(" ", "").replace("\n", "")
231
+
232
+ # Set stop tokens for the tokenizer
233
+ tokenizer.stop_tokens = infer_stop_tokens(tokenizer)
234
+ tokenizer.stop_token_ids = tokenizer.convert_tokens_to_ids(tokenizer.stop_tokens)
235
+
236
+ # Add media tokens to the tokenizer
237
+ tokenizer.media_tokens = MEDIA_TOKENS
238
+ tokenizer.media_token_ids = {}
239
+ for name, token in MEDIA_TOKENS.items():
240
+ tokenizer.add_tokens([token], special_tokens=True)
241
+ tokenizer.media_token_ids[name] = tokenizer.convert_tokens_to_ids(token)
242
+
243
+ # TODO(ligeng): is this necessary for llava?
244
+ config.hidden_size = llm.config.hidden_size
245
+ return llm, tokenizer
config.json ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Ubit": 100,
3
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model",
4
+ "architectures": [
5
+ "VILAForCasualLM"
6
+ ],
7
+ "babit": "E5M2",
8
+ "bobit": "E5M2",
9
+ "bwbit": "E5M2",
10
+ "chat_template": null,
11
+ "col_blocksize": -1,
12
+ "col_blocksize_optimizer": 128,
13
+ "draw_distribution_backward": false,
14
+ "draw_distribution_forward": false,
15
+ "drop_path_rate": 0.0,
16
+ "dynamic_s2": false,
17
+ "epsilon": 1e-10,
18
+ "epsilon_optimizer": 1e-15,
19
+ "fabit": "E4M3",
20
+ "first_order_bit": null,
21
+ "first_order_quant_type": null,
22
+ "fobit": "E4M3",
23
+ "fps": 0.0,
24
+ "fwbit": "E4M3",
25
+ "group_size": -1,
26
+ "hidden_size": 5120,
27
+ "image_aspect_ratio": "dynamic",
28
+ "image_encoder": {
29
+ "_target_": "llava.model.encoders.BasicImageEncoder"
30
+ },
31
+ "interpolate_mode": "linear",
32
+ "llm_cfg": {
33
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model/llm",
34
+ "add_cross_attention": false,
35
+ "architectures": [
36
+ "Qwen2ForCausalLM"
37
+ ],
38
+ "attention_dropout": 0.0,
39
+ "bad_words_ids": null,
40
+ "begin_suppress_tokens": null,
41
+ "bos_token_id": 151643,
42
+ "chunk_size_feed_forward": 0,
43
+ "cross_attention_hidden_size": null,
44
+ "decoder_start_token_id": null,
45
+ "diversity_penalty": 0.0,
46
+ "do_sample": false,
47
+ "early_stopping": false,
48
+ "encoder_no_repeat_ngram_size": 0,
49
+ "eos_token_id": 151645,
50
+ "exponential_decay_length_penalty": null,
51
+ "finetuning_task": null,
52
+ "forced_bos_token_id": null,
53
+ "forced_eos_token_id": null,
54
+ "hidden_act": "silu",
55
+ "hidden_size": 5120,
56
+ "id2label": {
57
+ "0": "LABEL_0",
58
+ "1": "LABEL_1"
59
+ },
60
+ "initializer_range": 0.02,
61
+ "intermediate_size": 27648,
62
+ "is_decoder": false,
63
+ "is_encoder_decoder": false,
64
+ "label2id": {
65
+ "LABEL_0": 0,
66
+ "LABEL_1": 1
67
+ },
68
+ "length_penalty": 1.0,
69
+ "max_length": 20,
70
+ "max_position_embeddings": 32768,
71
+ "max_window_layers": 70,
72
+ "min_length": 0,
73
+ "model_max_length": 4096,
74
+ "model_type": "qwen2",
75
+ "no_repeat_ngram_size": 0,
76
+ "num_attention_heads": 40,
77
+ "num_beam_groups": 1,
78
+ "num_beams": 1,
79
+ "num_hidden_layers": 64,
80
+ "num_key_value_heads": 8,
81
+ "num_return_sequences": 1,
82
+ "output_attentions": false,
83
+ "output_hidden_states": false,
84
+ "output_scores": false,
85
+ "pad_token_id": null,
86
+ "prefix": null,
87
+ "problem_type": null,
88
+ "pruned_heads": {},
89
+ "remove_invalid_values": false,
90
+ "repetition_penalty": 1.0,
91
+ "return_dict": true,
92
+ "return_dict_in_generate": false,
93
+ "rms_norm_eps": 1e-06,
94
+ "rope_scaling": null,
95
+ "rope_theta": 1000000.0,
96
+ "sep_token_id": null,
97
+ "sliding_window": null,
98
+ "suppress_tokens": null,
99
+ "task_specific_params": null,
100
+ "temperature": 1.0,
101
+ "tf_legacy_loss": false,
102
+ "tie_encoder_decoder": false,
103
+ "tie_word_embeddings": false,
104
+ "tokenizer_class": null,
105
+ "top_k": 50,
106
+ "top_p": 1.0,
107
+ "torch_dtype": "bfloat16",
108
+ "torchscript": false,
109
+ "typical_p": 1.0,
110
+ "use_bfloat16": false,
111
+ "use_cache": true,
112
+ "use_sliding_window": false,
113
+ "vocab_size": 151670
114
+ },
115
+ "max_tiles": 12,
116
+ "min_blockunit_col": 4,
117
+ "min_blockunit_row": 4,
118
+ "min_tiles": 1,
119
+ "mlp_path": null,
120
+ "mm_hidden_size": 1152,
121
+ "mm_projector": "mlp_downsample_2x2_fix",
122
+ "mm_projector_cfg": {
123
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model/mm_projector",
124
+ "add_cross_attention": false,
125
+ "architectures": [
126
+ "MultimodalProjector"
127
+ ],
128
+ "bad_words_ids": null,
129
+ "begin_suppress_tokens": null,
130
+ "bos_token_id": null,
131
+ "chunk_size_feed_forward": 0,
132
+ "cross_attention_hidden_size": null,
133
+ "decoder_start_token_id": null,
134
+ "diversity_penalty": 0.0,
135
+ "do_sample": false,
136
+ "early_stopping": false,
137
+ "encoder_no_repeat_ngram_size": 0,
138
+ "eos_token_id": null,
139
+ "exponential_decay_length_penalty": null,
140
+ "finetuning_task": null,
141
+ "forced_bos_token_id": null,
142
+ "forced_eos_token_id": null,
143
+ "id2label": {
144
+ "0": "LABEL_0",
145
+ "1": "LABEL_1"
146
+ },
147
+ "is_decoder": false,
148
+ "is_encoder_decoder": false,
149
+ "label2id": {
150
+ "LABEL_0": 0,
151
+ "LABEL_1": 1
152
+ },
153
+ "length_penalty": 1.0,
154
+ "max_length": 20,
155
+ "min_length": 0,
156
+ "mm_projector_type": "mlp_downsample_2x2_fix",
157
+ "model_type": "v2l_projector",
158
+ "no_repeat_ngram_size": 0,
159
+ "num_beam_groups": 1,
160
+ "num_beams": 1,
161
+ "num_return_sequences": 1,
162
+ "output_attentions": false,
163
+ "output_hidden_states": false,
164
+ "output_scores": false,
165
+ "pad_token_id": null,
166
+ "prefix": null,
167
+ "problem_type": null,
168
+ "pruned_heads": {},
169
+ "remove_invalid_values": false,
170
+ "repetition_penalty": 1.0,
171
+ "return_dict": true,
172
+ "return_dict_in_generate": false,
173
+ "sep_token_id": null,
174
+ "suppress_tokens": null,
175
+ "task_specific_params": null,
176
+ "temperature": 1.0,
177
+ "tf_legacy_loss": false,
178
+ "tie_encoder_decoder": false,
179
+ "tie_word_embeddings": true,
180
+ "tokenizer_class": null,
181
+ "top_k": 50,
182
+ "top_p": 1.0,
183
+ "torch_dtype": "bfloat16",
184
+ "torchscript": false,
185
+ "typical_p": 1.0,
186
+ "use_bfloat16": false
187
+ },
188
+ "mm_projector_lr": null,
189
+ "mm_use_im_patch_token": false,
190
+ "mm_use_im_start_end": false,
191
+ "mm_vision_select_feature": "cls_patch",
192
+ "mm_vision_select_layer": -2,
193
+ "model_dtype": "torch.bfloat16",
194
+ "model_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/pretrain_32b_siglip2/model",
195
+ "model_type": "vila",
196
+ "num_time_tokens": 0,
197
+ "num_video_frames": 8,
198
+ "pad_block": false,
199
+ "pad_to_multiple_of": 0,
200
+ "qchoice": "none",
201
+ "quantize_model": false,
202
+ "refine_attn_blocksize": false,
203
+ "refine_col_blocksize": 4,
204
+ "refine_ln_blocksize": false,
205
+ "refine_ln_blocksize_but_only_backward": false,
206
+ "refine_ln_blocksize_but_only_forward": false,
207
+ "refine_ln_pertoken": false,
208
+ "refine_mlp_blocksize": false,
209
+ "refine_residual_fp": false,
210
+ "refine_row_blocksize": 4,
211
+ "resume_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model",
212
+ "row_blocksize": -1,
213
+ "row_blocksize_optimizer": 1,
214
+ "s2": false,
215
+ "s2_max_split_size": 336,
216
+ "s2_resize_output_to_scale_idx": 0,
217
+ "s2_scales": "336,672,1008",
218
+ "second_order_bit": null,
219
+ "second_order_quant_type": null,
220
+ "soft_ce_std": 1.0,
221
+ "symm": true,
222
+ "time_token_format": "<t{t}>",
223
+ "time_token_ids": [],
224
+ "transformers_version": "4.45.0",
225
+ "tune_language_model": true,
226
+ "tune_mm_projector": true,
227
+ "tune_vision_tower": true,
228
+ "use_quantize_optimizer": false,
229
+ "version": "2.0",
230
+ "video_encoder": {
231
+ "_target_": "llava.model.encoders.BasicVideoEncoder"
232
+ },
233
+ "vision_resolution": -1,
234
+ "vision_tower": "/data/models/google/siglip2-so400m-patch16-512",
235
+ "vision_tower_cfg": {
236
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model/vision_tower",
237
+ "add_cross_attention": false,
238
+ "architectures": [
239
+ "SiglipVisionModel"
240
+ ],
241
+ "attention_dropout": 0.0,
242
+ "bad_words_ids": null,
243
+ "begin_suppress_tokens": null,
244
+ "bos_token_id": null,
245
+ "chunk_size_feed_forward": 0,
246
+ "cross_attention_hidden_size": null,
247
+ "decoder_start_token_id": null,
248
+ "diversity_penalty": 0.0,
249
+ "do_sample": false,
250
+ "early_stopping": false,
251
+ "encoder_no_repeat_ngram_size": 0,
252
+ "eos_token_id": null,
253
+ "exponential_decay_length_penalty": null,
254
+ "finetuning_task": null,
255
+ "forced_bos_token_id": null,
256
+ "forced_eos_token_id": null,
257
+ "hidden_act": "gelu_pytorch_tanh",
258
+ "hidden_size": 1152,
259
+ "id2label": {
260
+ "0": "LABEL_0",
261
+ "1": "LABEL_1"
262
+ },
263
+ "image_size": 512,
264
+ "intermediate_size": 4304,
265
+ "is_decoder": false,
266
+ "is_encoder_decoder": false,
267
+ "label2id": {
268
+ "LABEL_0": 0,
269
+ "LABEL_1": 1
270
+ },
271
+ "layer_norm_eps": 1e-06,
272
+ "length_penalty": 1.0,
273
+ "max_length": 20,
274
+ "min_length": 0,
275
+ "model_type": "siglip_vision_model",
276
+ "no_repeat_ngram_size": 0,
277
+ "num_attention_heads": 16,
278
+ "num_beam_groups": 1,
279
+ "num_beams": 1,
280
+ "num_channels": 3,
281
+ "num_hidden_layers": 27,
282
+ "num_return_sequences": 1,
283
+ "output_attentions": false,
284
+ "output_hidden_states": false,
285
+ "output_scores": false,
286
+ "pad_token_id": null,
287
+ "patch_size": 16,
288
+ "prefix": null,
289
+ "problem_type": null,
290
+ "pruned_heads": {},
291
+ "remove_invalid_values": false,
292
+ "repetition_penalty": 1.0,
293
+ "return_dict": true,
294
+ "return_dict_in_generate": false,
295
+ "sep_token_id": null,
296
+ "suppress_tokens": null,
297
+ "task_specific_params": null,
298
+ "temperature": 1.0,
299
+ "tf_legacy_loss": false,
300
+ "tie_encoder_decoder": false,
301
+ "tie_word_embeddings": true,
302
+ "tokenizer_class": null,
303
+ "top_k": 50,
304
+ "top_p": 1.0,
305
+ "torch_dtype": "bfloat16",
306
+ "torchscript": false,
307
+ "typical_p": 1.0,
308
+ "use_bfloat16": false
309
+ },
310
+ "vision_tower_lr": null,
311
+ "weight_memory_efficient": true,
312
+ "auto_map": {
313
+ "AutoProcessor": "auto_processor.VILAProcessor",
314
+ "AutoConfig": "modeling_vila.VILAConfig",
315
+ "AutoModel": "modeling_vila.VILAForCasualLM",
316
+ "AutoModelForCausalLM": "modeling_vila.VILAForCasualLM"
317
+ }
318
+ }
configuration_vila.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import math
3
+ import os
4
+ import os.path as osp
5
+ from copy import deepcopy
6
+ from threading import Thread
7
+ from typing import List, Optional
8
+
9
+ import torch
10
+ import torchvision
11
+ from PIL import Image
12
+ from transformers import (
13
+ AutoProcessor,
14
+ PretrainedConfig,
15
+ PreTrainedModel,
16
+ Qwen2Config,
17
+ Qwen2ForCausalLM,
18
+ Qwen2PreTrainedModel,
19
+ TextIteratorStreamer,
20
+ )
21
+
22
+
23
+ class VILAConfig(PretrainedConfig):
24
+ model_type = "vila"
25
+ keys_to_ignore_at_inference = ["past_key_values"]
26
+
27
+ def __init__(
28
+ self,
29
+ llm_cfg=None,
30
+ vision_tower_cfg=None,
31
+ mm_projector_cfg=None,
32
+ architectures=None,
33
+ resume_path=None,
34
+ hidden_size=None,
35
+ mm_hidden_size=None,
36
+ image_aspect_ratio=None,
37
+ num_video_frames=None,
38
+ fps=None,
39
+ mm_vision_select_layer=None,
40
+ mm_vision_select_feature=None,
41
+ mm_use_im_start_end=False,
42
+ mm_use_im_patch_token=False,
43
+ mm_projector_lr=None,
44
+ vision_tower_lr=None,
45
+ vision_resolution=None,
46
+ interpolate_mode=None,
47
+ s2=None,
48
+ dynamic_s2=None,
49
+ s2_scales=None,
50
+ s2_max_split_size=None,
51
+ s2_resize_output_to_scale_idx=0,
52
+ min_tiles: Optional[int] = 1,
53
+ max_tiles: Optional[int] = 12,
54
+ num_time_tokens=None,
55
+ time_token_format=None,
56
+ image_encoder: str = '{"_target_": "llava.model.encoders.BasicImageEncoder"}',
57
+ video_encoder: str = '{"_target_": "llava.model.encoders.BasicVideoEncoder"}',
58
+ **kwargs,
59
+ ):
60
+ super().__init__()
61
+ self.architectures = architectures
62
+ self.llm_cfg = llm_cfg
63
+ self.vision_tower_cfg = vision_tower_cfg
64
+ self.mm_projector_cfg = mm_projector_cfg
65
+ self.resume_path = resume_path
66
+
67
+ self.hidden_size = hidden_size
68
+ self.mm_hidden_size = mm_hidden_size
69
+ self.image_aspect_ratio = image_aspect_ratio
70
+ self.num_video_frames = num_video_frames
71
+ self.fps = fps
72
+ self.mm_vision_select_layer = mm_vision_select_layer
73
+ self.mm_vision_select_feature = mm_vision_select_feature
74
+ self.mm_use_im_start_end = mm_use_im_start_end
75
+ self.mm_use_im_patch_token = mm_use_im_patch_token
76
+ self.mm_projector_lr = mm_projector_lr
77
+ self.vision_tower_lr = vision_tower_lr
78
+ self.vision_resolution = vision_resolution
79
+ self.interpolate_mode = interpolate_mode
80
+ self.s2 = s2
81
+ self.dynamic_s2 = dynamic_s2
82
+ self.s2_scales = s2_scales
83
+ self.s2_max_split_size = s2_max_split_size
84
+ self.s2_resize_output_to_scale_idx = s2_resize_output_to_scale_idx
85
+ self.min_tiles = min_tiles
86
+ self.max_tiles = max_tiles
87
+ self.num_time_tokens = num_time_tokens
88
+ self.time_token_format = time_token_format
89
+
90
+ self.image_encoder = image_encoder
91
+ self.video_encoder = video_encoder
92
+
93
+ super().__init__(**kwargs)
constants.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ CONTROLLER_HEART_BEAT_EXPIRATION = 30
18
+ WORKER_HEART_BEAT_INTERVAL = 15
19
+
20
+ LOGDIR = "."
21
+
22
+ # Model Constants
23
+ IGNORE_INDEX = -100
24
+ DEFAULT_IMAGE_TOKEN = "<image>"
25
+
26
+ SENTINEL_TOKEN = "<vila/sentinel>"
27
+ MEDIA_TOKENS = {
28
+ "image": "<image>",
29
+ "video": "<vila/video>",
30
+ }
31
+ # <image> <vila/video> <vila/sentinel>
32
+ # TODO(ligeng): need to discuss with Zhijian for the following tokens for different models.
33
+ """
34
+ 151643: AddedToken("<|endoftext|>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
35
+ 151644: AddedToken("<|im_start|>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
36
+ 151645: AddedToken("<|im_end|>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
37
+ 151646: AddedToken("[BOS]", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
38
+ 151647: AddedToken("[PAD]", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
39
+ 151648: AddedToken("<vila/sentinel>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
40
+ 151649: AddedToken("<image>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
41
+ 151650: AddedToken("<vila/video>", rstrip=False, lstrip=False, single_word=False, normalized=False, special=True),
42
+ """
43
+ NUM_EXTRA_TOKENS = 8
conversation.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+ # This file is modified from https://github.com/haotian-liu/LLaVA/
17
+
18
+ import dataclasses
19
+ from enum import Enum, auto
20
+ from typing import List
21
+
22
+ # from llava.utils.logging import logger
23
+
24
+
25
+ class SeparatorStyle(Enum):
26
+ """Different separator style."""
27
+
28
+ AUTO = auto()
29
+ TWO = auto()
30
+ MPT = auto()
31
+ PLAIN = auto()
32
+ LLAMA_3 = auto()
33
+
34
+
35
+ @dataclasses.dataclass
36
+ class Conversation:
37
+ """A class that keeps all conversation history."""
38
+
39
+ system: str
40
+ roles: List[str]
41
+ messages: List[List[str]]
42
+ sep_style: SeparatorStyle = SeparatorStyle.AUTO
43
+ sep: str = "###"
44
+ sep2: str = None
45
+ version: str = "Unknown"
46
+
47
+ def get_prompt(self):
48
+ messages = self.messages
49
+ if len(messages) > 0 and type(messages[0][1]) is tuple:
50
+ messages = self.messages.copy()
51
+ init_role, init_msg = messages[0].copy()
52
+ init_msg = init_msg[0].replace("<image>", "").strip()
53
+ messages[0] = (init_role, "<image>\n" + init_msg)
54
+
55
+ if self.sep_style == SeparatorStyle.TWO:
56
+ seps = [self.sep, self.sep2]
57
+ ret = self.system + seps[0]
58
+ for i, (role, message) in enumerate(messages):
59
+ if message:
60
+ if type(message) is tuple:
61
+ message, _, _ = message
62
+ ret += role + ": " + message + seps[i % 2]
63
+ else:
64
+ ret += role + ":"
65
+ elif self.sep_style == SeparatorStyle.LLAMA_3:
66
+ ret = self.system + self.sep
67
+ for rid, (role, message) in enumerate(messages):
68
+ if message:
69
+ if type(message) is tuple:
70
+ message = message[0]
71
+ sep = self.sep if rid < len(messages) - 1 else self.sep2
72
+ ret += role + message + sep
73
+ else:
74
+ ret += role
75
+ elif self.sep_style == SeparatorStyle.MPT:
76
+ ret = self.system + self.sep
77
+ for role, message in messages:
78
+ if message:
79
+ if type(message) is tuple:
80
+ message, _, _ = message
81
+ ret += role + message + self.sep
82
+ else:
83
+ ret += role
84
+ elif self.sep_style == SeparatorStyle.PLAIN:
85
+ seps = [self.sep, self.sep2]
86
+ ret = self.system
87
+ for i, (role, message) in enumerate(messages):
88
+ if message:
89
+ if type(message) is tuple:
90
+ message, _, _ = message
91
+ ret += message + seps[i % 2]
92
+ else:
93
+ ret += ""
94
+ else:
95
+ raise ValueError(f"Invalid style: {self.sep_style}")
96
+
97
+ return ret
98
+
99
+ def append_message(self, role, message):
100
+ self.messages.append([role, message])
101
+
102
+ def copy(self):
103
+ return Conversation(
104
+ system=self.system,
105
+ roles=self.roles,
106
+ messages=[[x, y] for x, y in self.messages],
107
+ sep_style=self.sep_style,
108
+ sep=self.sep,
109
+ sep2=self.sep2,
110
+ version=self.version,
111
+ )
112
+
113
+
114
+ conv_auto = Conversation(
115
+ system="",
116
+ roles=("", ""),
117
+ messages=(),
118
+ sep_style=SeparatorStyle.AUTO,
119
+ sep="\n",
120
+ )
121
+
122
+ conv_vicuna_v1 = Conversation(
123
+ system="A chat between a curious user and an artificial intelligence assistant. "
124
+ "The assistant gives helpful, detailed, and polite answers to the user's questions.",
125
+ roles=("USER", "ASSISTANT"),
126
+ version="v1",
127
+ messages=(),
128
+ sep_style=SeparatorStyle.TWO,
129
+ sep=" ",
130
+ sep2="</s>",
131
+ )
132
+
133
+ conv_llava_plain = Conversation(
134
+ system="",
135
+ roles=("", ""),
136
+ messages=(),
137
+ sep_style=SeparatorStyle.PLAIN,
138
+ sep="\n",
139
+ )
140
+
141
+ hermes_2 = Conversation(
142
+ system="<|im_start|>system\nAnswer the questions.",
143
+ roles=("<|im_start|>user\n", "<|im_start|>assistant\n"),
144
+ sep_style=SeparatorStyle.MPT,
145
+ sep="<|im_end|>",
146
+ messages=(),
147
+ version="hermes-2",
148
+ )
149
+
150
+ # Template added by Yukang. Note (kentang-mit@): sep is <|eot_id|> for official template.
151
+ llama_3_chat = Conversation(
152
+ system="<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are a helpful language and vision assistant. "
153
+ "You are able to understand the visual content that the user provides, "
154
+ "and assist the user with a variety of tasks using natural language.",
155
+ roles=("<|start_header_id|>user<|end_header_id|>\n\n", "<|start_header_id|>assistant<|end_header_id|>\n\n"),
156
+ version="llama_v3",
157
+ messages=(),
158
+ sep_style=SeparatorStyle.LLAMA_3,
159
+ sep="<|eot_id|>",
160
+ sep2="<|end_of_text|>",
161
+ )
162
+
163
+
164
+ default_conversation = conv_auto
165
+ conv_templates = {
166
+ "auto": conv_auto,
167
+ "hermes-2": hermes_2,
168
+ "llama_3": llama_3_chat,
169
+ "v1": conv_vicuna_v1,
170
+ "vicuna_v1": conv_vicuna_v1,
171
+ "plain": conv_llava_plain,
172
+ }
173
+
174
+
175
+ CONVERSATION_MODE_MAPPING = {
176
+ "vila1.5-3b": "vicuna_v1",
177
+ "vila1.5-8b": "llama_3",
178
+ "vila1.5-13b": "vicuna_v1",
179
+ "vila1.5-40b": "hermes-2",
180
+ "llama-3": "llama_3",
181
+ "llama3": "llama_3",
182
+ }
183
+
184
+
185
+ def auto_set_conversation_mode(model_name_or_path: str) -> str:
186
+ global default_conversation
187
+ for k, v in CONVERSATION_MODE_MAPPING.items():
188
+ if k in model_name_or_path.lower():
189
+ print(f"Setting conversation mode to `{v}` based on model name/path `{model_name_or_path}`.")
190
+ default_conversation = conv_templates[v]
191
+ return
distributed.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import warnings
3
+ from typing import Any, List, Optional
4
+
5
+ from torch import distributed as dist
6
+
7
+ __all__ = [
8
+ "init",
9
+ "is_initialized",
10
+ "size",
11
+ "rank",
12
+ "local_size",
13
+ "local_rank",
14
+ "is_main",
15
+ "barrier",
16
+ "gather",
17
+ "all_gather",
18
+ ]
19
+
20
+
21
+ def init() -> None:
22
+ if "RANK" not in os.environ:
23
+ warnings.warn("Environment variable `RANK` is not set. Skipping distributed initialization.")
24
+ return
25
+ dist.init_process_group(backend="nccl", init_method="env://")
26
+
27
+
28
+ def is_initialized() -> bool:
29
+ return dist.is_initialized()
30
+
31
+
32
+ def size() -> int:
33
+ return int(os.environ.get("WORLD_SIZE", 1))
34
+
35
+
36
+ def rank() -> int:
37
+ return int(os.environ.get("RANK", 0))
38
+
39
+
40
+ def local_size() -> int:
41
+ return int(os.environ.get("LOCAL_WORLD_SIZE", 1))
42
+
43
+
44
+ def local_rank() -> int:
45
+ return int(os.environ.get("LOCAL_RANK", 0))
46
+
47
+
48
+ def is_main() -> bool:
49
+ return rank() == 0
50
+
51
+
52
+ def barrier() -> None:
53
+ dist.barrier()
54
+
55
+
56
+ def gather(obj: Any, dst: int = 0) -> Optional[List[Any]]:
57
+ if not is_initialized():
58
+ return [obj]
59
+ if is_main():
60
+ objs = [None for _ in range(size())]
61
+ dist.gather_object(obj, objs, dst=dst)
62
+ return objs
63
+ else:
64
+ dist.gather_object(obj, dst=dst)
65
+ return None
66
+
67
+
68
+ def all_gather(obj: Any) -> List[Any]:
69
+ if not is_initialized():
70
+ return [obj]
71
+ objs = [None for _ in range(size())]
72
+ dist.all_gather_object(objs, obj)
73
+ return objs
evaluation.jsonl ADDED
@@ -0,0 +1 @@
 
 
1
+ {"heron-bench": {"overall_score": 74.79865133099491, "details": {"conv": 8.0, "conv_rel": 80.76923076923076, "detail": 6.380952380952381, "detail_rel": 65.3658536585366, "complex": 7.65, "complex_rel": 78.26086956521739, "parse_error_count": 0, "overall": 7.533980582524272, "overall_rel": 74.79865133099491}}}
llm/added_tokens.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</tool_call>": 151658,
3
+ "<image>": 151666,
4
+ "<tool_call>": 151657,
5
+ "<vila/sentinel>": 151665,
6
+ "<vila/video>": 151667,
7
+ "<|box_end|>": 151649,
8
+ "<|box_start|>": 151648,
9
+ "<|endoftext|>": 151643,
10
+ "<|file_sep|>": 151664,
11
+ "<|fim_middle|>": 151660,
12
+ "<|fim_pad|>": 151662,
13
+ "<|fim_prefix|>": 151659,
14
+ "<|fim_suffix|>": 151661,
15
+ "<|im_end|>": 151645,
16
+ "<|im_start|>": 151644,
17
+ "<|image_pad|>": 151655,
18
+ "<|object_ref_end|>": 151647,
19
+ "<|object_ref_start|>": 151646,
20
+ "<|quad_end|>": 151651,
21
+ "<|quad_start|>": 151650,
22
+ "<|repo_name|>": 151663,
23
+ "<|video_pad|>": 151656,
24
+ "<|vision_end|>": 151653,
25
+ "<|vision_pad|>": 151654,
26
+ "<|vision_start|>": 151652,
27
+ "[BOS]": 151668,
28
+ "[PAD]": 151669
29
+ }
llm/config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model/llm",
3
+ "architectures": [
4
+ "Qwen2ForCausalLM"
5
+ ],
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 151643,
8
+ "eos_token_id": 151645,
9
+ "hidden_act": "silu",
10
+ "hidden_size": 5120,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 27648,
13
+ "max_position_embeddings": 32768,
14
+ "max_window_layers": 70,
15
+ "model_max_length": 4096,
16
+ "model_type": "qwen2",
17
+ "num_attention_heads": 40,
18
+ "num_hidden_layers": 64,
19
+ "num_key_value_heads": 8,
20
+ "rms_norm_eps": 1e-06,
21
+ "rope_scaling": null,
22
+ "rope_theta": 1000000.0,
23
+ "sliding_window": null,
24
+ "tie_word_embeddings": false,
25
+ "torch_dtype": "bfloat16",
26
+ "transformers_version": "4.45.0",
27
+ "use_cache": true,
28
+ "use_sliding_window": false,
29
+ "vocab_size": 151670
30
+ }
llm/generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 151643,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151645,
6
+ 151643
7
+ ],
8
+ "pad_token_id": 151643,
9
+ "repetition_penalty": 1.05,
10
+ "temperature": 0.7,
11
+ "top_k": 20,
12
+ "top_p": 0.8,
13
+ "transformers_version": "4.45.0"
14
+ }
llm/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
llm/model-00001-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70d13fa8b6cd4201fa0fe8f94f42dc4148806e4208490e61c138d170daa095f5
3
+ size 4887696432
llm/model-00002-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ee6037d12724a7a6ab3240840006ea09808f88b9de5991069e09ad90d9c2dfc
3
+ size 4876059352
llm/model-00003-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:867d5fd142a44b4b4c88cc19dacd0cd61c13e0339a0533a15fc21bdbbde56d36
3
+ size 4876059384
llm/model-00004-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81fc3ed3ab302f9439fafd0862635759a7a80e5ed9e127a3daabcd5a65cca75d
3
+ size 4876059416
llm/model-00005-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:70e7475a69639ae0d8a31b2924f7efab752e0ce5c7214b198b84d96155fe5ca4
3
+ size 4876059416
llm/model-00006-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9d2deb2daa07025186df4181917dc364f0a77d44e534dcf8620e1890e21d1fc
3
+ size 4876059416
llm/model-00007-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58f13a1f639121f43a5421283ac727b77d579b40789d8d9c404805e9d1daecaf
3
+ size 4876059416
llm/model-00008-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87bfbe461638b9ea44822c26065374b02d27d3537af40de2ed100e74c1326095
3
+ size 4876059416
llm/model-00009-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e25532592f5d6eea97d06b4e1eb272c7319bc9d027dd554df6da81d79821252d
3
+ size 4876059416
llm/model-00010-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad4d2bd9880f4a003aa68717bd243ed94906f454c13b074c26de5271e524c56e
3
+ size 4876059416
llm/model-00011-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0ace19462220b28c4aa6c0d84a5ea0be15b14d4241a2e84c4afc38e3b4bd2b8
3
+ size 4876059416
llm/model-00012-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72fb86591248c325f02706517710dc5df7fba91bb23c6a51663d87321a278404
3
+ size 4876059416
llm/model-00013-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5480ef33a0d1bb4752a24d465a29e3421ee5694632dfaf9aa056f66c55da4e75
3
+ size 4876059416
llm/model-00014-of-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd140e07bb38c24992ec35982d94ca74bd14a6ca4017c54b4b458c5ef84681b1
3
+ size 2119363240
llm/model.safetensors.index.json ADDED
@@ -0,0 +1,778 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "metadata": {
3
+ "total_size": 65519683584
4
+ },
5
+ "weight_map": {
6
+ "lm_head.weight": "model-00014-of-00014.safetensors",
7
+ "model.embed_tokens.weight": "model-00001-of-00014.safetensors",
8
+ "model.layers.0.input_layernorm.weight": "model-00001-of-00014.safetensors",
9
+ "model.layers.0.mlp.down_proj.weight": "model-00001-of-00014.safetensors",
10
+ "model.layers.0.mlp.gate_proj.weight": "model-00001-of-00014.safetensors",
11
+ "model.layers.0.mlp.up_proj.weight": "model-00001-of-00014.safetensors",
12
+ "model.layers.0.post_attention_layernorm.weight": "model-00001-of-00014.safetensors",
13
+ "model.layers.0.self_attn.k_proj.bias": "model-00001-of-00014.safetensors",
14
+ "model.layers.0.self_attn.k_proj.weight": "model-00001-of-00014.safetensors",
15
+ "model.layers.0.self_attn.o_proj.weight": "model-00001-of-00014.safetensors",
16
+ "model.layers.0.self_attn.q_proj.bias": "model-00001-of-00014.safetensors",
17
+ "model.layers.0.self_attn.q_proj.weight": "model-00001-of-00014.safetensors",
18
+ "model.layers.0.self_attn.v_proj.bias": "model-00001-of-00014.safetensors",
19
+ "model.layers.0.self_attn.v_proj.weight": "model-00001-of-00014.safetensors",
20
+ "model.layers.1.input_layernorm.weight": "model-00001-of-00014.safetensors",
21
+ "model.layers.1.mlp.down_proj.weight": "model-00001-of-00014.safetensors",
22
+ "model.layers.1.mlp.gate_proj.weight": "model-00001-of-00014.safetensors",
23
+ "model.layers.1.mlp.up_proj.weight": "model-00001-of-00014.safetensors",
24
+ "model.layers.1.post_attention_layernorm.weight": "model-00001-of-00014.safetensors",
25
+ "model.layers.1.self_attn.k_proj.bias": "model-00001-of-00014.safetensors",
26
+ "model.layers.1.self_attn.k_proj.weight": "model-00001-of-00014.safetensors",
27
+ "model.layers.1.self_attn.o_proj.weight": "model-00001-of-00014.safetensors",
28
+ "model.layers.1.self_attn.q_proj.bias": "model-00001-of-00014.safetensors",
29
+ "model.layers.1.self_attn.q_proj.weight": "model-00001-of-00014.safetensors",
30
+ "model.layers.1.self_attn.v_proj.bias": "model-00001-of-00014.safetensors",
31
+ "model.layers.1.self_attn.v_proj.weight": "model-00001-of-00014.safetensors",
32
+ "model.layers.10.input_layernorm.weight": "model-00003-of-00014.safetensors",
33
+ "model.layers.10.mlp.down_proj.weight": "model-00003-of-00014.safetensors",
34
+ "model.layers.10.mlp.gate_proj.weight": "model-00003-of-00014.safetensors",
35
+ "model.layers.10.mlp.up_proj.weight": "model-00003-of-00014.safetensors",
36
+ "model.layers.10.post_attention_layernorm.weight": "model-00003-of-00014.safetensors",
37
+ "model.layers.10.self_attn.k_proj.bias": "model-00003-of-00014.safetensors",
38
+ "model.layers.10.self_attn.k_proj.weight": "model-00003-of-00014.safetensors",
39
+ "model.layers.10.self_attn.o_proj.weight": "model-00003-of-00014.safetensors",
40
+ "model.layers.10.self_attn.q_proj.bias": "model-00003-of-00014.safetensors",
41
+ "model.layers.10.self_attn.q_proj.weight": "model-00003-of-00014.safetensors",
42
+ "model.layers.10.self_attn.v_proj.bias": "model-00003-of-00014.safetensors",
43
+ "model.layers.10.self_attn.v_proj.weight": "model-00003-of-00014.safetensors",
44
+ "model.layers.11.input_layernorm.weight": "model-00003-of-00014.safetensors",
45
+ "model.layers.11.mlp.down_proj.weight": "model-00003-of-00014.safetensors",
46
+ "model.layers.11.mlp.gate_proj.weight": "model-00003-of-00014.safetensors",
47
+ "model.layers.11.mlp.up_proj.weight": "model-00003-of-00014.safetensors",
48
+ "model.layers.11.post_attention_layernorm.weight": "model-00003-of-00014.safetensors",
49
+ "model.layers.11.self_attn.k_proj.bias": "model-00003-of-00014.safetensors",
50
+ "model.layers.11.self_attn.k_proj.weight": "model-00003-of-00014.safetensors",
51
+ "model.layers.11.self_attn.o_proj.weight": "model-00003-of-00014.safetensors",
52
+ "model.layers.11.self_attn.q_proj.bias": "model-00003-of-00014.safetensors",
53
+ "model.layers.11.self_attn.q_proj.weight": "model-00003-of-00014.safetensors",
54
+ "model.layers.11.self_attn.v_proj.bias": "model-00003-of-00014.safetensors",
55
+ "model.layers.11.self_attn.v_proj.weight": "model-00003-of-00014.safetensors",
56
+ "model.layers.12.input_layernorm.weight": "model-00003-of-00014.safetensors",
57
+ "model.layers.12.mlp.down_proj.weight": "model-00003-of-00014.safetensors",
58
+ "model.layers.12.mlp.gate_proj.weight": "model-00003-of-00014.safetensors",
59
+ "model.layers.12.mlp.up_proj.weight": "model-00003-of-00014.safetensors",
60
+ "model.layers.12.post_attention_layernorm.weight": "model-00003-of-00014.safetensors",
61
+ "model.layers.12.self_attn.k_proj.bias": "model-00003-of-00014.safetensors",
62
+ "model.layers.12.self_attn.k_proj.weight": "model-00003-of-00014.safetensors",
63
+ "model.layers.12.self_attn.o_proj.weight": "model-00003-of-00014.safetensors",
64
+ "model.layers.12.self_attn.q_proj.bias": "model-00003-of-00014.safetensors",
65
+ "model.layers.12.self_attn.q_proj.weight": "model-00003-of-00014.safetensors",
66
+ "model.layers.12.self_attn.v_proj.bias": "model-00003-of-00014.safetensors",
67
+ "model.layers.12.self_attn.v_proj.weight": "model-00003-of-00014.safetensors",
68
+ "model.layers.13.input_layernorm.weight": "model-00004-of-00014.safetensors",
69
+ "model.layers.13.mlp.down_proj.weight": "model-00004-of-00014.safetensors",
70
+ "model.layers.13.mlp.gate_proj.weight": "model-00003-of-00014.safetensors",
71
+ "model.layers.13.mlp.up_proj.weight": "model-00004-of-00014.safetensors",
72
+ "model.layers.13.post_attention_layernorm.weight": "model-00004-of-00014.safetensors",
73
+ "model.layers.13.self_attn.k_proj.bias": "model-00003-of-00014.safetensors",
74
+ "model.layers.13.self_attn.k_proj.weight": "model-00003-of-00014.safetensors",
75
+ "model.layers.13.self_attn.o_proj.weight": "model-00003-of-00014.safetensors",
76
+ "model.layers.13.self_attn.q_proj.bias": "model-00003-of-00014.safetensors",
77
+ "model.layers.13.self_attn.q_proj.weight": "model-00003-of-00014.safetensors",
78
+ "model.layers.13.self_attn.v_proj.bias": "model-00003-of-00014.safetensors",
79
+ "model.layers.13.self_attn.v_proj.weight": "model-00003-of-00014.safetensors",
80
+ "model.layers.14.input_layernorm.weight": "model-00004-of-00014.safetensors",
81
+ "model.layers.14.mlp.down_proj.weight": "model-00004-of-00014.safetensors",
82
+ "model.layers.14.mlp.gate_proj.weight": "model-00004-of-00014.safetensors",
83
+ "model.layers.14.mlp.up_proj.weight": "model-00004-of-00014.safetensors",
84
+ "model.layers.14.post_attention_layernorm.weight": "model-00004-of-00014.safetensors",
85
+ "model.layers.14.self_attn.k_proj.bias": "model-00004-of-00014.safetensors",
86
+ "model.layers.14.self_attn.k_proj.weight": "model-00004-of-00014.safetensors",
87
+ "model.layers.14.self_attn.o_proj.weight": "model-00004-of-00014.safetensors",
88
+ "model.layers.14.self_attn.q_proj.bias": "model-00004-of-00014.safetensors",
89
+ "model.layers.14.self_attn.q_proj.weight": "model-00004-of-00014.safetensors",
90
+ "model.layers.14.self_attn.v_proj.bias": "model-00004-of-00014.safetensors",
91
+ "model.layers.14.self_attn.v_proj.weight": "model-00004-of-00014.safetensors",
92
+ "model.layers.15.input_layernorm.weight": "model-00004-of-00014.safetensors",
93
+ "model.layers.15.mlp.down_proj.weight": "model-00004-of-00014.safetensors",
94
+ "model.layers.15.mlp.gate_proj.weight": "model-00004-of-00014.safetensors",
95
+ "model.layers.15.mlp.up_proj.weight": "model-00004-of-00014.safetensors",
96
+ "model.layers.15.post_attention_layernorm.weight": "model-00004-of-00014.safetensors",
97
+ "model.layers.15.self_attn.k_proj.bias": "model-00004-of-00014.safetensors",
98
+ "model.layers.15.self_attn.k_proj.weight": "model-00004-of-00014.safetensors",
99
+ "model.layers.15.self_attn.o_proj.weight": "model-00004-of-00014.safetensors",
100
+ "model.layers.15.self_attn.q_proj.bias": "model-00004-of-00014.safetensors",
101
+ "model.layers.15.self_attn.q_proj.weight": "model-00004-of-00014.safetensors",
102
+ "model.layers.15.self_attn.v_proj.bias": "model-00004-of-00014.safetensors",
103
+ "model.layers.15.self_attn.v_proj.weight": "model-00004-of-00014.safetensors",
104
+ "model.layers.16.input_layernorm.weight": "model-00004-of-00014.safetensors",
105
+ "model.layers.16.mlp.down_proj.weight": "model-00004-of-00014.safetensors",
106
+ "model.layers.16.mlp.gate_proj.weight": "model-00004-of-00014.safetensors",
107
+ "model.layers.16.mlp.up_proj.weight": "model-00004-of-00014.safetensors",
108
+ "model.layers.16.post_attention_layernorm.weight": "model-00004-of-00014.safetensors",
109
+ "model.layers.16.self_attn.k_proj.bias": "model-00004-of-00014.safetensors",
110
+ "model.layers.16.self_attn.k_proj.weight": "model-00004-of-00014.safetensors",
111
+ "model.layers.16.self_attn.o_proj.weight": "model-00004-of-00014.safetensors",
112
+ "model.layers.16.self_attn.q_proj.bias": "model-00004-of-00014.safetensors",
113
+ "model.layers.16.self_attn.q_proj.weight": "model-00004-of-00014.safetensors",
114
+ "model.layers.16.self_attn.v_proj.bias": "model-00004-of-00014.safetensors",
115
+ "model.layers.16.self_attn.v_proj.weight": "model-00004-of-00014.safetensors",
116
+ "model.layers.17.input_layernorm.weight": "model-00004-of-00014.safetensors",
117
+ "model.layers.17.mlp.down_proj.weight": "model-00004-of-00014.safetensors",
118
+ "model.layers.17.mlp.gate_proj.weight": "model-00004-of-00014.safetensors",
119
+ "model.layers.17.mlp.up_proj.weight": "model-00004-of-00014.safetensors",
120
+ "model.layers.17.post_attention_layernorm.weight": "model-00004-of-00014.safetensors",
121
+ "model.layers.17.self_attn.k_proj.bias": "model-00004-of-00014.safetensors",
122
+ "model.layers.17.self_attn.k_proj.weight": "model-00004-of-00014.safetensors",
123
+ "model.layers.17.self_attn.o_proj.weight": "model-00004-of-00014.safetensors",
124
+ "model.layers.17.self_attn.q_proj.bias": "model-00004-of-00014.safetensors",
125
+ "model.layers.17.self_attn.q_proj.weight": "model-00004-of-00014.safetensors",
126
+ "model.layers.17.self_attn.v_proj.bias": "model-00004-of-00014.safetensors",
127
+ "model.layers.17.self_attn.v_proj.weight": "model-00004-of-00014.safetensors",
128
+ "model.layers.18.input_layernorm.weight": "model-00005-of-00014.safetensors",
129
+ "model.layers.18.mlp.down_proj.weight": "model-00005-of-00014.safetensors",
130
+ "model.layers.18.mlp.gate_proj.weight": "model-00004-of-00014.safetensors",
131
+ "model.layers.18.mlp.up_proj.weight": "model-00005-of-00014.safetensors",
132
+ "model.layers.18.post_attention_layernorm.weight": "model-00005-of-00014.safetensors",
133
+ "model.layers.18.self_attn.k_proj.bias": "model-00004-of-00014.safetensors",
134
+ "model.layers.18.self_attn.k_proj.weight": "model-00004-of-00014.safetensors",
135
+ "model.layers.18.self_attn.o_proj.weight": "model-00004-of-00014.safetensors",
136
+ "model.layers.18.self_attn.q_proj.bias": "model-00004-of-00014.safetensors",
137
+ "model.layers.18.self_attn.q_proj.weight": "model-00004-of-00014.safetensors",
138
+ "model.layers.18.self_attn.v_proj.bias": "model-00004-of-00014.safetensors",
139
+ "model.layers.18.self_attn.v_proj.weight": "model-00004-of-00014.safetensors",
140
+ "model.layers.19.input_layernorm.weight": "model-00005-of-00014.safetensors",
141
+ "model.layers.19.mlp.down_proj.weight": "model-00005-of-00014.safetensors",
142
+ "model.layers.19.mlp.gate_proj.weight": "model-00005-of-00014.safetensors",
143
+ "model.layers.19.mlp.up_proj.weight": "model-00005-of-00014.safetensors",
144
+ "model.layers.19.post_attention_layernorm.weight": "model-00005-of-00014.safetensors",
145
+ "model.layers.19.self_attn.k_proj.bias": "model-00005-of-00014.safetensors",
146
+ "model.layers.19.self_attn.k_proj.weight": "model-00005-of-00014.safetensors",
147
+ "model.layers.19.self_attn.o_proj.weight": "model-00005-of-00014.safetensors",
148
+ "model.layers.19.self_attn.q_proj.bias": "model-00005-of-00014.safetensors",
149
+ "model.layers.19.self_attn.q_proj.weight": "model-00005-of-00014.safetensors",
150
+ "model.layers.19.self_attn.v_proj.bias": "model-00005-of-00014.safetensors",
151
+ "model.layers.19.self_attn.v_proj.weight": "model-00005-of-00014.safetensors",
152
+ "model.layers.2.input_layernorm.weight": "model-00001-of-00014.safetensors",
153
+ "model.layers.2.mlp.down_proj.weight": "model-00001-of-00014.safetensors",
154
+ "model.layers.2.mlp.gate_proj.weight": "model-00001-of-00014.safetensors",
155
+ "model.layers.2.mlp.up_proj.weight": "model-00001-of-00014.safetensors",
156
+ "model.layers.2.post_attention_layernorm.weight": "model-00001-of-00014.safetensors",
157
+ "model.layers.2.self_attn.k_proj.bias": "model-00001-of-00014.safetensors",
158
+ "model.layers.2.self_attn.k_proj.weight": "model-00001-of-00014.safetensors",
159
+ "model.layers.2.self_attn.o_proj.weight": "model-00001-of-00014.safetensors",
160
+ "model.layers.2.self_attn.q_proj.bias": "model-00001-of-00014.safetensors",
161
+ "model.layers.2.self_attn.q_proj.weight": "model-00001-of-00014.safetensors",
162
+ "model.layers.2.self_attn.v_proj.bias": "model-00001-of-00014.safetensors",
163
+ "model.layers.2.self_attn.v_proj.weight": "model-00001-of-00014.safetensors",
164
+ "model.layers.20.input_layernorm.weight": "model-00005-of-00014.safetensors",
165
+ "model.layers.20.mlp.down_proj.weight": "model-00005-of-00014.safetensors",
166
+ "model.layers.20.mlp.gate_proj.weight": "model-00005-of-00014.safetensors",
167
+ "model.layers.20.mlp.up_proj.weight": "model-00005-of-00014.safetensors",
168
+ "model.layers.20.post_attention_layernorm.weight": "model-00005-of-00014.safetensors",
169
+ "model.layers.20.self_attn.k_proj.bias": "model-00005-of-00014.safetensors",
170
+ "model.layers.20.self_attn.k_proj.weight": "model-00005-of-00014.safetensors",
171
+ "model.layers.20.self_attn.o_proj.weight": "model-00005-of-00014.safetensors",
172
+ "model.layers.20.self_attn.q_proj.bias": "model-00005-of-00014.safetensors",
173
+ "model.layers.20.self_attn.q_proj.weight": "model-00005-of-00014.safetensors",
174
+ "model.layers.20.self_attn.v_proj.bias": "model-00005-of-00014.safetensors",
175
+ "model.layers.20.self_attn.v_proj.weight": "model-00005-of-00014.safetensors",
176
+ "model.layers.21.input_layernorm.weight": "model-00005-of-00014.safetensors",
177
+ "model.layers.21.mlp.down_proj.weight": "model-00005-of-00014.safetensors",
178
+ "model.layers.21.mlp.gate_proj.weight": "model-00005-of-00014.safetensors",
179
+ "model.layers.21.mlp.up_proj.weight": "model-00005-of-00014.safetensors",
180
+ "model.layers.21.post_attention_layernorm.weight": "model-00005-of-00014.safetensors",
181
+ "model.layers.21.self_attn.k_proj.bias": "model-00005-of-00014.safetensors",
182
+ "model.layers.21.self_attn.k_proj.weight": "model-00005-of-00014.safetensors",
183
+ "model.layers.21.self_attn.o_proj.weight": "model-00005-of-00014.safetensors",
184
+ "model.layers.21.self_attn.q_proj.bias": "model-00005-of-00014.safetensors",
185
+ "model.layers.21.self_attn.q_proj.weight": "model-00005-of-00014.safetensors",
186
+ "model.layers.21.self_attn.v_proj.bias": "model-00005-of-00014.safetensors",
187
+ "model.layers.21.self_attn.v_proj.weight": "model-00005-of-00014.safetensors",
188
+ "model.layers.22.input_layernorm.weight": "model-00005-of-00014.safetensors",
189
+ "model.layers.22.mlp.down_proj.weight": "model-00005-of-00014.safetensors",
190
+ "model.layers.22.mlp.gate_proj.weight": "model-00005-of-00014.safetensors",
191
+ "model.layers.22.mlp.up_proj.weight": "model-00005-of-00014.safetensors",
192
+ "model.layers.22.post_attention_layernorm.weight": "model-00005-of-00014.safetensors",
193
+ "model.layers.22.self_attn.k_proj.bias": "model-00005-of-00014.safetensors",
194
+ "model.layers.22.self_attn.k_proj.weight": "model-00005-of-00014.safetensors",
195
+ "model.layers.22.self_attn.o_proj.weight": "model-00005-of-00014.safetensors",
196
+ "model.layers.22.self_attn.q_proj.bias": "model-00005-of-00014.safetensors",
197
+ "model.layers.22.self_attn.q_proj.weight": "model-00005-of-00014.safetensors",
198
+ "model.layers.22.self_attn.v_proj.bias": "model-00005-of-00014.safetensors",
199
+ "model.layers.22.self_attn.v_proj.weight": "model-00005-of-00014.safetensors",
200
+ "model.layers.23.input_layernorm.weight": "model-00006-of-00014.safetensors",
201
+ "model.layers.23.mlp.down_proj.weight": "model-00006-of-00014.safetensors",
202
+ "model.layers.23.mlp.gate_proj.weight": "model-00005-of-00014.safetensors",
203
+ "model.layers.23.mlp.up_proj.weight": "model-00006-of-00014.safetensors",
204
+ "model.layers.23.post_attention_layernorm.weight": "model-00006-of-00014.safetensors",
205
+ "model.layers.23.self_attn.k_proj.bias": "model-00005-of-00014.safetensors",
206
+ "model.layers.23.self_attn.k_proj.weight": "model-00005-of-00014.safetensors",
207
+ "model.layers.23.self_attn.o_proj.weight": "model-00005-of-00014.safetensors",
208
+ "model.layers.23.self_attn.q_proj.bias": "model-00005-of-00014.safetensors",
209
+ "model.layers.23.self_attn.q_proj.weight": "model-00005-of-00014.safetensors",
210
+ "model.layers.23.self_attn.v_proj.bias": "model-00005-of-00014.safetensors",
211
+ "model.layers.23.self_attn.v_proj.weight": "model-00005-of-00014.safetensors",
212
+ "model.layers.24.input_layernorm.weight": "model-00006-of-00014.safetensors",
213
+ "model.layers.24.mlp.down_proj.weight": "model-00006-of-00014.safetensors",
214
+ "model.layers.24.mlp.gate_proj.weight": "model-00006-of-00014.safetensors",
215
+ "model.layers.24.mlp.up_proj.weight": "model-00006-of-00014.safetensors",
216
+ "model.layers.24.post_attention_layernorm.weight": "model-00006-of-00014.safetensors",
217
+ "model.layers.24.self_attn.k_proj.bias": "model-00006-of-00014.safetensors",
218
+ "model.layers.24.self_attn.k_proj.weight": "model-00006-of-00014.safetensors",
219
+ "model.layers.24.self_attn.o_proj.weight": "model-00006-of-00014.safetensors",
220
+ "model.layers.24.self_attn.q_proj.bias": "model-00006-of-00014.safetensors",
221
+ "model.layers.24.self_attn.q_proj.weight": "model-00006-of-00014.safetensors",
222
+ "model.layers.24.self_attn.v_proj.bias": "model-00006-of-00014.safetensors",
223
+ "model.layers.24.self_attn.v_proj.weight": "model-00006-of-00014.safetensors",
224
+ "model.layers.25.input_layernorm.weight": "model-00006-of-00014.safetensors",
225
+ "model.layers.25.mlp.down_proj.weight": "model-00006-of-00014.safetensors",
226
+ "model.layers.25.mlp.gate_proj.weight": "model-00006-of-00014.safetensors",
227
+ "model.layers.25.mlp.up_proj.weight": "model-00006-of-00014.safetensors",
228
+ "model.layers.25.post_attention_layernorm.weight": "model-00006-of-00014.safetensors",
229
+ "model.layers.25.self_attn.k_proj.bias": "model-00006-of-00014.safetensors",
230
+ "model.layers.25.self_attn.k_proj.weight": "model-00006-of-00014.safetensors",
231
+ "model.layers.25.self_attn.o_proj.weight": "model-00006-of-00014.safetensors",
232
+ "model.layers.25.self_attn.q_proj.bias": "model-00006-of-00014.safetensors",
233
+ "model.layers.25.self_attn.q_proj.weight": "model-00006-of-00014.safetensors",
234
+ "model.layers.25.self_attn.v_proj.bias": "model-00006-of-00014.safetensors",
235
+ "model.layers.25.self_attn.v_proj.weight": "model-00006-of-00014.safetensors",
236
+ "model.layers.26.input_layernorm.weight": "model-00006-of-00014.safetensors",
237
+ "model.layers.26.mlp.down_proj.weight": "model-00006-of-00014.safetensors",
238
+ "model.layers.26.mlp.gate_proj.weight": "model-00006-of-00014.safetensors",
239
+ "model.layers.26.mlp.up_proj.weight": "model-00006-of-00014.safetensors",
240
+ "model.layers.26.post_attention_layernorm.weight": "model-00006-of-00014.safetensors",
241
+ "model.layers.26.self_attn.k_proj.bias": "model-00006-of-00014.safetensors",
242
+ "model.layers.26.self_attn.k_proj.weight": "model-00006-of-00014.safetensors",
243
+ "model.layers.26.self_attn.o_proj.weight": "model-00006-of-00014.safetensors",
244
+ "model.layers.26.self_attn.q_proj.bias": "model-00006-of-00014.safetensors",
245
+ "model.layers.26.self_attn.q_proj.weight": "model-00006-of-00014.safetensors",
246
+ "model.layers.26.self_attn.v_proj.bias": "model-00006-of-00014.safetensors",
247
+ "model.layers.26.self_attn.v_proj.weight": "model-00006-of-00014.safetensors",
248
+ "model.layers.27.input_layernorm.weight": "model-00006-of-00014.safetensors",
249
+ "model.layers.27.mlp.down_proj.weight": "model-00006-of-00014.safetensors",
250
+ "model.layers.27.mlp.gate_proj.weight": "model-00006-of-00014.safetensors",
251
+ "model.layers.27.mlp.up_proj.weight": "model-00006-of-00014.safetensors",
252
+ "model.layers.27.post_attention_layernorm.weight": "model-00006-of-00014.safetensors",
253
+ "model.layers.27.self_attn.k_proj.bias": "model-00006-of-00014.safetensors",
254
+ "model.layers.27.self_attn.k_proj.weight": "model-00006-of-00014.safetensors",
255
+ "model.layers.27.self_attn.o_proj.weight": "model-00006-of-00014.safetensors",
256
+ "model.layers.27.self_attn.q_proj.bias": "model-00006-of-00014.safetensors",
257
+ "model.layers.27.self_attn.q_proj.weight": "model-00006-of-00014.safetensors",
258
+ "model.layers.27.self_attn.v_proj.bias": "model-00006-of-00014.safetensors",
259
+ "model.layers.27.self_attn.v_proj.weight": "model-00006-of-00014.safetensors",
260
+ "model.layers.28.input_layernorm.weight": "model-00007-of-00014.safetensors",
261
+ "model.layers.28.mlp.down_proj.weight": "model-00007-of-00014.safetensors",
262
+ "model.layers.28.mlp.gate_proj.weight": "model-00006-of-00014.safetensors",
263
+ "model.layers.28.mlp.up_proj.weight": "model-00007-of-00014.safetensors",
264
+ "model.layers.28.post_attention_layernorm.weight": "model-00007-of-00014.safetensors",
265
+ "model.layers.28.self_attn.k_proj.bias": "model-00006-of-00014.safetensors",
266
+ "model.layers.28.self_attn.k_proj.weight": "model-00006-of-00014.safetensors",
267
+ "model.layers.28.self_attn.o_proj.weight": "model-00006-of-00014.safetensors",
268
+ "model.layers.28.self_attn.q_proj.bias": "model-00006-of-00014.safetensors",
269
+ "model.layers.28.self_attn.q_proj.weight": "model-00006-of-00014.safetensors",
270
+ "model.layers.28.self_attn.v_proj.bias": "model-00006-of-00014.safetensors",
271
+ "model.layers.28.self_attn.v_proj.weight": "model-00006-of-00014.safetensors",
272
+ "model.layers.29.input_layernorm.weight": "model-00007-of-00014.safetensors",
273
+ "model.layers.29.mlp.down_proj.weight": "model-00007-of-00014.safetensors",
274
+ "model.layers.29.mlp.gate_proj.weight": "model-00007-of-00014.safetensors",
275
+ "model.layers.29.mlp.up_proj.weight": "model-00007-of-00014.safetensors",
276
+ "model.layers.29.post_attention_layernorm.weight": "model-00007-of-00014.safetensors",
277
+ "model.layers.29.self_attn.k_proj.bias": "model-00007-of-00014.safetensors",
278
+ "model.layers.29.self_attn.k_proj.weight": "model-00007-of-00014.safetensors",
279
+ "model.layers.29.self_attn.o_proj.weight": "model-00007-of-00014.safetensors",
280
+ "model.layers.29.self_attn.q_proj.bias": "model-00007-of-00014.safetensors",
281
+ "model.layers.29.self_attn.q_proj.weight": "model-00007-of-00014.safetensors",
282
+ "model.layers.29.self_attn.v_proj.bias": "model-00007-of-00014.safetensors",
283
+ "model.layers.29.self_attn.v_proj.weight": "model-00007-of-00014.safetensors",
284
+ "model.layers.3.input_layernorm.weight": "model-00002-of-00014.safetensors",
285
+ "model.layers.3.mlp.down_proj.weight": "model-00002-of-00014.safetensors",
286
+ "model.layers.3.mlp.gate_proj.weight": "model-00001-of-00014.safetensors",
287
+ "model.layers.3.mlp.up_proj.weight": "model-00002-of-00014.safetensors",
288
+ "model.layers.3.post_attention_layernorm.weight": "model-00002-of-00014.safetensors",
289
+ "model.layers.3.self_attn.k_proj.bias": "model-00001-of-00014.safetensors",
290
+ "model.layers.3.self_attn.k_proj.weight": "model-00001-of-00014.safetensors",
291
+ "model.layers.3.self_attn.o_proj.weight": "model-00001-of-00014.safetensors",
292
+ "model.layers.3.self_attn.q_proj.bias": "model-00001-of-00014.safetensors",
293
+ "model.layers.3.self_attn.q_proj.weight": "model-00001-of-00014.safetensors",
294
+ "model.layers.3.self_attn.v_proj.bias": "model-00001-of-00014.safetensors",
295
+ "model.layers.3.self_attn.v_proj.weight": "model-00001-of-00014.safetensors",
296
+ "model.layers.30.input_layernorm.weight": "model-00007-of-00014.safetensors",
297
+ "model.layers.30.mlp.down_proj.weight": "model-00007-of-00014.safetensors",
298
+ "model.layers.30.mlp.gate_proj.weight": "model-00007-of-00014.safetensors",
299
+ "model.layers.30.mlp.up_proj.weight": "model-00007-of-00014.safetensors",
300
+ "model.layers.30.post_attention_layernorm.weight": "model-00007-of-00014.safetensors",
301
+ "model.layers.30.self_attn.k_proj.bias": "model-00007-of-00014.safetensors",
302
+ "model.layers.30.self_attn.k_proj.weight": "model-00007-of-00014.safetensors",
303
+ "model.layers.30.self_attn.o_proj.weight": "model-00007-of-00014.safetensors",
304
+ "model.layers.30.self_attn.q_proj.bias": "model-00007-of-00014.safetensors",
305
+ "model.layers.30.self_attn.q_proj.weight": "model-00007-of-00014.safetensors",
306
+ "model.layers.30.self_attn.v_proj.bias": "model-00007-of-00014.safetensors",
307
+ "model.layers.30.self_attn.v_proj.weight": "model-00007-of-00014.safetensors",
308
+ "model.layers.31.input_layernorm.weight": "model-00007-of-00014.safetensors",
309
+ "model.layers.31.mlp.down_proj.weight": "model-00007-of-00014.safetensors",
310
+ "model.layers.31.mlp.gate_proj.weight": "model-00007-of-00014.safetensors",
311
+ "model.layers.31.mlp.up_proj.weight": "model-00007-of-00014.safetensors",
312
+ "model.layers.31.post_attention_layernorm.weight": "model-00007-of-00014.safetensors",
313
+ "model.layers.31.self_attn.k_proj.bias": "model-00007-of-00014.safetensors",
314
+ "model.layers.31.self_attn.k_proj.weight": "model-00007-of-00014.safetensors",
315
+ "model.layers.31.self_attn.o_proj.weight": "model-00007-of-00014.safetensors",
316
+ "model.layers.31.self_attn.q_proj.bias": "model-00007-of-00014.safetensors",
317
+ "model.layers.31.self_attn.q_proj.weight": "model-00007-of-00014.safetensors",
318
+ "model.layers.31.self_attn.v_proj.bias": "model-00007-of-00014.safetensors",
319
+ "model.layers.31.self_attn.v_proj.weight": "model-00007-of-00014.safetensors",
320
+ "model.layers.32.input_layernorm.weight": "model-00007-of-00014.safetensors",
321
+ "model.layers.32.mlp.down_proj.weight": "model-00007-of-00014.safetensors",
322
+ "model.layers.32.mlp.gate_proj.weight": "model-00007-of-00014.safetensors",
323
+ "model.layers.32.mlp.up_proj.weight": "model-00007-of-00014.safetensors",
324
+ "model.layers.32.post_attention_layernorm.weight": "model-00007-of-00014.safetensors",
325
+ "model.layers.32.self_attn.k_proj.bias": "model-00007-of-00014.safetensors",
326
+ "model.layers.32.self_attn.k_proj.weight": "model-00007-of-00014.safetensors",
327
+ "model.layers.32.self_attn.o_proj.weight": "model-00007-of-00014.safetensors",
328
+ "model.layers.32.self_attn.q_proj.bias": "model-00007-of-00014.safetensors",
329
+ "model.layers.32.self_attn.q_proj.weight": "model-00007-of-00014.safetensors",
330
+ "model.layers.32.self_attn.v_proj.bias": "model-00007-of-00014.safetensors",
331
+ "model.layers.32.self_attn.v_proj.weight": "model-00007-of-00014.safetensors",
332
+ "model.layers.33.input_layernorm.weight": "model-00008-of-00014.safetensors",
333
+ "model.layers.33.mlp.down_proj.weight": "model-00008-of-00014.safetensors",
334
+ "model.layers.33.mlp.gate_proj.weight": "model-00007-of-00014.safetensors",
335
+ "model.layers.33.mlp.up_proj.weight": "model-00008-of-00014.safetensors",
336
+ "model.layers.33.post_attention_layernorm.weight": "model-00008-of-00014.safetensors",
337
+ "model.layers.33.self_attn.k_proj.bias": "model-00007-of-00014.safetensors",
338
+ "model.layers.33.self_attn.k_proj.weight": "model-00007-of-00014.safetensors",
339
+ "model.layers.33.self_attn.o_proj.weight": "model-00007-of-00014.safetensors",
340
+ "model.layers.33.self_attn.q_proj.bias": "model-00007-of-00014.safetensors",
341
+ "model.layers.33.self_attn.q_proj.weight": "model-00007-of-00014.safetensors",
342
+ "model.layers.33.self_attn.v_proj.bias": "model-00007-of-00014.safetensors",
343
+ "model.layers.33.self_attn.v_proj.weight": "model-00007-of-00014.safetensors",
344
+ "model.layers.34.input_layernorm.weight": "model-00008-of-00014.safetensors",
345
+ "model.layers.34.mlp.down_proj.weight": "model-00008-of-00014.safetensors",
346
+ "model.layers.34.mlp.gate_proj.weight": "model-00008-of-00014.safetensors",
347
+ "model.layers.34.mlp.up_proj.weight": "model-00008-of-00014.safetensors",
348
+ "model.layers.34.post_attention_layernorm.weight": "model-00008-of-00014.safetensors",
349
+ "model.layers.34.self_attn.k_proj.bias": "model-00008-of-00014.safetensors",
350
+ "model.layers.34.self_attn.k_proj.weight": "model-00008-of-00014.safetensors",
351
+ "model.layers.34.self_attn.o_proj.weight": "model-00008-of-00014.safetensors",
352
+ "model.layers.34.self_attn.q_proj.bias": "model-00008-of-00014.safetensors",
353
+ "model.layers.34.self_attn.q_proj.weight": "model-00008-of-00014.safetensors",
354
+ "model.layers.34.self_attn.v_proj.bias": "model-00008-of-00014.safetensors",
355
+ "model.layers.34.self_attn.v_proj.weight": "model-00008-of-00014.safetensors",
356
+ "model.layers.35.input_layernorm.weight": "model-00008-of-00014.safetensors",
357
+ "model.layers.35.mlp.down_proj.weight": "model-00008-of-00014.safetensors",
358
+ "model.layers.35.mlp.gate_proj.weight": "model-00008-of-00014.safetensors",
359
+ "model.layers.35.mlp.up_proj.weight": "model-00008-of-00014.safetensors",
360
+ "model.layers.35.post_attention_layernorm.weight": "model-00008-of-00014.safetensors",
361
+ "model.layers.35.self_attn.k_proj.bias": "model-00008-of-00014.safetensors",
362
+ "model.layers.35.self_attn.k_proj.weight": "model-00008-of-00014.safetensors",
363
+ "model.layers.35.self_attn.o_proj.weight": "model-00008-of-00014.safetensors",
364
+ "model.layers.35.self_attn.q_proj.bias": "model-00008-of-00014.safetensors",
365
+ "model.layers.35.self_attn.q_proj.weight": "model-00008-of-00014.safetensors",
366
+ "model.layers.35.self_attn.v_proj.bias": "model-00008-of-00014.safetensors",
367
+ "model.layers.35.self_attn.v_proj.weight": "model-00008-of-00014.safetensors",
368
+ "model.layers.36.input_layernorm.weight": "model-00008-of-00014.safetensors",
369
+ "model.layers.36.mlp.down_proj.weight": "model-00008-of-00014.safetensors",
370
+ "model.layers.36.mlp.gate_proj.weight": "model-00008-of-00014.safetensors",
371
+ "model.layers.36.mlp.up_proj.weight": "model-00008-of-00014.safetensors",
372
+ "model.layers.36.post_attention_layernorm.weight": "model-00008-of-00014.safetensors",
373
+ "model.layers.36.self_attn.k_proj.bias": "model-00008-of-00014.safetensors",
374
+ "model.layers.36.self_attn.k_proj.weight": "model-00008-of-00014.safetensors",
375
+ "model.layers.36.self_attn.o_proj.weight": "model-00008-of-00014.safetensors",
376
+ "model.layers.36.self_attn.q_proj.bias": "model-00008-of-00014.safetensors",
377
+ "model.layers.36.self_attn.q_proj.weight": "model-00008-of-00014.safetensors",
378
+ "model.layers.36.self_attn.v_proj.bias": "model-00008-of-00014.safetensors",
379
+ "model.layers.36.self_attn.v_proj.weight": "model-00008-of-00014.safetensors",
380
+ "model.layers.37.input_layernorm.weight": "model-00008-of-00014.safetensors",
381
+ "model.layers.37.mlp.down_proj.weight": "model-00008-of-00014.safetensors",
382
+ "model.layers.37.mlp.gate_proj.weight": "model-00008-of-00014.safetensors",
383
+ "model.layers.37.mlp.up_proj.weight": "model-00008-of-00014.safetensors",
384
+ "model.layers.37.post_attention_layernorm.weight": "model-00008-of-00014.safetensors",
385
+ "model.layers.37.self_attn.k_proj.bias": "model-00008-of-00014.safetensors",
386
+ "model.layers.37.self_attn.k_proj.weight": "model-00008-of-00014.safetensors",
387
+ "model.layers.37.self_attn.o_proj.weight": "model-00008-of-00014.safetensors",
388
+ "model.layers.37.self_attn.q_proj.bias": "model-00008-of-00014.safetensors",
389
+ "model.layers.37.self_attn.q_proj.weight": "model-00008-of-00014.safetensors",
390
+ "model.layers.37.self_attn.v_proj.bias": "model-00008-of-00014.safetensors",
391
+ "model.layers.37.self_attn.v_proj.weight": "model-00008-of-00014.safetensors",
392
+ "model.layers.38.input_layernorm.weight": "model-00009-of-00014.safetensors",
393
+ "model.layers.38.mlp.down_proj.weight": "model-00009-of-00014.safetensors",
394
+ "model.layers.38.mlp.gate_proj.weight": "model-00008-of-00014.safetensors",
395
+ "model.layers.38.mlp.up_proj.weight": "model-00009-of-00014.safetensors",
396
+ "model.layers.38.post_attention_layernorm.weight": "model-00009-of-00014.safetensors",
397
+ "model.layers.38.self_attn.k_proj.bias": "model-00008-of-00014.safetensors",
398
+ "model.layers.38.self_attn.k_proj.weight": "model-00008-of-00014.safetensors",
399
+ "model.layers.38.self_attn.o_proj.weight": "model-00008-of-00014.safetensors",
400
+ "model.layers.38.self_attn.q_proj.bias": "model-00008-of-00014.safetensors",
401
+ "model.layers.38.self_attn.q_proj.weight": "model-00008-of-00014.safetensors",
402
+ "model.layers.38.self_attn.v_proj.bias": "model-00008-of-00014.safetensors",
403
+ "model.layers.38.self_attn.v_proj.weight": "model-00008-of-00014.safetensors",
404
+ "model.layers.39.input_layernorm.weight": "model-00009-of-00014.safetensors",
405
+ "model.layers.39.mlp.down_proj.weight": "model-00009-of-00014.safetensors",
406
+ "model.layers.39.mlp.gate_proj.weight": "model-00009-of-00014.safetensors",
407
+ "model.layers.39.mlp.up_proj.weight": "model-00009-of-00014.safetensors",
408
+ "model.layers.39.post_attention_layernorm.weight": "model-00009-of-00014.safetensors",
409
+ "model.layers.39.self_attn.k_proj.bias": "model-00009-of-00014.safetensors",
410
+ "model.layers.39.self_attn.k_proj.weight": "model-00009-of-00014.safetensors",
411
+ "model.layers.39.self_attn.o_proj.weight": "model-00009-of-00014.safetensors",
412
+ "model.layers.39.self_attn.q_proj.bias": "model-00009-of-00014.safetensors",
413
+ "model.layers.39.self_attn.q_proj.weight": "model-00009-of-00014.safetensors",
414
+ "model.layers.39.self_attn.v_proj.bias": "model-00009-of-00014.safetensors",
415
+ "model.layers.39.self_attn.v_proj.weight": "model-00009-of-00014.safetensors",
416
+ "model.layers.4.input_layernorm.weight": "model-00002-of-00014.safetensors",
417
+ "model.layers.4.mlp.down_proj.weight": "model-00002-of-00014.safetensors",
418
+ "model.layers.4.mlp.gate_proj.weight": "model-00002-of-00014.safetensors",
419
+ "model.layers.4.mlp.up_proj.weight": "model-00002-of-00014.safetensors",
420
+ "model.layers.4.post_attention_layernorm.weight": "model-00002-of-00014.safetensors",
421
+ "model.layers.4.self_attn.k_proj.bias": "model-00002-of-00014.safetensors",
422
+ "model.layers.4.self_attn.k_proj.weight": "model-00002-of-00014.safetensors",
423
+ "model.layers.4.self_attn.o_proj.weight": "model-00002-of-00014.safetensors",
424
+ "model.layers.4.self_attn.q_proj.bias": "model-00002-of-00014.safetensors",
425
+ "model.layers.4.self_attn.q_proj.weight": "model-00002-of-00014.safetensors",
426
+ "model.layers.4.self_attn.v_proj.bias": "model-00002-of-00014.safetensors",
427
+ "model.layers.4.self_attn.v_proj.weight": "model-00002-of-00014.safetensors",
428
+ "model.layers.40.input_layernorm.weight": "model-00009-of-00014.safetensors",
429
+ "model.layers.40.mlp.down_proj.weight": "model-00009-of-00014.safetensors",
430
+ "model.layers.40.mlp.gate_proj.weight": "model-00009-of-00014.safetensors",
431
+ "model.layers.40.mlp.up_proj.weight": "model-00009-of-00014.safetensors",
432
+ "model.layers.40.post_attention_layernorm.weight": "model-00009-of-00014.safetensors",
433
+ "model.layers.40.self_attn.k_proj.bias": "model-00009-of-00014.safetensors",
434
+ "model.layers.40.self_attn.k_proj.weight": "model-00009-of-00014.safetensors",
435
+ "model.layers.40.self_attn.o_proj.weight": "model-00009-of-00014.safetensors",
436
+ "model.layers.40.self_attn.q_proj.bias": "model-00009-of-00014.safetensors",
437
+ "model.layers.40.self_attn.q_proj.weight": "model-00009-of-00014.safetensors",
438
+ "model.layers.40.self_attn.v_proj.bias": "model-00009-of-00014.safetensors",
439
+ "model.layers.40.self_attn.v_proj.weight": "model-00009-of-00014.safetensors",
440
+ "model.layers.41.input_layernorm.weight": "model-00009-of-00014.safetensors",
441
+ "model.layers.41.mlp.down_proj.weight": "model-00009-of-00014.safetensors",
442
+ "model.layers.41.mlp.gate_proj.weight": "model-00009-of-00014.safetensors",
443
+ "model.layers.41.mlp.up_proj.weight": "model-00009-of-00014.safetensors",
444
+ "model.layers.41.post_attention_layernorm.weight": "model-00009-of-00014.safetensors",
445
+ "model.layers.41.self_attn.k_proj.bias": "model-00009-of-00014.safetensors",
446
+ "model.layers.41.self_attn.k_proj.weight": "model-00009-of-00014.safetensors",
447
+ "model.layers.41.self_attn.o_proj.weight": "model-00009-of-00014.safetensors",
448
+ "model.layers.41.self_attn.q_proj.bias": "model-00009-of-00014.safetensors",
449
+ "model.layers.41.self_attn.q_proj.weight": "model-00009-of-00014.safetensors",
450
+ "model.layers.41.self_attn.v_proj.bias": "model-00009-of-00014.safetensors",
451
+ "model.layers.41.self_attn.v_proj.weight": "model-00009-of-00014.safetensors",
452
+ "model.layers.42.input_layernorm.weight": "model-00009-of-00014.safetensors",
453
+ "model.layers.42.mlp.down_proj.weight": "model-00009-of-00014.safetensors",
454
+ "model.layers.42.mlp.gate_proj.weight": "model-00009-of-00014.safetensors",
455
+ "model.layers.42.mlp.up_proj.weight": "model-00009-of-00014.safetensors",
456
+ "model.layers.42.post_attention_layernorm.weight": "model-00009-of-00014.safetensors",
457
+ "model.layers.42.self_attn.k_proj.bias": "model-00009-of-00014.safetensors",
458
+ "model.layers.42.self_attn.k_proj.weight": "model-00009-of-00014.safetensors",
459
+ "model.layers.42.self_attn.o_proj.weight": "model-00009-of-00014.safetensors",
460
+ "model.layers.42.self_attn.q_proj.bias": "model-00009-of-00014.safetensors",
461
+ "model.layers.42.self_attn.q_proj.weight": "model-00009-of-00014.safetensors",
462
+ "model.layers.42.self_attn.v_proj.bias": "model-00009-of-00014.safetensors",
463
+ "model.layers.42.self_attn.v_proj.weight": "model-00009-of-00014.safetensors",
464
+ "model.layers.43.input_layernorm.weight": "model-00010-of-00014.safetensors",
465
+ "model.layers.43.mlp.down_proj.weight": "model-00010-of-00014.safetensors",
466
+ "model.layers.43.mlp.gate_proj.weight": "model-00009-of-00014.safetensors",
467
+ "model.layers.43.mlp.up_proj.weight": "model-00010-of-00014.safetensors",
468
+ "model.layers.43.post_attention_layernorm.weight": "model-00010-of-00014.safetensors",
469
+ "model.layers.43.self_attn.k_proj.bias": "model-00009-of-00014.safetensors",
470
+ "model.layers.43.self_attn.k_proj.weight": "model-00009-of-00014.safetensors",
471
+ "model.layers.43.self_attn.o_proj.weight": "model-00009-of-00014.safetensors",
472
+ "model.layers.43.self_attn.q_proj.bias": "model-00009-of-00014.safetensors",
473
+ "model.layers.43.self_attn.q_proj.weight": "model-00009-of-00014.safetensors",
474
+ "model.layers.43.self_attn.v_proj.bias": "model-00009-of-00014.safetensors",
475
+ "model.layers.43.self_attn.v_proj.weight": "model-00009-of-00014.safetensors",
476
+ "model.layers.44.input_layernorm.weight": "model-00010-of-00014.safetensors",
477
+ "model.layers.44.mlp.down_proj.weight": "model-00010-of-00014.safetensors",
478
+ "model.layers.44.mlp.gate_proj.weight": "model-00010-of-00014.safetensors",
479
+ "model.layers.44.mlp.up_proj.weight": "model-00010-of-00014.safetensors",
480
+ "model.layers.44.post_attention_layernorm.weight": "model-00010-of-00014.safetensors",
481
+ "model.layers.44.self_attn.k_proj.bias": "model-00010-of-00014.safetensors",
482
+ "model.layers.44.self_attn.k_proj.weight": "model-00010-of-00014.safetensors",
483
+ "model.layers.44.self_attn.o_proj.weight": "model-00010-of-00014.safetensors",
484
+ "model.layers.44.self_attn.q_proj.bias": "model-00010-of-00014.safetensors",
485
+ "model.layers.44.self_attn.q_proj.weight": "model-00010-of-00014.safetensors",
486
+ "model.layers.44.self_attn.v_proj.bias": "model-00010-of-00014.safetensors",
487
+ "model.layers.44.self_attn.v_proj.weight": "model-00010-of-00014.safetensors",
488
+ "model.layers.45.input_layernorm.weight": "model-00010-of-00014.safetensors",
489
+ "model.layers.45.mlp.down_proj.weight": "model-00010-of-00014.safetensors",
490
+ "model.layers.45.mlp.gate_proj.weight": "model-00010-of-00014.safetensors",
491
+ "model.layers.45.mlp.up_proj.weight": "model-00010-of-00014.safetensors",
492
+ "model.layers.45.post_attention_layernorm.weight": "model-00010-of-00014.safetensors",
493
+ "model.layers.45.self_attn.k_proj.bias": "model-00010-of-00014.safetensors",
494
+ "model.layers.45.self_attn.k_proj.weight": "model-00010-of-00014.safetensors",
495
+ "model.layers.45.self_attn.o_proj.weight": "model-00010-of-00014.safetensors",
496
+ "model.layers.45.self_attn.q_proj.bias": "model-00010-of-00014.safetensors",
497
+ "model.layers.45.self_attn.q_proj.weight": "model-00010-of-00014.safetensors",
498
+ "model.layers.45.self_attn.v_proj.bias": "model-00010-of-00014.safetensors",
499
+ "model.layers.45.self_attn.v_proj.weight": "model-00010-of-00014.safetensors",
500
+ "model.layers.46.input_layernorm.weight": "model-00010-of-00014.safetensors",
501
+ "model.layers.46.mlp.down_proj.weight": "model-00010-of-00014.safetensors",
502
+ "model.layers.46.mlp.gate_proj.weight": "model-00010-of-00014.safetensors",
503
+ "model.layers.46.mlp.up_proj.weight": "model-00010-of-00014.safetensors",
504
+ "model.layers.46.post_attention_layernorm.weight": "model-00010-of-00014.safetensors",
505
+ "model.layers.46.self_attn.k_proj.bias": "model-00010-of-00014.safetensors",
506
+ "model.layers.46.self_attn.k_proj.weight": "model-00010-of-00014.safetensors",
507
+ "model.layers.46.self_attn.o_proj.weight": "model-00010-of-00014.safetensors",
508
+ "model.layers.46.self_attn.q_proj.bias": "model-00010-of-00014.safetensors",
509
+ "model.layers.46.self_attn.q_proj.weight": "model-00010-of-00014.safetensors",
510
+ "model.layers.46.self_attn.v_proj.bias": "model-00010-of-00014.safetensors",
511
+ "model.layers.46.self_attn.v_proj.weight": "model-00010-of-00014.safetensors",
512
+ "model.layers.47.input_layernorm.weight": "model-00010-of-00014.safetensors",
513
+ "model.layers.47.mlp.down_proj.weight": "model-00010-of-00014.safetensors",
514
+ "model.layers.47.mlp.gate_proj.weight": "model-00010-of-00014.safetensors",
515
+ "model.layers.47.mlp.up_proj.weight": "model-00010-of-00014.safetensors",
516
+ "model.layers.47.post_attention_layernorm.weight": "model-00010-of-00014.safetensors",
517
+ "model.layers.47.self_attn.k_proj.bias": "model-00010-of-00014.safetensors",
518
+ "model.layers.47.self_attn.k_proj.weight": "model-00010-of-00014.safetensors",
519
+ "model.layers.47.self_attn.o_proj.weight": "model-00010-of-00014.safetensors",
520
+ "model.layers.47.self_attn.q_proj.bias": "model-00010-of-00014.safetensors",
521
+ "model.layers.47.self_attn.q_proj.weight": "model-00010-of-00014.safetensors",
522
+ "model.layers.47.self_attn.v_proj.bias": "model-00010-of-00014.safetensors",
523
+ "model.layers.47.self_attn.v_proj.weight": "model-00010-of-00014.safetensors",
524
+ "model.layers.48.input_layernorm.weight": "model-00011-of-00014.safetensors",
525
+ "model.layers.48.mlp.down_proj.weight": "model-00011-of-00014.safetensors",
526
+ "model.layers.48.mlp.gate_proj.weight": "model-00010-of-00014.safetensors",
527
+ "model.layers.48.mlp.up_proj.weight": "model-00011-of-00014.safetensors",
528
+ "model.layers.48.post_attention_layernorm.weight": "model-00011-of-00014.safetensors",
529
+ "model.layers.48.self_attn.k_proj.bias": "model-00010-of-00014.safetensors",
530
+ "model.layers.48.self_attn.k_proj.weight": "model-00010-of-00014.safetensors",
531
+ "model.layers.48.self_attn.o_proj.weight": "model-00010-of-00014.safetensors",
532
+ "model.layers.48.self_attn.q_proj.bias": "model-00010-of-00014.safetensors",
533
+ "model.layers.48.self_attn.q_proj.weight": "model-00010-of-00014.safetensors",
534
+ "model.layers.48.self_attn.v_proj.bias": "model-00010-of-00014.safetensors",
535
+ "model.layers.48.self_attn.v_proj.weight": "model-00010-of-00014.safetensors",
536
+ "model.layers.49.input_layernorm.weight": "model-00011-of-00014.safetensors",
537
+ "model.layers.49.mlp.down_proj.weight": "model-00011-of-00014.safetensors",
538
+ "model.layers.49.mlp.gate_proj.weight": "model-00011-of-00014.safetensors",
539
+ "model.layers.49.mlp.up_proj.weight": "model-00011-of-00014.safetensors",
540
+ "model.layers.49.post_attention_layernorm.weight": "model-00011-of-00014.safetensors",
541
+ "model.layers.49.self_attn.k_proj.bias": "model-00011-of-00014.safetensors",
542
+ "model.layers.49.self_attn.k_proj.weight": "model-00011-of-00014.safetensors",
543
+ "model.layers.49.self_attn.o_proj.weight": "model-00011-of-00014.safetensors",
544
+ "model.layers.49.self_attn.q_proj.bias": "model-00011-of-00014.safetensors",
545
+ "model.layers.49.self_attn.q_proj.weight": "model-00011-of-00014.safetensors",
546
+ "model.layers.49.self_attn.v_proj.bias": "model-00011-of-00014.safetensors",
547
+ "model.layers.49.self_attn.v_proj.weight": "model-00011-of-00014.safetensors",
548
+ "model.layers.5.input_layernorm.weight": "model-00002-of-00014.safetensors",
549
+ "model.layers.5.mlp.down_proj.weight": "model-00002-of-00014.safetensors",
550
+ "model.layers.5.mlp.gate_proj.weight": "model-00002-of-00014.safetensors",
551
+ "model.layers.5.mlp.up_proj.weight": "model-00002-of-00014.safetensors",
552
+ "model.layers.5.post_attention_layernorm.weight": "model-00002-of-00014.safetensors",
553
+ "model.layers.5.self_attn.k_proj.bias": "model-00002-of-00014.safetensors",
554
+ "model.layers.5.self_attn.k_proj.weight": "model-00002-of-00014.safetensors",
555
+ "model.layers.5.self_attn.o_proj.weight": "model-00002-of-00014.safetensors",
556
+ "model.layers.5.self_attn.q_proj.bias": "model-00002-of-00014.safetensors",
557
+ "model.layers.5.self_attn.q_proj.weight": "model-00002-of-00014.safetensors",
558
+ "model.layers.5.self_attn.v_proj.bias": "model-00002-of-00014.safetensors",
559
+ "model.layers.5.self_attn.v_proj.weight": "model-00002-of-00014.safetensors",
560
+ "model.layers.50.input_layernorm.weight": "model-00011-of-00014.safetensors",
561
+ "model.layers.50.mlp.down_proj.weight": "model-00011-of-00014.safetensors",
562
+ "model.layers.50.mlp.gate_proj.weight": "model-00011-of-00014.safetensors",
563
+ "model.layers.50.mlp.up_proj.weight": "model-00011-of-00014.safetensors",
564
+ "model.layers.50.post_attention_layernorm.weight": "model-00011-of-00014.safetensors",
565
+ "model.layers.50.self_attn.k_proj.bias": "model-00011-of-00014.safetensors",
566
+ "model.layers.50.self_attn.k_proj.weight": "model-00011-of-00014.safetensors",
567
+ "model.layers.50.self_attn.o_proj.weight": "model-00011-of-00014.safetensors",
568
+ "model.layers.50.self_attn.q_proj.bias": "model-00011-of-00014.safetensors",
569
+ "model.layers.50.self_attn.q_proj.weight": "model-00011-of-00014.safetensors",
570
+ "model.layers.50.self_attn.v_proj.bias": "model-00011-of-00014.safetensors",
571
+ "model.layers.50.self_attn.v_proj.weight": "model-00011-of-00014.safetensors",
572
+ "model.layers.51.input_layernorm.weight": "model-00011-of-00014.safetensors",
573
+ "model.layers.51.mlp.down_proj.weight": "model-00011-of-00014.safetensors",
574
+ "model.layers.51.mlp.gate_proj.weight": "model-00011-of-00014.safetensors",
575
+ "model.layers.51.mlp.up_proj.weight": "model-00011-of-00014.safetensors",
576
+ "model.layers.51.post_attention_layernorm.weight": "model-00011-of-00014.safetensors",
577
+ "model.layers.51.self_attn.k_proj.bias": "model-00011-of-00014.safetensors",
578
+ "model.layers.51.self_attn.k_proj.weight": "model-00011-of-00014.safetensors",
579
+ "model.layers.51.self_attn.o_proj.weight": "model-00011-of-00014.safetensors",
580
+ "model.layers.51.self_attn.q_proj.bias": "model-00011-of-00014.safetensors",
581
+ "model.layers.51.self_attn.q_proj.weight": "model-00011-of-00014.safetensors",
582
+ "model.layers.51.self_attn.v_proj.bias": "model-00011-of-00014.safetensors",
583
+ "model.layers.51.self_attn.v_proj.weight": "model-00011-of-00014.safetensors",
584
+ "model.layers.52.input_layernorm.weight": "model-00011-of-00014.safetensors",
585
+ "model.layers.52.mlp.down_proj.weight": "model-00011-of-00014.safetensors",
586
+ "model.layers.52.mlp.gate_proj.weight": "model-00011-of-00014.safetensors",
587
+ "model.layers.52.mlp.up_proj.weight": "model-00011-of-00014.safetensors",
588
+ "model.layers.52.post_attention_layernorm.weight": "model-00011-of-00014.safetensors",
589
+ "model.layers.52.self_attn.k_proj.bias": "model-00011-of-00014.safetensors",
590
+ "model.layers.52.self_attn.k_proj.weight": "model-00011-of-00014.safetensors",
591
+ "model.layers.52.self_attn.o_proj.weight": "model-00011-of-00014.safetensors",
592
+ "model.layers.52.self_attn.q_proj.bias": "model-00011-of-00014.safetensors",
593
+ "model.layers.52.self_attn.q_proj.weight": "model-00011-of-00014.safetensors",
594
+ "model.layers.52.self_attn.v_proj.bias": "model-00011-of-00014.safetensors",
595
+ "model.layers.52.self_attn.v_proj.weight": "model-00011-of-00014.safetensors",
596
+ "model.layers.53.input_layernorm.weight": "model-00012-of-00014.safetensors",
597
+ "model.layers.53.mlp.down_proj.weight": "model-00012-of-00014.safetensors",
598
+ "model.layers.53.mlp.gate_proj.weight": "model-00011-of-00014.safetensors",
599
+ "model.layers.53.mlp.up_proj.weight": "model-00012-of-00014.safetensors",
600
+ "model.layers.53.post_attention_layernorm.weight": "model-00012-of-00014.safetensors",
601
+ "model.layers.53.self_attn.k_proj.bias": "model-00011-of-00014.safetensors",
602
+ "model.layers.53.self_attn.k_proj.weight": "model-00011-of-00014.safetensors",
603
+ "model.layers.53.self_attn.o_proj.weight": "model-00011-of-00014.safetensors",
604
+ "model.layers.53.self_attn.q_proj.bias": "model-00011-of-00014.safetensors",
605
+ "model.layers.53.self_attn.q_proj.weight": "model-00011-of-00014.safetensors",
606
+ "model.layers.53.self_attn.v_proj.bias": "model-00011-of-00014.safetensors",
607
+ "model.layers.53.self_attn.v_proj.weight": "model-00011-of-00014.safetensors",
608
+ "model.layers.54.input_layernorm.weight": "model-00012-of-00014.safetensors",
609
+ "model.layers.54.mlp.down_proj.weight": "model-00012-of-00014.safetensors",
610
+ "model.layers.54.mlp.gate_proj.weight": "model-00012-of-00014.safetensors",
611
+ "model.layers.54.mlp.up_proj.weight": "model-00012-of-00014.safetensors",
612
+ "model.layers.54.post_attention_layernorm.weight": "model-00012-of-00014.safetensors",
613
+ "model.layers.54.self_attn.k_proj.bias": "model-00012-of-00014.safetensors",
614
+ "model.layers.54.self_attn.k_proj.weight": "model-00012-of-00014.safetensors",
615
+ "model.layers.54.self_attn.o_proj.weight": "model-00012-of-00014.safetensors",
616
+ "model.layers.54.self_attn.q_proj.bias": "model-00012-of-00014.safetensors",
617
+ "model.layers.54.self_attn.q_proj.weight": "model-00012-of-00014.safetensors",
618
+ "model.layers.54.self_attn.v_proj.bias": "model-00012-of-00014.safetensors",
619
+ "model.layers.54.self_attn.v_proj.weight": "model-00012-of-00014.safetensors",
620
+ "model.layers.55.input_layernorm.weight": "model-00012-of-00014.safetensors",
621
+ "model.layers.55.mlp.down_proj.weight": "model-00012-of-00014.safetensors",
622
+ "model.layers.55.mlp.gate_proj.weight": "model-00012-of-00014.safetensors",
623
+ "model.layers.55.mlp.up_proj.weight": "model-00012-of-00014.safetensors",
624
+ "model.layers.55.post_attention_layernorm.weight": "model-00012-of-00014.safetensors",
625
+ "model.layers.55.self_attn.k_proj.bias": "model-00012-of-00014.safetensors",
626
+ "model.layers.55.self_attn.k_proj.weight": "model-00012-of-00014.safetensors",
627
+ "model.layers.55.self_attn.o_proj.weight": "model-00012-of-00014.safetensors",
628
+ "model.layers.55.self_attn.q_proj.bias": "model-00012-of-00014.safetensors",
629
+ "model.layers.55.self_attn.q_proj.weight": "model-00012-of-00014.safetensors",
630
+ "model.layers.55.self_attn.v_proj.bias": "model-00012-of-00014.safetensors",
631
+ "model.layers.55.self_attn.v_proj.weight": "model-00012-of-00014.safetensors",
632
+ "model.layers.56.input_layernorm.weight": "model-00012-of-00014.safetensors",
633
+ "model.layers.56.mlp.down_proj.weight": "model-00012-of-00014.safetensors",
634
+ "model.layers.56.mlp.gate_proj.weight": "model-00012-of-00014.safetensors",
635
+ "model.layers.56.mlp.up_proj.weight": "model-00012-of-00014.safetensors",
636
+ "model.layers.56.post_attention_layernorm.weight": "model-00012-of-00014.safetensors",
637
+ "model.layers.56.self_attn.k_proj.bias": "model-00012-of-00014.safetensors",
638
+ "model.layers.56.self_attn.k_proj.weight": "model-00012-of-00014.safetensors",
639
+ "model.layers.56.self_attn.o_proj.weight": "model-00012-of-00014.safetensors",
640
+ "model.layers.56.self_attn.q_proj.bias": "model-00012-of-00014.safetensors",
641
+ "model.layers.56.self_attn.q_proj.weight": "model-00012-of-00014.safetensors",
642
+ "model.layers.56.self_attn.v_proj.bias": "model-00012-of-00014.safetensors",
643
+ "model.layers.56.self_attn.v_proj.weight": "model-00012-of-00014.safetensors",
644
+ "model.layers.57.input_layernorm.weight": "model-00012-of-00014.safetensors",
645
+ "model.layers.57.mlp.down_proj.weight": "model-00012-of-00014.safetensors",
646
+ "model.layers.57.mlp.gate_proj.weight": "model-00012-of-00014.safetensors",
647
+ "model.layers.57.mlp.up_proj.weight": "model-00012-of-00014.safetensors",
648
+ "model.layers.57.post_attention_layernorm.weight": "model-00012-of-00014.safetensors",
649
+ "model.layers.57.self_attn.k_proj.bias": "model-00012-of-00014.safetensors",
650
+ "model.layers.57.self_attn.k_proj.weight": "model-00012-of-00014.safetensors",
651
+ "model.layers.57.self_attn.o_proj.weight": "model-00012-of-00014.safetensors",
652
+ "model.layers.57.self_attn.q_proj.bias": "model-00012-of-00014.safetensors",
653
+ "model.layers.57.self_attn.q_proj.weight": "model-00012-of-00014.safetensors",
654
+ "model.layers.57.self_attn.v_proj.bias": "model-00012-of-00014.safetensors",
655
+ "model.layers.57.self_attn.v_proj.weight": "model-00012-of-00014.safetensors",
656
+ "model.layers.58.input_layernorm.weight": "model-00013-of-00014.safetensors",
657
+ "model.layers.58.mlp.down_proj.weight": "model-00013-of-00014.safetensors",
658
+ "model.layers.58.mlp.gate_proj.weight": "model-00012-of-00014.safetensors",
659
+ "model.layers.58.mlp.up_proj.weight": "model-00013-of-00014.safetensors",
660
+ "model.layers.58.post_attention_layernorm.weight": "model-00013-of-00014.safetensors",
661
+ "model.layers.58.self_attn.k_proj.bias": "model-00012-of-00014.safetensors",
662
+ "model.layers.58.self_attn.k_proj.weight": "model-00012-of-00014.safetensors",
663
+ "model.layers.58.self_attn.o_proj.weight": "model-00012-of-00014.safetensors",
664
+ "model.layers.58.self_attn.q_proj.bias": "model-00012-of-00014.safetensors",
665
+ "model.layers.58.self_attn.q_proj.weight": "model-00012-of-00014.safetensors",
666
+ "model.layers.58.self_attn.v_proj.bias": "model-00012-of-00014.safetensors",
667
+ "model.layers.58.self_attn.v_proj.weight": "model-00012-of-00014.safetensors",
668
+ "model.layers.59.input_layernorm.weight": "model-00013-of-00014.safetensors",
669
+ "model.layers.59.mlp.down_proj.weight": "model-00013-of-00014.safetensors",
670
+ "model.layers.59.mlp.gate_proj.weight": "model-00013-of-00014.safetensors",
671
+ "model.layers.59.mlp.up_proj.weight": "model-00013-of-00014.safetensors",
672
+ "model.layers.59.post_attention_layernorm.weight": "model-00013-of-00014.safetensors",
673
+ "model.layers.59.self_attn.k_proj.bias": "model-00013-of-00014.safetensors",
674
+ "model.layers.59.self_attn.k_proj.weight": "model-00013-of-00014.safetensors",
675
+ "model.layers.59.self_attn.o_proj.weight": "model-00013-of-00014.safetensors",
676
+ "model.layers.59.self_attn.q_proj.bias": "model-00013-of-00014.safetensors",
677
+ "model.layers.59.self_attn.q_proj.weight": "model-00013-of-00014.safetensors",
678
+ "model.layers.59.self_attn.v_proj.bias": "model-00013-of-00014.safetensors",
679
+ "model.layers.59.self_attn.v_proj.weight": "model-00013-of-00014.safetensors",
680
+ "model.layers.6.input_layernorm.weight": "model-00002-of-00014.safetensors",
681
+ "model.layers.6.mlp.down_proj.weight": "model-00002-of-00014.safetensors",
682
+ "model.layers.6.mlp.gate_proj.weight": "model-00002-of-00014.safetensors",
683
+ "model.layers.6.mlp.up_proj.weight": "model-00002-of-00014.safetensors",
684
+ "model.layers.6.post_attention_layernorm.weight": "model-00002-of-00014.safetensors",
685
+ "model.layers.6.self_attn.k_proj.bias": "model-00002-of-00014.safetensors",
686
+ "model.layers.6.self_attn.k_proj.weight": "model-00002-of-00014.safetensors",
687
+ "model.layers.6.self_attn.o_proj.weight": "model-00002-of-00014.safetensors",
688
+ "model.layers.6.self_attn.q_proj.bias": "model-00002-of-00014.safetensors",
689
+ "model.layers.6.self_attn.q_proj.weight": "model-00002-of-00014.safetensors",
690
+ "model.layers.6.self_attn.v_proj.bias": "model-00002-of-00014.safetensors",
691
+ "model.layers.6.self_attn.v_proj.weight": "model-00002-of-00014.safetensors",
692
+ "model.layers.60.input_layernorm.weight": "model-00013-of-00014.safetensors",
693
+ "model.layers.60.mlp.down_proj.weight": "model-00013-of-00014.safetensors",
694
+ "model.layers.60.mlp.gate_proj.weight": "model-00013-of-00014.safetensors",
695
+ "model.layers.60.mlp.up_proj.weight": "model-00013-of-00014.safetensors",
696
+ "model.layers.60.post_attention_layernorm.weight": "model-00013-of-00014.safetensors",
697
+ "model.layers.60.self_attn.k_proj.bias": "model-00013-of-00014.safetensors",
698
+ "model.layers.60.self_attn.k_proj.weight": "model-00013-of-00014.safetensors",
699
+ "model.layers.60.self_attn.o_proj.weight": "model-00013-of-00014.safetensors",
700
+ "model.layers.60.self_attn.q_proj.bias": "model-00013-of-00014.safetensors",
701
+ "model.layers.60.self_attn.q_proj.weight": "model-00013-of-00014.safetensors",
702
+ "model.layers.60.self_attn.v_proj.bias": "model-00013-of-00014.safetensors",
703
+ "model.layers.60.self_attn.v_proj.weight": "model-00013-of-00014.safetensors",
704
+ "model.layers.61.input_layernorm.weight": "model-00013-of-00014.safetensors",
705
+ "model.layers.61.mlp.down_proj.weight": "model-00013-of-00014.safetensors",
706
+ "model.layers.61.mlp.gate_proj.weight": "model-00013-of-00014.safetensors",
707
+ "model.layers.61.mlp.up_proj.weight": "model-00013-of-00014.safetensors",
708
+ "model.layers.61.post_attention_layernorm.weight": "model-00013-of-00014.safetensors",
709
+ "model.layers.61.self_attn.k_proj.bias": "model-00013-of-00014.safetensors",
710
+ "model.layers.61.self_attn.k_proj.weight": "model-00013-of-00014.safetensors",
711
+ "model.layers.61.self_attn.o_proj.weight": "model-00013-of-00014.safetensors",
712
+ "model.layers.61.self_attn.q_proj.bias": "model-00013-of-00014.safetensors",
713
+ "model.layers.61.self_attn.q_proj.weight": "model-00013-of-00014.safetensors",
714
+ "model.layers.61.self_attn.v_proj.bias": "model-00013-of-00014.safetensors",
715
+ "model.layers.61.self_attn.v_proj.weight": "model-00013-of-00014.safetensors",
716
+ "model.layers.62.input_layernorm.weight": "model-00013-of-00014.safetensors",
717
+ "model.layers.62.mlp.down_proj.weight": "model-00013-of-00014.safetensors",
718
+ "model.layers.62.mlp.gate_proj.weight": "model-00013-of-00014.safetensors",
719
+ "model.layers.62.mlp.up_proj.weight": "model-00013-of-00014.safetensors",
720
+ "model.layers.62.post_attention_layernorm.weight": "model-00013-of-00014.safetensors",
721
+ "model.layers.62.self_attn.k_proj.bias": "model-00013-of-00014.safetensors",
722
+ "model.layers.62.self_attn.k_proj.weight": "model-00013-of-00014.safetensors",
723
+ "model.layers.62.self_attn.o_proj.weight": "model-00013-of-00014.safetensors",
724
+ "model.layers.62.self_attn.q_proj.bias": "model-00013-of-00014.safetensors",
725
+ "model.layers.62.self_attn.q_proj.weight": "model-00013-of-00014.safetensors",
726
+ "model.layers.62.self_attn.v_proj.bias": "model-00013-of-00014.safetensors",
727
+ "model.layers.62.self_attn.v_proj.weight": "model-00013-of-00014.safetensors",
728
+ "model.layers.63.input_layernorm.weight": "model-00014-of-00014.safetensors",
729
+ "model.layers.63.mlp.down_proj.weight": "model-00014-of-00014.safetensors",
730
+ "model.layers.63.mlp.gate_proj.weight": "model-00013-of-00014.safetensors",
731
+ "model.layers.63.mlp.up_proj.weight": "model-00014-of-00014.safetensors",
732
+ "model.layers.63.post_attention_layernorm.weight": "model-00014-of-00014.safetensors",
733
+ "model.layers.63.self_attn.k_proj.bias": "model-00013-of-00014.safetensors",
734
+ "model.layers.63.self_attn.k_proj.weight": "model-00013-of-00014.safetensors",
735
+ "model.layers.63.self_attn.o_proj.weight": "model-00013-of-00014.safetensors",
736
+ "model.layers.63.self_attn.q_proj.bias": "model-00013-of-00014.safetensors",
737
+ "model.layers.63.self_attn.q_proj.weight": "model-00013-of-00014.safetensors",
738
+ "model.layers.63.self_attn.v_proj.bias": "model-00013-of-00014.safetensors",
739
+ "model.layers.63.self_attn.v_proj.weight": "model-00013-of-00014.safetensors",
740
+ "model.layers.7.input_layernorm.weight": "model-00002-of-00014.safetensors",
741
+ "model.layers.7.mlp.down_proj.weight": "model-00002-of-00014.safetensors",
742
+ "model.layers.7.mlp.gate_proj.weight": "model-00002-of-00014.safetensors",
743
+ "model.layers.7.mlp.up_proj.weight": "model-00002-of-00014.safetensors",
744
+ "model.layers.7.post_attention_layernorm.weight": "model-00002-of-00014.safetensors",
745
+ "model.layers.7.self_attn.k_proj.bias": "model-00002-of-00014.safetensors",
746
+ "model.layers.7.self_attn.k_proj.weight": "model-00002-of-00014.safetensors",
747
+ "model.layers.7.self_attn.o_proj.weight": "model-00002-of-00014.safetensors",
748
+ "model.layers.7.self_attn.q_proj.bias": "model-00002-of-00014.safetensors",
749
+ "model.layers.7.self_attn.q_proj.weight": "model-00002-of-00014.safetensors",
750
+ "model.layers.7.self_attn.v_proj.bias": "model-00002-of-00014.safetensors",
751
+ "model.layers.7.self_attn.v_proj.weight": "model-00002-of-00014.safetensors",
752
+ "model.layers.8.input_layernorm.weight": "model-00003-of-00014.safetensors",
753
+ "model.layers.8.mlp.down_proj.weight": "model-00003-of-00014.safetensors",
754
+ "model.layers.8.mlp.gate_proj.weight": "model-00002-of-00014.safetensors",
755
+ "model.layers.8.mlp.up_proj.weight": "model-00003-of-00014.safetensors",
756
+ "model.layers.8.post_attention_layernorm.weight": "model-00003-of-00014.safetensors",
757
+ "model.layers.8.self_attn.k_proj.bias": "model-00002-of-00014.safetensors",
758
+ "model.layers.8.self_attn.k_proj.weight": "model-00002-of-00014.safetensors",
759
+ "model.layers.8.self_attn.o_proj.weight": "model-00002-of-00014.safetensors",
760
+ "model.layers.8.self_attn.q_proj.bias": "model-00002-of-00014.safetensors",
761
+ "model.layers.8.self_attn.q_proj.weight": "model-00002-of-00014.safetensors",
762
+ "model.layers.8.self_attn.v_proj.bias": "model-00002-of-00014.safetensors",
763
+ "model.layers.8.self_attn.v_proj.weight": "model-00002-of-00014.safetensors",
764
+ "model.layers.9.input_layernorm.weight": "model-00003-of-00014.safetensors",
765
+ "model.layers.9.mlp.down_proj.weight": "model-00003-of-00014.safetensors",
766
+ "model.layers.9.mlp.gate_proj.weight": "model-00003-of-00014.safetensors",
767
+ "model.layers.9.mlp.up_proj.weight": "model-00003-of-00014.safetensors",
768
+ "model.layers.9.post_attention_layernorm.weight": "model-00003-of-00014.safetensors",
769
+ "model.layers.9.self_attn.k_proj.bias": "model-00003-of-00014.safetensors",
770
+ "model.layers.9.self_attn.k_proj.weight": "model-00003-of-00014.safetensors",
771
+ "model.layers.9.self_attn.o_proj.weight": "model-00003-of-00014.safetensors",
772
+ "model.layers.9.self_attn.q_proj.bias": "model-00003-of-00014.safetensors",
773
+ "model.layers.9.self_attn.q_proj.weight": "model-00003-of-00014.safetensors",
774
+ "model.layers.9.self_attn.v_proj.bias": "model-00003-of-00014.safetensors",
775
+ "model.layers.9.self_attn.v_proj.weight": "model-00003-of-00014.safetensors",
776
+ "model.norm.weight": "model-00014-of-00014.safetensors"
777
+ }
778
+ }
llm/special_tokens_map.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|im_start|>",
4
+ "<|im_end|>",
5
+ "<|object_ref_start|>",
6
+ "<|object_ref_end|>",
7
+ "<|box_start|>",
8
+ "<|box_end|>",
9
+ "<|quad_start|>",
10
+ "<|quad_end|>",
11
+ "<|vision_start|>",
12
+ "<|vision_end|>",
13
+ "<|vision_pad|>",
14
+ "<|image_pad|>",
15
+ "<|video_pad|>",
16
+ "<vila/sentinel>",
17
+ "<image>",
18
+ "<vila/video>"
19
+ ],
20
+ "bos_token": {
21
+ "content": "[BOS]",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false
26
+ },
27
+ "eos_token": {
28
+ "content": "<|im_end|>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false
33
+ },
34
+ "pad_token": {
35
+ "content": "[PAD]",
36
+ "lstrip": false,
37
+ "normalized": false,
38
+ "rstrip": false,
39
+ "single_word": false
40
+ }
41
+ }
llm/tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2adb5255020285bad13f10e6c896570ffe9c35c1b5c0ea587e6ec9662b84f6ea
3
+ size 11422819
llm/tokenizer_config.json ADDED
@@ -0,0 +1,252 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<vila/sentinel>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": true
188
+ },
189
+ "151666": {
190
+ "content": "<image>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": true
196
+ },
197
+ "151667": {
198
+ "content": "<vila/video>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": true
204
+ },
205
+ "151668": {
206
+ "content": "[BOS]",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": true
212
+ },
213
+ "151669": {
214
+ "content": "[PAD]",
215
+ "lstrip": false,
216
+ "normalized": false,
217
+ "rstrip": false,
218
+ "single_word": false,
219
+ "special": true
220
+ }
221
+ },
222
+ "additional_special_tokens": [
223
+ "<|im_start|>",
224
+ "<|im_end|>",
225
+ "<|object_ref_start|>",
226
+ "<|object_ref_end|>",
227
+ "<|box_start|>",
228
+ "<|box_end|>",
229
+ "<|quad_start|>",
230
+ "<|quad_end|>",
231
+ "<|vision_start|>",
232
+ "<|vision_end|>",
233
+ "<|vision_pad|>",
234
+ "<|image_pad|>",
235
+ "<|video_pad|>",
236
+ "<vila/sentinel>",
237
+ "<image>",
238
+ "<vila/video>"
239
+ ],
240
+ "bos_token": "[BOS]",
241
+ "chat_template": "{% if messages[0]['role'] != 'system' %}{{ '<|im_start|>system\\n以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。<|im_end|>\\n' }}{% endif %}{% for message in messages if message['content'] is not none %}{{ '<|im_start|>' + message['role'] + '\\n' + message['content'] + '<|im_end|>' + '\\n' }}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\\n' }}{% endif %}",
242
+ "clean_up_tokenization_spaces": false,
243
+ "eos_token": "<|im_end|>",
244
+ "errors": "replace",
245
+ "legacy": false,
246
+ "model_max_length": 4096,
247
+ "pad_token": "[PAD]",
248
+ "padding_side": "right",
249
+ "split_special_tokens": false,
250
+ "tokenizer_class": "Qwen2Tokenizer",
251
+ "unk_token": null
252
+ }
llm/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
loss.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Union
2
+
3
+ import torch
4
+ from torch.nn.functional import cross_entropy
5
+
6
+ from .constants import IGNORE_INDEX
7
+
8
+ __all__ = ["soft_cross_entropy"]
9
+
10
+
11
+ def soft_cross_entropy(
12
+ outputs: torch.Tensor,
13
+ targets: torch.Tensor,
14
+ soft_tokens: Union[torch.Tensor, List[int]],
15
+ std: float = 1,
16
+ ignore_index: int = IGNORE_INDEX,
17
+ ) -> torch.Tensor:
18
+ # Remove last token from outputs and first token from targets
19
+ outputs = outputs[..., :-1, :].contiguous()
20
+ targets = targets[..., 1:].contiguous()
21
+
22
+ # Flatten outputs and targets
23
+ targets = targets.view(-1)
24
+ outputs = outputs.view(targets.size(0), -1)
25
+
26
+ # Remove outputs and targets with ignore_index
27
+ indices = targets != ignore_index
28
+ outputs = outputs[indices]
29
+ targets = targets[indices]
30
+
31
+ # Convert soft token IDs to tensor
32
+ if isinstance(soft_tokens, list):
33
+ soft_tokens = torch.tensor(soft_tokens).to(targets)
34
+
35
+ # Calculate loss for non-soft tokens
36
+ indices = torch.isin(targets, soft_tokens, invert=True)
37
+ loss = cross_entropy(outputs[indices], targets[indices], reduction="sum")
38
+
39
+ # Calculate loss for soft tokens
40
+ indices = torch.isin(targets, soft_tokens)
41
+ targets_indices = torch.zeros_like(outputs[indices])
42
+ for k, target in enumerate(targets[indices]):
43
+ dist = torch.exp(-((target - soft_tokens) ** 2) / (2 * std**2))
44
+ targets_indices[k][soft_tokens] = dist / dist.sum()
45
+ loss += cross_entropy(outputs[indices], targets_indices, reduction="sum")
46
+
47
+ # Return average loss
48
+ return loss / targets.size(0)
main.py ADDED
File without changes
media.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import glob
2
+ import os
3
+ from collections import defaultdict
4
+ from typing import Any, Dict, List, Optional, Union
5
+
6
+ import cv2
7
+ import numpy as np
8
+ import PIL
9
+ import PIL.Image
10
+ import requests
11
+ from transformers import PretrainedConfig
12
+
13
+ # from llava.constants import MEDIA_TOKENS
14
+ # from llava.media import Image, Video
15
+ # from llava.utils import make_list
16
+ # from llava.utils.logging import logger
17
+
18
+ MEDIA_TOKENS = {
19
+ "image": "<image>",
20
+ "video": "<vila/video>",
21
+ }
22
+
23
+
24
+ class Media:
25
+ pass
26
+
27
+
28
+ class File(Media):
29
+ def __init__(self, path: str) -> None:
30
+ self.path = path
31
+
32
+
33
+ class Image(File):
34
+ pass
35
+
36
+
37
+ class Video(File):
38
+ pass
39
+
40
+
41
+ def make_list(obj: Any) -> List:
42
+ return obj if isinstance(obj, list) else [obj]
43
+
44
+
45
+ def _extract_image(image: Union[Image, PIL.Image.Image]) -> PIL.Image.Image:
46
+ if isinstance(image, Image):
47
+ if image.path.startswith("http://") or image.path.startswith("https://"):
48
+ image = PIL.Image.open(requests.get(image.path, stream=True).raw)
49
+ else:
50
+ image = PIL.Image.open(image.path)
51
+ return image
52
+
53
+
54
+ def _load_video(video_path: str, *, num_frames: int) -> List[PIL.Image.Image]:
55
+ # Load video frames from a directory
56
+ if os.path.isdir(video_path):
57
+ frame_paths = sorted(glob.glob(os.path.join(video_path, "*")))
58
+ indices = np.round(np.linspace(0, len(frame_paths) - 1, num_frames)).astype(int)
59
+ return [PIL.Image.open(frame_paths[index]) for index in indices]
60
+
61
+ # Load video frames from a video file
62
+ vidcap = cv2.VideoCapture(video_path)
63
+
64
+ # Find the last frame as frame count might not be accurate
65
+ frame_count = int(vidcap.get(cv2.CAP_PROP_FRAME_COUNT))
66
+ while frame_count > 0:
67
+ vidcap.set(cv2.CAP_PROP_POS_FRAMES, frame_count - 1)
68
+ if vidcap.grab():
69
+ break
70
+ frame_count -= 1
71
+ else:
72
+ raise ValueError(f"Video '{video_path}' has no frames.")
73
+
74
+ # Extract frames uniformly
75
+ indices = np.round(np.linspace(0, frame_count - 1, num_frames)).astype(int)
76
+ frames = {}
77
+ for index in indices:
78
+ if index in frames:
79
+ continue
80
+ vidcap.set(cv2.CAP_PROP_POS_FRAMES, index)
81
+ success, frame = vidcap.read()
82
+ if not success:
83
+ print(f"Failed to read frame {index} from video '{video_path}'. Skipped.")
84
+ continue
85
+ frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
86
+ frames[index] = PIL.Image.fromarray(frame)
87
+ return [frames[index] for index in indices if index in frames]
88
+
89
+
90
+ def _extract_video(video: Video, config: PretrainedConfig) -> List[PIL.Image.Image]:
91
+ num_frames = config.num_video_frames
92
+ if getattr(config, "fps") != 0:
93
+ print("Extracting frames from video with specified FPS is not supported yet. Ignored.")
94
+
95
+ frames = _load_video(video.path, num_frames=num_frames)
96
+ return frames
97
+
98
+
99
+ def extract_media(
100
+ messages: List[Dict[str, Any]],
101
+ config: Optional[PretrainedConfig] = None,
102
+ draft: bool = False,
103
+ ) -> Dict[str, List[Any]]:
104
+ media = defaultdict(list)
105
+ for message in messages:
106
+ text = ""
107
+ for part in make_list(message["value"]):
108
+ if isinstance(part, str):
109
+ for token in MEDIA_TOKENS.values():
110
+ if token in part:
111
+ print(f"Media token '{token}' found in text: '{part}'. Removed.")
112
+ part = part.replace(token, "").strip()
113
+ text += part
114
+ elif isinstance(part, (Image, PIL.Image.Image)):
115
+ if draft:
116
+ media["image"].append(part)
117
+ else:
118
+ media["image"].append(_extract_image(part))
119
+ text += MEDIA_TOKENS["image"]
120
+ elif isinstance(part, Video):
121
+ if draft:
122
+ media["video"].append(part)
123
+ else:
124
+ media["video"].append(_extract_video(part, config))
125
+ text += MEDIA_TOKENS["video"]
126
+ else:
127
+ raise ValueError(f"Unsupported prompt part type: {type(part)}")
128
+ message["value"] = text
129
+ return media
media_encoder.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from functools import partial
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ import torch
5
+ from torch import nn
6
+
7
+
8
+ class BaseEncoder(nn.Module):
9
+ def __init__(self, parent: nn.Module) -> None:
10
+ super().__init__()
11
+ self._parent = [parent]
12
+
13
+ @property
14
+ def parent(self) -> nn.Module:
15
+ return self._parent[0]
16
+
17
+
18
+ class BasicImageEncoder(BaseEncoder):
19
+ def __init__(
20
+ self,
21
+ parent: torch.nn.Module,
22
+ start_tokens: Optional[str] = None,
23
+ end_tokens: Optional[str] = "\n",
24
+ ) -> None:
25
+ super().__init__(parent)
26
+ self.start_tokens = start_tokens
27
+ self.end_tokens = end_tokens
28
+
29
+ def embed_tokens(self, tokens: Optional[str]) -> Optional[torch.Tensor]:
30
+ if tokens is None:
31
+ return None
32
+ token_ids = self.parent.tokenizer(tokens).input_ids
33
+ token_ids = torch.tensor(token_ids, device=self.parent.device)
34
+ return self.parent.llm.model.embed_tokens(token_ids)
35
+
36
+ def _process_features(
37
+ self,
38
+ features: torch.Tensor,
39
+ start_token_embeds: Optional[torch.Tensor],
40
+ end_token_embeds: Optional[torch.Tensor],
41
+ ) -> torch.Tensor:
42
+ if start_token_embeds is not None:
43
+ features = torch.cat([start_token_embeds, features], dim=0)
44
+ if end_token_embeds is not None:
45
+ features = torch.cat([features, end_token_embeds], dim=0)
46
+ return features
47
+
48
+ def forward(self, images: List[torch.Tensor], config: Dict[str, Any]) -> List[torch.Tensor]:
49
+ images = torch.stack(images, dim=0)
50
+ features = self.parent.encode_images(images, block_sizes=config.get("block_sizes"))
51
+ process_features = partial(
52
+ self._process_features,
53
+ start_token_embeds=self.embed_tokens(self.start_tokens),
54
+ end_token_embeds=self.embed_tokens(self.end_tokens),
55
+ )
56
+ return [process_features(f) for f in features]
57
+
58
+
59
+ class BasicVideoEncoder(BaseEncoder):
60
+ def __init__(
61
+ self,
62
+ parent: torch.nn.Module,
63
+ start_tokens: Optional[str] = None,
64
+ end_tokens: Optional[str] = "\n",
65
+ ) -> None:
66
+ super().__init__(parent)
67
+ self.start_tokens = start_tokens
68
+ self.end_tokens = end_tokens
69
+
70
+ def embed_tokens(self, tokens: Optional[str]) -> Optional[torch.Tensor]:
71
+ if tokens is None:
72
+ return None
73
+ token_ids = self.parent.tokenizer(tokens).input_ids
74
+ token_ids = torch.tensor(token_ids, device=self.parent.device)
75
+ return self.parent.llm.model.embed_tokens(token_ids)
76
+
77
+ def _process_features(
78
+ self,
79
+ features: torch.Tensor,
80
+ start_token_embeds: Optional[torch.Tensor],
81
+ end_token_embeds: Optional[torch.Tensor],
82
+ ) -> torch.Tensor:
83
+ if start_token_embeds is not None:
84
+ start_embeds = torch.stack([start_token_embeds] * features.shape[0], dim=0)
85
+ features = torch.cat([start_embeds, features], dim=1)
86
+ if end_token_embeds is not None:
87
+ end_embeds = torch.stack([end_token_embeds] * features.shape[0], dim=0)
88
+ features = torch.cat([features, end_embeds], dim=1)
89
+ return features.flatten(0, 1)
90
+
91
+ def forward(self, videos: List[torch.Tensor], config: Dict[str, Any]) -> List[torch.Tensor]:
92
+ num_frames = [video.shape[0] for video in videos]
93
+ images = torch.cat(videos, dim=0)
94
+ features = self.parent.encode_images(images)
95
+ features = torch.split(features, num_frames)
96
+ process_features = partial(
97
+ self._process_features,
98
+ start_token_embeds=self.embed_tokens(self.start_tokens),
99
+ end_token_embeds=self.embed_tokens(self.end_tokens),
100
+ )
101
+ return [process_features(f) for f in features]
mm_projector/config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "runs/train/NVILA-Lite_32b_qwen25vl/sft_32b_siglip2/model/mm_projector",
3
+ "architectures": [
4
+ "MultimodalProjector"
5
+ ],
6
+ "mm_projector_type": "mlp_downsample_2x2_fix",
7
+ "model_type": "v2l_projector",
8
+ "torch_dtype": "bfloat16",
9
+ "transformers_version": "4.45.0"
10
+ }
mm_projector/model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a54780c869de20e83140cda7de8f04bacac5c987c15cad394a06494065ffcad
3
+ size 99654160
mm_utils.py ADDED
@@ -0,0 +1,572 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ # dynamic_preprocess and find_closest_aspect_ratio are referenced from https://github.com/OpenGVLab/InternVL
18
+
19
+ import base64
20
+ import os
21
+ import tempfile
22
+ from io import BytesIO
23
+
24
+ import numpy as np
25
+ import torch
26
+ from PIL import Image
27
+ from transformers import StoppingCriteria
28
+
29
+ from .constants import DEFAULT_IMAGE_TOKEN
30
+
31
+
32
+ def get_frame_from_vcap(vidcap, num_frames=10, max_fps=0.0, fps=None, frame_count=None, video_file_name=None):
33
+ import cv2
34
+
35
+ if fps == None or frame_count == None:
36
+ # if one of fps or frame_count is None, still recompute
37
+ fps = vidcap.get(cv2.CAP_PROP_FPS)
38
+ frame_count = int(vidcap.get(cv2.CAP_PROP_FRAME_COUNT))
39
+ if fps == 0 or frame_count == 0:
40
+ print(f"Video file not found. return empty images. {video_file_name}")
41
+ return [
42
+ Image.new("RGB", (720, 720)),
43
+ ] * num_frames, 0
44
+
45
+ duration = frame_count / fps
46
+ frame_interval = frame_count // num_frames
47
+ if frame_interval == 0 and frame_count <= 1:
48
+ print(f"frame_interval is equal to 0. return empty image. {video_file_name}")
49
+ return [
50
+ Image.new("RGB", (720, 720)),
51
+ ] * num_frames, 0
52
+ # print("duration:", duration, "frames:", frame_count, "intervals:", frame_interval)
53
+
54
+ images = []
55
+ count = 0
56
+ success = True
57
+ frame_indices = np.linspace(0, frame_count - 1, num_frames, dtype=int)
58
+ while success:
59
+ # print("frame_count:", frame_count, "count:", count, "num_frames:", num_frames, "frame_interval:", frame_interval)
60
+ if frame_count >= num_frames:
61
+ success, frame = vidcap.read()
62
+ if count in frame_indices:
63
+ try:
64
+ img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
65
+ im_pil = Image.fromarray(img)
66
+ images.append(im_pil)
67
+ except BaseException:
68
+ continue
69
+ if len(images) >= num_frames:
70
+ return images, num_frames
71
+ count += 1
72
+ else:
73
+ # Left padding frames if the video is not long enough
74
+ success, frame = vidcap.read()
75
+ if success:
76
+ try:
77
+ img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
78
+ im_pil = Image.fromarray(img)
79
+ images.append(im_pil)
80
+ except BaseException:
81
+ continue
82
+ count += 1
83
+ else:
84
+ break
85
+ if len(images) == 0:
86
+ raise ValueError("Did not find enough frames in the video. return empty image.")
87
+
88
+ return images, len(images)
89
+
90
+
91
+ def get_frame_from_vcap_with_fps(vidcap, num_frames=10, max_fps=0.0, fps=None, frame_count=None, video_file_name=None):
92
+ """
93
+ num_frames is the max number of frames the model can support.
94
+ frame_count is the number of frames in the input video.
95
+ max_fps is the max FPS of the model can support.
96
+ fps is the fps of the input video.
97
+ """
98
+
99
+ import random
100
+
101
+ import cv2
102
+
103
+ if fps == None or frame_count == None:
104
+ # if one of fps or frame_count is None, still recompute
105
+ fps = vidcap.get(cv2.CAP_PROP_FPS)
106
+ frame_count = int(vidcap.get(cv2.CAP_PROP_FRAME_COUNT))
107
+
108
+ if fps == 0 or frame_count == 0:
109
+ print(f"Video file not found. return empty images. {video_file_name}")
110
+ empty_video_frames = int(random.uniform(2, 8 * max_fps))
111
+ return [
112
+ Image.new("RGB", (720, 720)),
113
+ ] * empty_video_frames, 0
114
+
115
+ duration = frame_count / fps
116
+ # print("duration:", duration, "frames:", frame_count, "fps:", fps, "num_frames:", num_frames, "max_fps:", max_fps)
117
+ # If the video is too long (longer than max_fps and num_frames can support),
118
+ # we will use lower fps to sample frames.
119
+ if duration >= num_frames / max_fps:
120
+ frame_interval = frame_count // num_frames
121
+
122
+ # If the video is too short, we will skip the video if there is only one frame.
123
+ if frame_interval == 0 and frame_count <= 1:
124
+ print(f"frame_interval is equal to 0. return empty image. {video_file_name}")
125
+ empty_video_frames = int(random.uniform(2, 8 * max_fps))
126
+ return [
127
+ Image.new("RGB", (720, 720)),
128
+ ] * empty_video_frames, 0
129
+
130
+ images = []
131
+ count = 0
132
+ success = True
133
+ frame_indices = np.linspace(0, frame_count - 1, num_frames, dtype=int)
134
+
135
+ while success:
136
+ if frame_count >= num_frames:
137
+ # success, frame = vidcap.read()
138
+ if count in frame_indices:
139
+ success, frame = vidcap.read()
140
+ try:
141
+ img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
142
+ im_pil = Image.fromarray(img)
143
+ images.append(im_pil)
144
+ except:
145
+ # print("Failed to read frame:", count)
146
+ continue
147
+ if len(images) >= num_frames:
148
+ return images, num_frames
149
+ else:
150
+ success = vidcap.grab()
151
+ count += 1
152
+ else:
153
+ # Left padding frames if the video is not long enough
154
+ success, frame = vidcap.read()
155
+ if success:
156
+ try:
157
+ img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
158
+ im_pil = Image.fromarray(img)
159
+ images.append(im_pil)
160
+ except:
161
+ # print("Failed to read frame:", count)
162
+ continue
163
+ count += 1
164
+ else:
165
+ break
166
+ else:
167
+ frames_required = int(duration * max_fps)
168
+ frame_indices = np.linspace(0, frame_count - 1, frames_required, dtype=int)
169
+ if frames_required == 0:
170
+ print(f"frames_required is fewer than 2. Duration {duration}, return empty image.")
171
+ empty_video_frames = int(random.uniform(2, 8 * max_fps))
172
+ return [
173
+ Image.new("RGB", (720, 720)),
174
+ ] * empty_video_frames, 0
175
+ elif frames_required == 1:
176
+ frame_indices = np.linspace(0, frame_count - 1, 2, dtype=int)
177
+ images = []
178
+ count = 0
179
+ looked = 0
180
+ success = True
181
+
182
+ while success:
183
+ success, frame = vidcap.read()
184
+ if success and (looked in frame_indices):
185
+ try:
186
+ img = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
187
+ im_pil = Image.fromarray(img)
188
+ images.append(im_pil)
189
+ except:
190
+ continue
191
+ count += 1
192
+ looked += 1
193
+
194
+ if len(images) == 0:
195
+ empty_video_frames = int(random.uniform(2, 8 * max_fps))
196
+ return [
197
+ Image.new("RGB", (720, 720)),
198
+ ] * empty_video_frames, 0
199
+ else:
200
+ return images, len(images)
201
+
202
+
203
+ def opencv_extract_frames(vpath_or_bytesio, frames=6, max_fps=0.0, fps=None, frame_count=None):
204
+ """
205
+ Extract frames from a video using OpenCV.
206
+
207
+ Args:
208
+ vpath_or_bytesio (str or BytesIO): Path to the video file or BytesIO object containing the video.
209
+ frames (int): Number of frames to extract from the video.
210
+ fps (float): Frames per second of the video. If 0.0, the function will extract frames at equal intervals.
211
+
212
+ Returns:
213
+ list: List of PIL Images extracted from the video.
214
+
215
+ Raises:
216
+ NotImplementedError: If the type of `vpath_or_bytesio` is not supported.
217
+ """
218
+ import cv2
219
+
220
+ if isinstance(vpath_or_bytesio, str):
221
+ vidcap = cv2.VideoCapture(vpath_or_bytesio)
222
+ if max_fps > 0.0:
223
+ return get_frame_from_vcap_with_fps(
224
+ vidcap, frames, max_fps, fps=fps, frame_count=frame_count, video_file_name=vpath_or_bytesio
225
+ )
226
+ return get_frame_from_vcap(
227
+ vidcap, frames, max_fps, fps=fps, frame_count=frame_count, video_file_name=vpath_or_bytesio
228
+ )
229
+ elif isinstance(vpath_or_bytesio, (BytesIO,)):
230
+ # assuming mp4
231
+ with tempfile.NamedTemporaryFile(delete=True, suffix=".mp4") as temp_video:
232
+ temp_video.write(vpath_or_bytesio.read())
233
+ temp_video_name = temp_video.name
234
+ vidcap = cv2.VideoCapture(temp_video_name)
235
+ if max_fps > 0.0:
236
+ return get_frame_from_vcap_with_fps(
237
+ vidcap, frames, max_fps, fps=fps, frame_count=frame_count, video_file_name=temp_video_name
238
+ )
239
+ return get_frame_from_vcap(
240
+ vidcap, frames, max_fps, fps=fps, frame_count=frame_count, video_file_name=temp_video_name
241
+ )
242
+ else:
243
+ raise NotImplementedError(type(vpath_or_bytesio))
244
+
245
+
246
+ def load_image_from_base64(image):
247
+ return Image.open(BytesIO(base64.b64decode(image)))
248
+
249
+
250
+ def expand2square(pil_img, background_color):
251
+ """
252
+ Expand the given PIL image to a square shape by adding padding.
253
+
254
+ Parameters:
255
+ - pil_img: The PIL image to be expanded.
256
+ - background_color: The color of the padding to be added.
257
+
258
+ Returns:
259
+ - The expanded PIL image.
260
+
261
+ If the image is already square, it is returned as is.
262
+ If the image is wider than it is tall, padding is added to the top and bottom.
263
+ If the image is taller than it is wide, padding is added to the left and right.
264
+ """
265
+ width, height = pil_img.size
266
+ if pil_img.mode == "L":
267
+ background_color = background_color[0]
268
+ if width == height:
269
+ return pil_img
270
+ elif width > height:
271
+ result = Image.new(pil_img.mode, (width, width), background_color)
272
+ result.paste(pil_img, (0, (width - height) // 2))
273
+ return result
274
+ else:
275
+ result = Image.new(pil_img.mode, (height, height), background_color)
276
+ result.paste(pil_img, ((height - width) // 2, 0))
277
+ return result
278
+
279
+
280
+ def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):
281
+ best_ratio_diff = float("inf")
282
+ best_ratio = (1, 1)
283
+ area = width * height
284
+ for ratio in target_ratios:
285
+ target_aspect_ratio = ratio[0] / ratio[1]
286
+ ratio_diff = abs(aspect_ratio - target_aspect_ratio)
287
+ if ratio_diff < best_ratio_diff:
288
+ best_ratio_diff = ratio_diff
289
+ best_ratio = ratio
290
+ elif ratio_diff == best_ratio_diff:
291
+ if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:
292
+ best_ratio = ratio
293
+ return best_ratio
294
+
295
+
296
+ def dynamic_preprocess(image, min_num=1, max_num=12, image_size=384, use_thumbnail=True):
297
+ orig_width, orig_height = image.size
298
+ aspect_ratio = orig_width / orig_height
299
+
300
+ # calculate the existing image aspect ratio
301
+ target_ratios = {
302
+ (i, j)
303
+ for n in range(min_num, max_num + 1)
304
+ for i in range(1, n + 1)
305
+ for j in range(1, n + 1)
306
+ if i * j <= max_num and i * j >= min_num
307
+ }
308
+ target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])
309
+
310
+ # find the closest aspect ratio to the target
311
+ target_aspect_ratio = find_closest_aspect_ratio(aspect_ratio, target_ratios, orig_width, orig_height, image_size)
312
+
313
+ # calculate the target width and height
314
+ target_width = image_size * target_aspect_ratio[0]
315
+ target_height = image_size * target_aspect_ratio[1]
316
+ blocks = target_aspect_ratio[0] * target_aspect_ratio[1]
317
+
318
+ # resize the image
319
+ resized_img = image.resize((target_width, target_height))
320
+ processed_images = []
321
+ for i in range(blocks):
322
+ box = (
323
+ (i % (target_width // image_size)) * image_size,
324
+ (i // (target_width // image_size)) * image_size,
325
+ ((i % (target_width // image_size)) + 1) * image_size,
326
+ ((i // (target_width // image_size)) + 1) * image_size,
327
+ )
328
+ # split the image
329
+ split_img = resized_img.crop(box)
330
+ processed_images.append(split_img)
331
+ assert len(processed_images) == blocks
332
+ if use_thumbnail and len(processed_images) != 1:
333
+ thumbnail_img = image.resize((image_size, image_size))
334
+ processed_images.append(thumbnail_img)
335
+ return processed_images
336
+
337
+
338
+ def dynamic_s2_preprocess(image, s2_scales=[384, 768, 1152], max_num=12, image_size=384):
339
+ orig_width, orig_height = image.size
340
+ aspect_ratio = orig_width / orig_height
341
+ min_num = (s2_scales[-1] // s2_scales[0]) ** 2 # at least use number of tiles as the largest scale
342
+
343
+ processed_images = []
344
+
345
+ ##########################################################################################
346
+ ############# Add tiles for all but the last scale using fixed squre ratio ###############
347
+ ##########################################################################################
348
+
349
+ for scale in s2_scales[:-1]:
350
+ target_width = image_size * (scale // s2_scales[0])
351
+ target_height = image_size * (scale // s2_scales[0])
352
+ blocks = (scale // s2_scales[0]) ** 2
353
+
354
+ # resize the image
355
+ resized_img = image.resize((target_width, target_height))
356
+ for i in range(blocks):
357
+ box = (
358
+ (i % (target_width // image_size)) * image_size,
359
+ (i // (target_width // image_size)) * image_size,
360
+ ((i % (target_width // image_size)) + 1) * image_size,
361
+ ((i // (target_width // image_size)) + 1) * image_size,
362
+ )
363
+ # split the image
364
+ split_img = resized_img.crop(box)
365
+ processed_images.append(split_img)
366
+
367
+ ##########################################################################################
368
+ ################ Add tiles for the last scale using dynamic aspect ratio #################
369
+ ##########################################################################################
370
+
371
+ # calculate the existing image aspect ratio
372
+ target_ratios = {
373
+ (i, j)
374
+ for n in range(min_num, max_num + 1)
375
+ for i in range(1, n + 1)
376
+ for j in range(1, n + 1)
377
+ if i * j <= max_num and i * j >= min_num
378
+ }
379
+ target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])
380
+
381
+ # find the closest aspect ratio to the target
382
+ target_aspect_ratio = find_closest_aspect_ratio(aspect_ratio, target_ratios, orig_width, orig_height, image_size)
383
+
384
+ # calculate the target width and height
385
+ target_width = image_size * target_aspect_ratio[0]
386
+ target_height = image_size * target_aspect_ratio[1]
387
+ blocks = target_aspect_ratio[0] * target_aspect_ratio[1]
388
+
389
+ # resize the image
390
+ resized_img = image.resize((target_width, target_height))
391
+ for i in range(blocks):
392
+ box = (
393
+ (i % (target_width // image_size)) * image_size,
394
+ (i // (target_width // image_size)) * image_size,
395
+ ((i % (target_width // image_size)) + 1) * image_size,
396
+ ((i // (target_width // image_size)) + 1) * image_size,
397
+ )
398
+ # split the image
399
+ split_img = resized_img.crop(box)
400
+ processed_images.append(split_img)
401
+
402
+ return processed_images, (target_aspect_ratio[1], target_aspect_ratio[0])
403
+
404
+
405
+ def dynamic_process_images_and_prompt(images, prompt, data_args, image_folder=None, max_tiles=None):
406
+ prompt = prompt.split(DEFAULT_IMAGE_TOKEN)
407
+ idx = 0
408
+ all_images = []
409
+ for img in images:
410
+ processed_images = process_image(img, data_args, image_folder, enable_dynamic_res=True, max_tiles=max_tiles)
411
+ all_images.append(processed_images)
412
+ prompt.insert(idx + 1, f"{DEFAULT_IMAGE_TOKEN}\n" * processed_images.shape[0])
413
+ idx += 2
414
+ prompt = "".join(prompt)
415
+ if all_images:
416
+ all_images = torch.cat(all_images)
417
+ else:
418
+ all_images = None
419
+ prompt = prompt.replace(DEFAULT_IMAGE_TOKEN, "")
420
+ return all_images, prompt
421
+
422
+
423
+ def dynamic_s2_process_images_and_prompt(images, prompt, data_args, image_folder=None):
424
+ idx = 0
425
+ all_images = []
426
+ all_block_size = []
427
+ for img in images:
428
+ processed_images, block_size = process_image(img, data_args, image_folder, enable_dynamic_s2=True)
429
+ all_images.append(processed_images)
430
+ all_block_size.append(block_size)
431
+ idx += 2
432
+ if all_images:
433
+ all_images = torch.cat(all_images)
434
+ else:
435
+ all_images = None
436
+ return all_images, all_block_size
437
+
438
+
439
+ def process_image(
440
+ image_file, data_args, image_folder, enable_dynamic_res=False, enable_dynamic_s2=False, max_tiles=None
441
+ ):
442
+ processor = data_args.image_processor
443
+ if isinstance(image_file, str):
444
+ if image_folder is not None:
445
+ image = Image.open(os.path.join(image_folder, image_file)).convert("RGB")
446
+ else:
447
+ image = Image.open(image_file).convert("RGB")
448
+ else:
449
+ # image is stored in bytearray
450
+ image = image_file
451
+ image = image.convert("RGB")
452
+ if hasattr(data_args.image_processor, "crop_size"):
453
+ # CLIP vision tower
454
+ crop_size = data_args.image_processor.crop_size
455
+ else:
456
+ # SIGLIP vision tower
457
+ assert hasattr(data_args.image_processor, "size")
458
+ crop_size = data_args.image_processor.size
459
+ if "dynamic_s2" in data_args.image_aspect_ratio and enable_dynamic_s2:
460
+ assert crop_size["height"] == crop_size["width"]
461
+ images, block_size = dynamic_s2_preprocess(
462
+ image, s2_scales=data_args.s2_scales, max_num=data_args.max_tiles, image_size=crop_size["height"]
463
+ )
464
+ images = [processor.preprocess(image, return_tensors="pt")["pixel_values"][0] for image in images]
465
+ return torch.stack(images), block_size
466
+ if "dynamic" in data_args.image_aspect_ratio and enable_dynamic_res:
467
+ assert crop_size["height"] == crop_size["width"]
468
+ if max_tiles is not None:
469
+ max_num = max_tiles
470
+ else:
471
+ max_num = data_args.max_tiles
472
+ images = dynamic_preprocess(image, min_num=data_args.min_tiles, max_num=max_num, image_size=crop_size["height"])
473
+ images = [processor.preprocess(image, return_tensors="pt")["pixel_values"][0] for image in images]
474
+ return torch.stack(images)
475
+
476
+ if data_args.image_aspect_ratio == "resize":
477
+ image = image.resize((crop_size["width"], crop_size["height"]))
478
+ if data_args.image_aspect_ratio == "pad":
479
+
480
+ def expand2square(pil_img, background_color):
481
+ width, height = pil_img.size
482
+ if width == height:
483
+ return pil_img
484
+ elif width > height:
485
+ result = Image.new(pil_img.mode, (width, width), background_color)
486
+ result.paste(pil_img, (0, (width - height) // 2))
487
+ return result
488
+ else:
489
+ result = Image.new(pil_img.mode, (height, height), background_color)
490
+ result.paste(pil_img, ((height - width) // 2, 0))
491
+ return result
492
+
493
+ image = expand2square(image, tuple(int(x * 255) for x in processor.image_mean))
494
+ image = processor.preprocess(image, return_tensors="pt")["pixel_values"][0]
495
+ else:
496
+ # Using default behavior of the vision encoder
497
+ # For CLIP, default is central crop
498
+ # For Radio, default is central crop
499
+ # For Siglip, default is resize
500
+ # For InternVIT, default is resize
501
+ image = processor.preprocess(image, return_tensors="pt")["pixel_values"][0]
502
+ return image
503
+
504
+
505
+ def process_images(images, image_processor, model_cfg, enable_dynamic_res=False, max_tiles=None):
506
+ model_cfg.image_processor = image_processor
507
+ new_images = [
508
+ process_image(image, model_cfg, None, enable_dynamic_res=enable_dynamic_res, max_tiles=max_tiles)
509
+ for image in images
510
+ ]
511
+
512
+ if all(x.shape == new_images[0].shape for x in new_images):
513
+ if len(new_images[0].shape) == 4:
514
+ new_images = torch.cat(new_images, dim=0)
515
+ elif len(new_images[0].shape) == 3:
516
+ new_images = torch.stack(new_images, dim=0)
517
+ else:
518
+ raise ValueError(f"new_images rank does not equal to 4, rank: {len(new_images[0].shape)}")
519
+ else:
520
+ raise ValueError("The shape of images in new_images is different!")
521
+ return new_images
522
+
523
+
524
+ def tokenizer_image_token(prompt, tokenizer, return_tensors=None):
525
+ return tokenizer(prompt, return_tensors=return_tensors).input_ids[0]
526
+
527
+
528
+ def is_gemma_tokenizer(tokenizer):
529
+ return "gemma" in tokenizer.__class__.__name__.lower()
530
+
531
+
532
+ def get_model_name_from_path(model_path):
533
+ model_path = model_path.strip("/")
534
+ model_paths = model_path.split("/")
535
+ if model_paths[-1].startswith("checkpoint-"):
536
+ return model_paths[-2] + "_" + model_paths[-1]
537
+ else:
538
+ return model_paths[-1]
539
+
540
+
541
+ class KeywordsStoppingCriteria(StoppingCriteria):
542
+ def __init__(self, keywords, tokenizer, input_ids):
543
+ self.keywords = keywords
544
+ self.keyword_ids = []
545
+ self.max_keyword_len = 0
546
+ for keyword in keywords:
547
+ cur_keyword_ids = tokenizer(keyword).input_ids
548
+ if len(cur_keyword_ids) > 1 and cur_keyword_ids[0] == tokenizer.bos_token_id:
549
+ cur_keyword_ids = cur_keyword_ids[1:]
550
+ if len(cur_keyword_ids) > self.max_keyword_len:
551
+ self.max_keyword_len = len(cur_keyword_ids)
552
+ self.keyword_ids.append(torch.tensor(cur_keyword_ids))
553
+ self.tokenizer = tokenizer
554
+ self.start_len = input_ids.shape[1]
555
+
556
+ def call_for_batch(self, output_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
557
+ offset = min(output_ids.shape[1] - self.start_len, self.max_keyword_len)
558
+ self.keyword_ids = [keyword_id.to(output_ids.device) for keyword_id in self.keyword_ids]
559
+ for keyword_id in self.keyword_ids:
560
+ if (output_ids[0, -keyword_id.shape[0] :] == keyword_id).all():
561
+ return True
562
+ outputs = self.tokenizer.batch_decode(output_ids[:, -offset:], skip_special_tokens=True)[0]
563
+ for keyword in self.keywords:
564
+ if keyword in outputs:
565
+ return True
566
+ return False
567
+
568
+ def __call__(self, output_ids: torch.LongTensor, scores: torch.FloatTensor, **kwargs) -> bool:
569
+ outputs = []
570
+ for i in range(output_ids.shape[0]):
571
+ outputs.append(self.call_for_batch(output_ids[i].unsqueeze(0), scores))
572
+ return all(outputs)
model_utils_packing.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from importlib import import_module
2
+ from typing import Tuple
3
+
4
+ import torch
5
+ import transformers
6
+ from torch import nn
7
+ from torch.nn import functional as F
8
+
9
+ __all__ = ["patch"]
10
+
11
+
12
+ def _get_unpad_data(attention_mask: torch.Tensor, *args, **kwargs) -> Tuple[torch.Tensor, torch.Tensor, int]:
13
+ if hasattr(_get_unpad_data, "seqlens_in_batch"):
14
+ seqlens_in_batch = _get_unpad_data.seqlens_in_batch
15
+ else:
16
+ seqlens_in_batch = torch.sum(attention_mask, dim=1)
17
+
18
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
19
+ max_seqlen_in_batch = seqlens_in_batch.max().item()
20
+ cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.int32), (1, 0))
21
+ return indices, cu_seqlens, max_seqlen_in_batch
22
+
23
+
24
+ def set_seqlens_in_batch(seqlens_in_batch: torch.Tensor) -> None:
25
+ _get_unpad_data.seqlens_in_batch = seqlens_in_batch
26
+
27
+
28
+ def patch(model: nn.Module) -> None:
29
+ if transformers.__version__ < "4.43.0":
30
+ m = import_module(model.__module__)
31
+ if not hasattr(m, "_get_unpad_data"):
32
+ raise ValueError(f"Module {m} does not have function '_get_unpad_data' for packing")
33
+ m._get_unpad_data = _get_unpad_data
34
+ else:
35
+ transformers.modeling_flash_attention_utils._get_unpad_data = _get_unpad_data
modeling_vila.py ADDED
@@ -0,0 +1,1228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import json
3
+ import logging
4
+ import math
5
+ import os
6
+ import os.path
7
+ import os.path as osp
8
+ import shutil
9
+ import warnings
10
+ from abc import ABC
11
+ from collections import OrderedDict, defaultdict, deque
12
+ from copy import deepcopy
13
+ from itertools import chain
14
+ from threading import Thread
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+
17
+ import torch
18
+ import torch.distributed as dist
19
+ import torch.nn as nn
20
+ import torch.nn.functional as F
21
+ import torchvision
22
+ from einops import rearrange
23
+ from PIL import Image
24
+ from transformers import (
25
+ AutoConfig,
26
+ AutoModel,
27
+ AutoProcessor,
28
+ AutoTokenizer,
29
+ GenerationConfig,
30
+ LogitsProcessor,
31
+ PretrainedConfig,
32
+ PreTrainedModel,
33
+ Qwen2Config,
34
+ Qwen2ForCausalLM,
35
+ Qwen2PreTrainedModel,
36
+ TextIteratorStreamer,
37
+ )
38
+ from transformers.modeling_outputs import CausalLMOutputWithPast
39
+ from transformers.modeling_utils import ContextManagers, no_init_weights
40
+
41
+ from .auto_processor import VILAProcessor
42
+ from .base_projector import MultimodalProjector, MultimodalProjectorConfig
43
+ from .builder import build_llm_and_tokenizer
44
+ from .configuration_vila import VILAConfig
45
+ from .constants import *
46
+ from .conversation import SeparatorStyle, default_conversation
47
+ from .distributed import all_gather as vila_all_gather
48
+ from .loss import soft_cross_entropy
49
+ from .media import extract_media
50
+ from .media_encoder import BasicImageEncoder, BasicVideoEncoder
51
+ from .mm_utils import process_image, process_images
52
+ from .model_utils_packing import set_seqlens_in_batch
53
+ from .siglip_encoder import SiglipVisionTower, SiglipVisionTowerDynamicS2, SiglipVisionTowerS2
54
+ from .tokenizer_utils import tokenize_conversation
55
+ from .utils import get_model_config, load_tokenizer_then_handle_media_tokens_and_chat_template
56
+
57
+ # from llava.constants import DEFAULT_IMAGE_TOKEN, IGNORE_INDEX, NUM_EXTRA_TOKENS
58
+
59
+ # ease debugging
60
+ python_input = input
61
+
62
+ # quick hack for remote code
63
+ def get_pg_manager():
64
+ return None
65
+
66
+
67
+ def get_model_weights_dtype(model: nn.Module):
68
+ pass
69
+
70
+
71
+ def build_mm_projector(model_type_or_path: str, config: PretrainedConfig) -> PreTrainedModel:
72
+ if model_type_or_path is None:
73
+ return None
74
+ ## load from pretrained model
75
+ if config.resume_path:
76
+ assert os.path.exists(model_type_or_path), f"Resume mm projector path {model_type_or_path} does not exist!"
77
+ return MultimodalProjector.from_pretrained(model_type_or_path, config)
78
+ ## build from scratch
79
+ else:
80
+ mm_projector_cfg = MultimodalProjectorConfig(model_type_or_path)
81
+ mm_projector = MultimodalProjector(mm_projector_cfg, config)
82
+ return mm_projector
83
+
84
+
85
+ def check_dot_in_model_path(model_path: str):
86
+ """Check if the model path contains dot, which will affect the remote code loading."""
87
+ if osp.isdir(model_path): # local model
88
+ if "." in osp.abspath(model_path):
89
+ return True
90
+ else: # remote model
91
+ if "." in model_path:
92
+ return True
93
+ return False
94
+
95
+
96
+ def get_vila_version(model_path: str) -> str:
97
+ VERSIONS = ["vila1.5", "vila-u", "longvila", "nvila", "vila-m3"]
98
+ for version in VERSIONS:
99
+ if version in model_path.lower():
100
+ return version
101
+ return None
102
+
103
+
104
+ def generate_jinja_template(conv_mode: str) -> str:
105
+ if conv_mode == "vicuna_v1":
106
+ return """{% set system_prompt = "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. " %}
107
+ {% set roles = ["user", "assistant"] %}
108
+ {% set sep = " " %}
109
+
110
+ {{ system_prompt }}
111
+
112
+ {% for message in messages %}
113
+ {% if message['role'] == roles[0] %}
114
+ {{ "USER: " }}{{ sep }}{{ message['content'] }}{{ sep }}
115
+ {% else %}
116
+ {{ "ASSISTANT: " }}{{ sep }}{{ message['content'] }}{{ sep }}
117
+ {% endif %}
118
+ {% endfor %}
119
+ {% if messages[-1]['role'] == 'user' %}
120
+ {{ "ASSISTANT:" }}
121
+ {% endif %}
122
+ """
123
+ elif conv_mode == "llama_3":
124
+ return """{% set system_prompt = "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\\n\\nYou are a helpful language and vision assistant. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language.<|eot_id|>" %}
125
+ {% set roles = ["<|start_header_id|>user<|end_header_id|>\\n\\n", "<|start_header_id|>assistant<|end_header_id|>\\n\\n"]%}
126
+ {% set sep = "<|eot_id|>" %}
127
+
128
+ {{ system_prompt }}
129
+ {% for message in messages %}
130
+ {% if message['role'] == 'user' %}
131
+ {{ roles[0] }}{{ message['content'] }}{{ sep }}
132
+ {% else %}
133
+ {{ roles[1] }}{{ message['content'] }}{{ sep }}
134
+ {% endif %}
135
+ {% endfor %}
136
+ {% if messages[-1]['role'] == 'user' %}
137
+ {{ roles[1] }}
138
+ {% endif %}
139
+ """
140
+ elif conv_mode == "hermes_2":
141
+ return """{% set system_prompt = "<|im_start|>system\nAnswer the questions." %}
142
+ {% set roles = ["<|im_start|>user\n", "<|im_start|>assistant\n"] %}
143
+ {% set sep = "<|im_end|>" %}
144
+
145
+ {{ system_prompt }}{{ sep }}
146
+
147
+ {% for message in messages %}
148
+ {% if message['role'] == 'user' %}
149
+ {{ roles[0] }}{{ message['content'] }}{{ sep }}
150
+ {% else %}
151
+ {{ roles[1] }}{{ message['content'] }}{{ sep }}
152
+ {% endif %}
153
+ {% endfor %}"""
154
+ else:
155
+ raise NotImplementedError(f"Jinja template generation is not implemented for {conv_mode}.")
156
+
157
+
158
+ def build_vision_tower(model_name_or_path: str, config: PretrainedConfig) -> PreTrainedModel:
159
+ ## skip vision tower instantiation
160
+ if model_name_or_path is None:
161
+ return None
162
+
163
+ vision_tower_arch = None
164
+ if config.resume_path and "radio" not in model_name_or_path:
165
+ assert os.path.exists(model_name_or_path), f"Resume vision tower path {model_name_or_path} does not exist!"
166
+ vision_tower_cfg = AutoConfig.from_pretrained(model_name_or_path, trust_remote_code=True)
167
+ vision_tower_arch = vision_tower_cfg.architectures[0].lower()
168
+ vision_tower_name = vision_tower_arch if vision_tower_arch is not None else model_name_or_path
169
+
170
+ use_s2 = getattr(config, "s2", False)
171
+ use_dynamic_s2 = getattr(config, "dynamic_s2", False)
172
+
173
+ if "siglip" in vision_tower_name:
174
+ if use_dynamic_s2:
175
+ vision_tower = SiglipVisionTowerDynamicS2(model_name_or_path, config)
176
+ elif use_s2:
177
+ vision_tower = SiglipVisionTowerS2(model_name_or_path, config)
178
+ else:
179
+ vision_tower = SiglipVisionTower(model_name_or_path, config)
180
+ else:
181
+ raise NotImplementedError(f"Unknown vision tower: {model_name_or_path}")
182
+
183
+ config.mm_hidden_size = (
184
+ vision_tower.config.hidden_size if not (use_s2 or use_dynamic_s2) else vision_tower.hidden_size
185
+ )
186
+ return vision_tower
187
+
188
+
189
+ class VILAPretrainedModel(PreTrainedModel):
190
+ config_class = VILAConfig
191
+ main_input_name = "input_embeds"
192
+ supports_gradient_checkpointing = True
193
+ _supports_flash_attn_2 = True
194
+
195
+ def __init__(self, config: VILAConfig, *args, **kwargs):
196
+ super().__init__(config)
197
+ self.config = config
198
+ cfgs = get_model_config(config)
199
+ if len(cfgs) == 3:
200
+ llm_cfg, vision_tower_cfg, mm_projector_cfg = cfgs
201
+ else:
202
+ raise ValueError("`llm_cfg` `mm_projector_cfg` `vision_tower_cfg` not found in the config.")
203
+
204
+ # loading on cpu by default
205
+ device_map = kwargs.get("device_map", "cpu")
206
+ self.mm_projector = build_mm_projector(mm_projector_cfg, config)
207
+ self.vision_tower = build_vision_tower(vision_tower_cfg, config)
208
+ if "auto" in device_map or "cuda" in device_map:
209
+ self.mm_projector = self.mm_projector.cuda()
210
+ self.vision_tower = self.vision_tower.cuda()
211
+ # set device_map auto can autoamtically shard llm to different devices
212
+ self.llm, self.tokenizer = self.init_llm(llm_cfg, config, device_map=device_map)
213
+
214
+ # NOTE(ligeng): need to add other decoders from config
215
+ self.encoders = {"image": BasicImageEncoder(self), "video": BasicVideoEncoder(self)}
216
+
217
+ self.post_config()
218
+ self.is_loaded = True
219
+
220
+ assert (
221
+ self.llm is not None or self.vision_tower is not None or self.mm_projector is not None
222
+ ), "At least one of the components must be instantiated."
223
+
224
+ @classmethod
225
+ def convert_vila_dev_ckpt_to_remote(
226
+ self,
227
+ model_path: str,
228
+ output_dir: str = None,
229
+ vila_version: str | None = None,
230
+ conv_mode: str | None = None,
231
+ copy: bool = False,
232
+ copy_weights: bool = True,
233
+ copy_code: bool = True,
234
+ *model_args,
235
+ **kwargs,
236
+ ):
237
+ # assert type(self) == VILAForCasualLM, "This method is only available for VILAForCasualLM."
238
+ assert model_path != output_dir, "model_path and output_dir cannot be the same"
239
+ if os.path.isdir(model_path):
240
+ model_path = model_path
241
+ else:
242
+ from huggingface_hub import HfApi, snapshot_download
243
+
244
+ model_path = snapshot_download(model_path)
245
+ print("downloading HF model to", model_path)
246
+
247
+ if check_dot_in_model_path(model_path) and output_dir is None:
248
+ raise ValueError(
249
+ f"Model path {model_path} contains a dot, which will affect the remote code loading. Please specify the output directory without dot in the path to fix this issue."
250
+ )
251
+ if output_dir is not None and "." in output_dir:
252
+ raise ValueError(
253
+ f"Output directory {output_dir} contains a dot, which will affect the remote code loading. Please specify a valid output directory without dots."
254
+ )
255
+
256
+ if copy:
257
+ print("copy is set to True, copying weights and code to output_dir")
258
+ copy_weights = copy_code = True
259
+ # copy weights and code to output_dir
260
+ self.copy_or_symlink_directory(model_path, output_dir, copy=copy_weights)
261
+ self.copy_remote_py_files(output_dir, copy=copy_code)
262
+
263
+ if vila_version is None:
264
+ vila_version = get_vila_version(output_dir)
265
+
266
+ cfg_path = os.path.join(output_dir, "config.json")
267
+ config = json.load(open(cfg_path))
268
+ config["version"] = "2.0" # nvila tag
269
+ config["architectures"] = ["VILAForCasualLM"]
270
+ config["auto_map"] = {
271
+ "AutoProcessor": "auto_processor.VILAProcessor",
272
+ "AutoConfig": "modeling_vila.VILAConfig",
273
+ "AutoModel": "modeling_vila.VILAForCasualLM",
274
+ "AutoModelForCausalLM": "modeling_vila.VILAForCasualLM",
275
+ }
276
+ # vila1.5 legacy support
277
+ config["model_type"] = "vila"
278
+ if vila_version in ["vila1.5", "vila-m3"]:
279
+ if conv_mode is None:
280
+ raise ValueError(f"Please specify the conversation mode for {output_dir}.")
281
+ config["chat_template"] = conv_mode
282
+ jinja_template = generate_jinja_template(conv_mode)
283
+ jinja_path = os.path.join(output_dir, f"{conv_mode}.jinja")
284
+ with open(jinja_path, "w") as f:
285
+ f.write(jinja_template)
286
+ json.dump(config, open(cfg_path, "w"), indent=2)
287
+
288
+ ##########################################################################################
289
+ config = AutoConfig.from_pretrained(output_dir, trust_remote_code=True)
290
+ tokenizer = load_tokenizer_then_handle_media_tokens_and_chat_template(output_dir, config)
291
+ tokenizer.save_pretrained(osp.join(output_dir, "llm"))
292
+ ##########################################################################################
293
+
294
+ @classmethod
295
+ def copy_or_symlink_directory(cls, model_path, output_dir, copy=True):
296
+ # Create output directory if it doesn't exist
297
+ os.makedirs(output_dir, exist_ok=True)
298
+ # Create symlinks for all files in model_path to output_dir
299
+ for item in os.listdir(model_path):
300
+ src_path = os.path.join(model_path, item)
301
+ dst_path = os.path.join(output_dir, item)
302
+
303
+ # Remove existing file/directory at destination if it exists
304
+ if os.path.exists(dst_path):
305
+ if os.path.islink(dst_path):
306
+ os.unlink(dst_path)
307
+ elif os.path.isdir(dst_path):
308
+ shutil.rmtree(dst_path)
309
+ else:
310
+ os.remove(dst_path)
311
+
312
+ # Create symlink
313
+ if copy:
314
+ if os.path.isdir(src_path):
315
+ shutil.copytree(src_path, dst_path)
316
+ else:
317
+ shutil.copy2(src_path, dst_path)
318
+ print(f"Copied {src_path} to {dst_path}")
319
+ else:
320
+ os.symlink(src_path, dst_path)
321
+ print(f"Created symlink from {src_path} to {dst_path}")
322
+
323
+ @classmethod
324
+ def copy_remote_py_files(cls, output_dir, copy=True):
325
+ ## copy .py and REAMDE for next loading remote code
326
+ current_file_path = os.path.abspath(__file__)
327
+ current_folder = os.path.dirname(current_file_path)
328
+ for file_name in os.listdir(current_folder):
329
+ if file_name == "INSTRUCTIONS.md":
330
+ src_fname = os.path.join(current_folder, file_name)
331
+ dst_fname = os.path.join(output_dir, "README.md")
332
+ if os.path.exists(dst_fname):
333
+ old_reamde = open(dst_fname).read()
334
+ else:
335
+ old_reamde = ""
336
+ with open(src_fname) as src, open(dst_fname, "w") as dst:
337
+ dst.write(src.read())
338
+ dst.write(old_reamde)
339
+ print("[HF remote code] REAMDE ", src_fname, "to", dst_fname)
340
+ if file_name.endswith(".py") or file_name.endswith(".jinja"):
341
+ full_file_name = os.path.join(current_folder, file_name)
342
+ if os.path.isfile(full_file_name):
343
+ if copy:
344
+ shutil.copy(full_file_name, output_dir)
345
+ print("[HF remote code] copying", full_file_name, "to", output_dir)
346
+ else:
347
+ # symlink to ease development
348
+ if os.path.exists(os.path.join(output_dir, file_name)):
349
+ os.remove(os.path.join(output_dir, file_name))
350
+ os.symlink(full_file_name, os.path.join(output_dir, file_name))
351
+ print("[HF remote code] linking", full_file_name, "to", output_dir)
352
+
353
+ def save_pretrained(self, output_dir, state_dict=None, **kwargs):
354
+ if state_dict is None:
355
+ # other wise fetch from deepspeed
356
+ # state_dict = accelerator.get_state_dict(is_deepspeed_enabled)
357
+ state_dict = self.state_dict()
358
+
359
+ if getattr(self, "tokenizer", None):
360
+ self.tokenizer.save_pretrained(osp.join(output_dir, "llm"))
361
+
362
+ if self.get_llm():
363
+ print(f"saving llm to {osp.join(output_dir, 'llm')}")
364
+ self.llm.config._name_or_path = osp.join(output_dir, "llm")
365
+ llm_state_dict = OrderedDict({k.split("llm.")[-1]: v for k, v in state_dict.items() if "llm" in k})
366
+ self.llm.save_pretrained(os.path.join(output_dir, "llm"), state_dict=llm_state_dict)
367
+ self.config.llm_cfg = self.llm.config
368
+
369
+ if self.get_vision_tower():
370
+ print(f"saving vision_tower to {osp.join(output_dir, 'vision_tower')}")
371
+ self.vision_tower.config._name_or_path = osp.join(output_dir, "vision_tower")
372
+ vision_tower_state_dict = OrderedDict(
373
+ {k.split("vision_tower.vision_tower.")[-1]: v for k, v in state_dict.items() if "vision_tower" in k}
374
+ )
375
+ self.vision_tower.vision_tower.save_pretrained(
376
+ os.path.join(output_dir, "vision_tower"),
377
+ state_dict=vision_tower_state_dict,
378
+ )
379
+ self.vision_tower.image_processor.save_pretrained(os.path.join(output_dir, "vision_tower"))
380
+ self.config.vision_tower_cfg = self.vision_tower.config
381
+ if hasattr(self.config.vision_tower_cfg, "auto_map"):
382
+ if "radio" not in self.get_vision_tower().__class__.__name__.lower():
383
+ delattr(self.config.vision_tower_cfg, "auto_map")
384
+
385
+ if self.get_mm_projector():
386
+ print(f"saving mm_projector to {osp.join(output_dir, 'mm_projector')}")
387
+ self.mm_projector.config._name_or_path = osp.join(output_dir, "mm_projector")
388
+ mm_projector_state_dict = OrderedDict(
389
+ {k.split("mm_projector.")[-1]: v for k, v in state_dict.items() if "mm_projector" in k}
390
+ )
391
+ self.mm_projector.save_pretrained(
392
+ os.path.join(output_dir, "mm_projector"),
393
+ state_dict=mm_projector_state_dict,
394
+ )
395
+ self.config.mm_projector_cfg = self.mm_projector.config
396
+
397
+ ## update and save top-level config
398
+ self.config._name_or_path = output_dir
399
+ self.config.architectures = [self.__class__.__name__]
400
+ self.config.save_pretrained(output_dir)
401
+
402
+ ## copy .py and REAMDE for next loading remote code
403
+ self.copy_remote_py_files(output_dir)
404
+
405
+ @classmethod
406
+ def from_pretrained(
407
+ cls,
408
+ pretrained_model_name_or_path: Optional[str] = None,
409
+ *model_args,
410
+ config: Optional[Union[PretrainedConfig, str, os.PathLike]] = None,
411
+ cache_dir: Optional[Union[str, os.PathLike]] = None,
412
+ ignore_mismatched_sizes: bool = False,
413
+ force_download: bool = False,
414
+ local_files_only: bool = False,
415
+ token: Optional[Union[str, bool]] = None,
416
+ revision: str = "main",
417
+ use_safetensors: Optional[bool] = None,
418
+ weights_only: bool = True,
419
+ **kwargs,
420
+ ):
421
+ config = AutoConfig.from_pretrained(pretrained_model_name_or_path, trust_remote_code=True)
422
+ return cls._from_config(config, **kwargs)
423
+
424
+ def init_llm(self, llm_config, config, *args, **kwargs):
425
+ self.llm, self.tokenizer = build_llm_and_tokenizer(llm_config, config, *args, **kwargs)
426
+ # hard coded for NVILA
427
+ # variables for XGrammar
428
+ # print("DEBUG", len(self.tokenizer.added_tokens_encoder.keys()), self.tokenizer.added_tokens_encoder.keys())
429
+ NUM_EXTRA_TOKENS = len(self.tokenizer.added_tokens_encoder.keys())
430
+
431
+ # TODO: SENTINEL_TOKEN is not added, need to check with Zhijian
432
+ self.vocab_size = self.tokenizer.vocab_size + NUM_EXTRA_TOKENS
433
+ # XGrammar tokenizer and grammar compiler
434
+ # lazy init only when specified json output during inference
435
+ self.grammar_compiler = None
436
+ self.llm.resize_token_embeddings(len(self.tokenizer))
437
+ return self.llm, self.tokenizer
438
+
439
+ def post_config(self):
440
+ ######################################################################
441
+ # TODO: need to check dtype with jason
442
+ self.llm = self.llm.to(torch.float16)
443
+ self.mm_projector = self.mm_projector.to(torch.float16)
444
+ self.vision_tower = self.vision_tower.to(torch.float16)
445
+ ######################################################################
446
+ self.training = self.llm.training
447
+ ## configuration
448
+ if getattr(self.config, "llm_cfg", None) is None:
449
+ self.config.llm_cfg = self.llm.config
450
+ if getattr(self.config, "vision_tower_cfg", None) is None:
451
+ self.config.vision_tower_cfg = self.vision_tower.config
452
+ if getattr(self.config, "mm_projector_cfg", None) is None:
453
+ self.config.mm_projector_cfg = self.mm_projector.config
454
+
455
+ def get_llm(self):
456
+ llm = getattr(self, "llm", None)
457
+ if type(llm) is list:
458
+ llm = llm[0]
459
+ return llm
460
+
461
+ def get_lm_head(self):
462
+ lm_head = getattr(self.get_llm(), "lm_head", None)
463
+ return lm_head
464
+
465
+ def get_vision_tower(self):
466
+ vision_tower = getattr(self, "vision_tower", None)
467
+ if type(vision_tower) is list:
468
+ vision_tower = vision_tower[0]
469
+ return vision_tower
470
+
471
+ def get_mm_projector(self):
472
+ mm_projector = getattr(self, "mm_projector", None)
473
+ if type(mm_projector) is list:
474
+ mm_projector = mm_projector[0]
475
+ return mm_projector
476
+
477
+ def freezed_module_patch(self):
478
+ """
479
+ Huggingface will call model.train() at each training_step. To ensure the expected behaviors for modules like dropout, batchnorm, etc., we need to call model.eval() for the freezed modules.
480
+ """
481
+ if self.training:
482
+ if self.get_llm() and not getattr(self.config, "tune_language_model", False):
483
+ pass
484
+ # logging.warning("Caution: Your LLM is currently in training mode, ensuring accurate gradient computation. Please be vigilant, particularly regarding BatchNorm and Dropout operations.")
485
+ if self.get_vision_tower() and not getattr(self.config, "tune_vision_tower", False):
486
+ self.get_vision_tower().eval()
487
+ if self.get_mm_projector() and not getattr(self.config, "tune_mm_projector", False):
488
+ self.get_mm_projector().eval()
489
+
490
+
491
+ class VILAForCasualLM(VILAPretrainedModel):
492
+ def __init__(self, config: VILAConfig, *args, **kwargs):
493
+ super().__init__(config, *args, **kwargs)
494
+
495
+ def merge_features_for_dynamic_s2(self, image_features, block_sizes):
496
+ scales = self.get_vision_tower().scales
497
+ resize_output_to_scale_idx = self.get_vision_tower().resize_output_to_scale_idx
498
+
499
+ image_features_each_image = []
500
+ new_block_sizes = []
501
+ block_cnt = 0
502
+ for block_size_each_image in block_sizes:
503
+ if block_size_each_image is None:
504
+ cur_features = image_features[block_cnt : block_cnt + 1]
505
+ cur_features = rearrange(cur_features, "1 (h w) c -> 1 c h w", h=int(cur_features.shape[1] ** 0.5))
506
+ cur_features = cur_features.repeat(1, len(scales), 1, 1)
507
+ image_features_each_image.append(cur_features)
508
+ new_block_sizes.append((1, 1))
509
+ block_cnt += 1
510
+ else:
511
+ cur_features_each_scale = []
512
+ for scale in scales[:-1]:
513
+ num_blocks_this_scale = (scale // scales[0]) ** 2
514
+ cur_features_each_scale.append(
515
+ self.merge_chessboard(
516
+ image_features[block_cnt : block_cnt + num_blocks_this_scale],
517
+ num_split_h=scale // scales[0],
518
+ num_split_w=scale // scales[0],
519
+ )
520
+ ) # 1 * C * H * W
521
+ block_cnt += num_blocks_this_scale
522
+ num_blocks_last_scale = block_size_each_image[0] * block_size_each_image[1]
523
+ cur_features_each_scale.append(
524
+ self.merge_chessboard(
525
+ image_features[block_cnt : block_cnt + num_blocks_last_scale],
526
+ num_split_h=block_size_each_image[0],
527
+ num_split_w=block_size_each_image[1],
528
+ )
529
+ ) # 1 * C * H * W
530
+ block_cnt += num_blocks_last_scale
531
+
532
+ # resize and concat features from different scales
533
+ output_size = cur_features_each_scale[resize_output_to_scale_idx].shape[-2:]
534
+ cur_features = torch.cat(
535
+ [
536
+ F.interpolate(cur_features_each_scale[i].to(torch.float32), size=output_size, mode="area").to(
537
+ cur_features_each_scale[i].dtype
538
+ )
539
+ for i in range(len(cur_features_each_scale))
540
+ ],
541
+ dim=1,
542
+ )
543
+ # cur_features = rearrange(cur_features, "1 c h w -> (h w) c")
544
+
545
+ image_features_each_image.append(cur_features)
546
+
547
+ if resize_output_to_scale_idx == len(scales) - 1 or resize_output_to_scale_idx == -1:
548
+ new_block_sizes.append(block_size_each_image)
549
+ else:
550
+ new_block_sizes.append(
551
+ (
552
+ scales[resize_output_to_scale_idx] // scales[0],
553
+ scales[resize_output_to_scale_idx] // scales[0],
554
+ )
555
+ )
556
+
557
+ assert block_cnt == len(image_features)
558
+
559
+ return image_features_each_image, new_block_sizes
560
+
561
+ def encode_images(self, images, block_sizes: Optional[Optional[Tuple[int, ...]]] = None):
562
+ if block_sizes is None:
563
+ block_sizes = [None] * len(images)
564
+ if getattr(self.config, "dynamic_s2", False):
565
+ image_features = self.get_vision_tower()(images)
566
+ image_features, new_block_sizes = self.merge_features_for_dynamic_s2(image_features, block_sizes)
567
+
568
+ image_features = [
569
+ self.split_chessboard(x, block_size[0], block_size[1])
570
+ for x, block_size in zip(image_features, new_block_sizes)
571
+ ] # list of B * C * H * W tensors
572
+ image_features = torch.cat(
573
+ [rearrange(x, "b c h w -> b (h w) c") for x in image_features], dim=0
574
+ ) # B * N * C
575
+ image_features = self.get_mm_projector()(image_features)
576
+ image_features = list(
577
+ image_features.split([block_size[0] * block_size[1] for block_size in new_block_sizes], dim=0)
578
+ )
579
+ image_features = [
580
+ self.merge_chessboard(x, block_size[0], block_size[1])
581
+ for x, block_size in zip(image_features, new_block_sizes)
582
+ ] # list of 1 * C * H * W tensors
583
+ image_features = [rearrange(x, "1 c h w -> (h w) c") for x in image_features] # list of N * C tensors
584
+ if all([feature.shape[0] == image_features[0].shape[0] for feature in image_features]):
585
+ image_features = torch.stack(image_features, dim=0)
586
+ else:
587
+ image_features = self.get_vision_tower()(images)
588
+ image_features = self.get_mm_projector()(image_features)
589
+ return image_features
590
+
591
+ def train(self, mode: bool = True):
592
+ if mode:
593
+ self.tokenizer.padding_side = "right"
594
+ else:
595
+ self.tokenizer.padding_side = "left"
596
+ super().train(mode)
597
+ return self
598
+
599
+ def _embed(
600
+ self,
601
+ input_ids: torch.Tensor,
602
+ media: Dict[str, List[torch.Tensor]],
603
+ media_config: Dict[str, Dict[str, Any]],
604
+ labels: Optional[torch.Tensor],
605
+ attention_mask: Optional[torch.Tensor],
606
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
607
+ # NOTE(ligeng): deep copy to avoid modifying the original media and media_config
608
+ media = copy.deepcopy(media)
609
+ media_config = copy.deepcopy(media_config)
610
+
611
+ labels = labels if labels is not None else torch.full_like(input_ids, IGNORE_INDEX)
612
+ attention_mask = attention_mask if attention_mask is not None else torch.ones_like(input_ids, dtype=torch.bool)
613
+
614
+ PROCESS_GROUP_MANAGER = get_pg_manager()
615
+ if PROCESS_GROUP_MANAGER is not None:
616
+ for name in media:
617
+ self.encoders[name].end_tokens = None
618
+
619
+ # Extract text and media embeddings
620
+ text_embeds = self.llm.model.embed_tokens(input_ids)
621
+ if media is not None:
622
+ media_embeds = self.__embed_media_tokens(media, media_config)
623
+ else:
624
+ # no media was provided, so we just return an empty dict
625
+ media_embeds = {}
626
+
627
+ # This is a workaround to make sure the dummy embeddings are consumed
628
+ while media_embeds.get("dummy"):
629
+ dummy_embed = media_embeds["dummy"].popleft()
630
+ text_embeds += torch.sum(dummy_embed) * 0
631
+
632
+ # Remove padding
633
+ batch_size = labels.shape[0]
634
+ text_embeds = [text_embeds[k][attention_mask[k]] for k in range(batch_size)]
635
+ labels = [labels[k][attention_mask[k]] for k in range(batch_size)]
636
+
637
+ # Build inverse mapping from token ID to media name
638
+ media_tokens = {}
639
+ for name, token_id in self.tokenizer.media_token_ids.items():
640
+ media_tokens[token_id] = name
641
+
642
+ # Fuse text and media embeddings
643
+ inputs_m, labels_m = [], []
644
+ for k in range(batch_size):
645
+ inputs_mk, labels_mk = [], []
646
+ pos = 0
647
+ while pos < len(labels[k]):
648
+ if input_ids[k][pos].item() in media_tokens:
649
+ end = pos + 1
650
+ name = media_tokens[input_ids[k][pos].item()]
651
+ input = media_embeds[name].popleft()
652
+ label = torch.full([input.shape[0]], IGNORE_INDEX, device=labels[k].device, dtype=labels[k].dtype)
653
+ # print(f"{self.tokenizer.padding_side} [media] {k=} {pos=}, {self.tokenizer.batch_decode(input_ids[k][pos:pos+1])}"); python_input()
654
+ elif input_ids[k][pos].item() in (self.tokenizer.pad_token_id, self.tokenizer.eos_token_id):
655
+ end = pos + 1
656
+ pos = end
657
+ # print(f"[skip PAD/EOS] {k=} {pos=}, {self.tokenizer.batch_decode(input_ids[k][pos:end])}"); python_input()
658
+ continue
659
+ else:
660
+ end = pos
661
+ while end < len(labels[k]) and input_ids[k][end].item() not in media_tokens:
662
+ end += 1
663
+ input = text_embeds[k][pos:end]
664
+ label = labels[k][pos:end]
665
+ # print(f"[text] {k=} {pos=}, {self.tokenizer.batch_decode(input_ids[k][pos:end])}"); python_input()
666
+
667
+ inputs_mk.append(input)
668
+ labels_mk.append(label)
669
+ pos = end
670
+ inputs_m.append(torch.cat(inputs_mk, dim=0))
671
+ labels_m.append(torch.cat(labels_mk, dim=0))
672
+ inputs, labels = inputs_m, labels_m
673
+
674
+ # Check if all media embeddings are consumed
675
+ for name in media_embeds:
676
+ if media_embeds[name]:
677
+ raise ValueError(f"Not all {name} embeddings are consumed! Still {len(media_embeds[name])} left.")
678
+
679
+ # Truncate sequences to `model_max_length` as media embeddings are inserted
680
+ inputs, labels = self.__truncate_sequence(inputs, labels)
681
+
682
+ # Pad sequences to the longest one in the batch
683
+ return self.__batchify_sequence(inputs, labels)
684
+
685
+ def __embed_media_tokens(
686
+ self,
687
+ media: Dict[str, List[torch.Tensor]],
688
+ media_config: Dict[str, Dict[str, Any]],
689
+ ) -> Dict[str, List[torch.Tensor]]:
690
+ embeds = defaultdict(deque)
691
+ for name in media:
692
+ if self.training:
693
+ # Gather metainfo of media objects from all ranks
694
+ info = [{"shape": tensor.shape, "dtype": tensor.dtype} for tensor in media.get(name, [])]
695
+ infos = list(chain(vila_all_gather(info)))
696
+
697
+ # The entire batch does not contain any media objects of this type.
698
+ if not infos:
699
+ continue
700
+
701
+ # Create a dummy tensor to ensure the encoder is called, otherwise the training will hang.
702
+ if media.get(name) is None or len(media[name]) == 0:
703
+ dummy = torch.zeros(infos[0]["shape"], dtype=infos[0]["dtype"], device=self.device)
704
+ embeds["dummy"].extend(self.encoders[name]([dummy], media_config[name]))
705
+ continue
706
+ embeds[name] = deque(self.encoders[name](media[name], media_config[name]))
707
+ return embeds
708
+
709
+ def __truncate_sequence(
710
+ self, inputs: List[torch.Tensor], labels: List[torch.Tensor]
711
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
712
+ if self.training and any(len(input) > self.tokenizer.model_max_length for input in inputs):
713
+ warnings.warn(f"Truncating sequences to `model_max_length` ({self.tokenizer.model_max_length}).")
714
+ inputs = [input[: self.tokenizer.model_max_length] for input in inputs]
715
+ labels = [label[: self.tokenizer.model_max_length] for label in labels]
716
+ return inputs, labels
717
+
718
+ def __batchify_sequence(
719
+ self, inputs: List[torch.Tensor], labels: List[torch.Tensor]
720
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
721
+ batch_size = len(inputs)
722
+ device = inputs[0].device
723
+ hidden_size = inputs[0].shape[1]
724
+ max_length = max(inputs[k].shape[0] for k in range(batch_size))
725
+ attention_mask = torch.ones((batch_size, max_length), dtype=torch.bool, device=device)
726
+
727
+ inputs_p, labels_p = [], []
728
+ for k in range(batch_size):
729
+ size_pk = max_length - inputs[k].shape[0]
730
+ inputs_pk = torch.zeros((size_pk, hidden_size), dtype=inputs[k].dtype, device=device)
731
+ labels_pk = torch.full((size_pk,), IGNORE_INDEX, dtype=labels[k].dtype, device=device)
732
+ if self.tokenizer.padding_side == "right":
733
+ attention_mask[k, inputs[k].shape[0] :] = False
734
+ inputs_pk = torch.cat([inputs[k], inputs_pk], dim=0)
735
+ labels_pk = torch.cat([labels[k], labels_pk], dim=0)
736
+ else:
737
+ attention_mask[k, : -inputs[k].shape[0]] = False
738
+ inputs_pk = torch.cat([inputs_pk, inputs[k]], dim=0)
739
+ labels_pk = torch.cat([labels_pk, labels[k]], dim=0)
740
+ inputs_p.append(inputs_pk)
741
+ labels_p.append(labels_pk)
742
+
743
+ inputs = torch.stack(inputs_p, dim=0)
744
+ labels = torch.stack(labels_p, dim=0)
745
+ return inputs, labels, attention_mask
746
+
747
+ def repack_multimodal_data(self, inputs_embeds, attention_mask, position_ids, labels):
748
+ # Handle sequence parallelism
749
+ PROCESS_GROUP_MANAGER = get_pg_manager()
750
+
751
+ # We do re-sharding instead of packing here to ensure the sequence length is the same across all ranks.
752
+ if PROCESS_GROUP_MANAGER is not None:
753
+ sp_degree = PROCESS_GROUP_MANAGER.sp_degree
754
+ sp_rank = PROCESS_GROUP_MANAGER.sp_rank
755
+ sp_group = PROCESS_GROUP_MANAGER.sp_pg
756
+ ring_degree = PROCESS_GROUP_MANAGER.ring_degree
757
+ ring_rank = PROCESS_GROUP_MANAGER.ring_rank
758
+ ring_type = PROCESS_GROUP_MANAGER.ring_type
759
+ ulysses_degree = PROCESS_GROUP_MANAGER.ulysses_degree
760
+ ulysses_rank = PROCESS_GROUP_MANAGER.ulysses_rank
761
+
762
+ bs, shard_seqlen = position_ids.shape
763
+ sp_seq_len = [torch.zeros(1, dtype=torch.int64, device=position_ids.device) for _ in range(sp_degree)]
764
+ dist.all_gather(sp_seq_len, torch.tensor(shard_seqlen, device=position_ids.device), group=sp_group)
765
+ sp_seq_len_cat = torch.cat(sp_seq_len, dim=0)
766
+
767
+ if sp_rank == 0:
768
+ original_start_id = 0
769
+ else:
770
+ original_start_id = torch.sum(sp_seq_len_cat[:sp_rank]).item()
771
+ original_end_id = torch.sum(sp_seq_len_cat[: sp_rank + 1]).item()
772
+
773
+ # Gather attention_mask, position_ids, labels and input_embeds
774
+ all_inputs_embeds = torch.zeros(
775
+ bs,
776
+ torch.sum(sp_seq_len_cat),
777
+ inputs_embeds.shape[-1],
778
+ dtype=inputs_embeds.dtype,
779
+ device=inputs_embeds.device,
780
+ ).contiguous()
781
+ all_inputs_embeds[:, original_start_id:original_end_id, :] += inputs_embeds
782
+ dist.barrier(group=sp_group)
783
+ dist.all_reduce(all_inputs_embeds, group=sp_group)
784
+ dist.barrier(group=sp_group)
785
+
786
+ attention_mask_list = [
787
+ torch.zeros((bs, sp_seq_len[i]), dtype=attention_mask.dtype, device=attention_mask.device)
788
+ for i in range(sp_degree)
789
+ ]
790
+ position_ids_list = [
791
+ torch.zeros((bs, sp_seq_len[i]), dtype=position_ids.dtype, device=position_ids.device)
792
+ for i in range(sp_degree)
793
+ ]
794
+ labels_list = [
795
+ torch.zeros((bs, sp_seq_len[i]), dtype=labels.dtype, device=labels.device) for i in range(sp_degree)
796
+ ]
797
+
798
+ dist.all_gather(attention_mask_list, attention_mask, group=sp_group)
799
+ dist.all_gather(position_ids_list, position_ids, group=sp_group)
800
+ dist.all_gather(labels_list, labels, group=sp_group)
801
+
802
+ effective_seqlen_list = [attention_mask_list[i].sum(dim=-1) for i in range(sp_degree)]
803
+ effective_seqlen = torch.stack(effective_seqlen_list, dim=-1)
804
+ effective_seqlen_batch_list = torch.unbind(effective_seqlen, dim=0)
805
+
806
+ global_attention_mask_list = []
807
+ global_position_ids_list = []
808
+ global_labels_list = []
809
+ global_inputs_embeds_list = []
810
+ for i in range(bs):
811
+ global_attention_mask_batch_list = []
812
+ global_position_ids_batch_list = []
813
+ global_labels_batch_list = []
814
+ global_inputs_embeds_batch_list = []
815
+ for j in range(sp_degree):
816
+ eff_len = effective_seqlen_batch_list[i][j]
817
+ prev_len = torch.sum(sp_seq_len_cat[:j]).item() if j > 0 else 0
818
+
819
+ global_attention_mask_batch_list.append(attention_mask_list[j][i, :eff_len])
820
+ global_position_ids_batch_list.append(position_ids_list[j][i, :eff_len])
821
+ global_labels_batch_list.append(labels_list[j][i, :eff_len])
822
+ global_inputs_embeds_batch_list.append(all_inputs_embeds[i, prev_len : prev_len + eff_len, :])
823
+ global_attention_mask_list.append(torch.cat(global_attention_mask_batch_list, dim=0))
824
+ global_position_ids_list.append(torch.cat(global_position_ids_batch_list, dim=0))
825
+ global_labels_list.append(torch.cat(global_labels_batch_list, dim=0))
826
+ global_inputs_embeds_list.append(torch.cat(global_inputs_embeds_batch_list, dim=0))
827
+
828
+ global_attention_mask = torch.nn.utils.rnn.pad_sequence(
829
+ global_attention_mask_list, batch_first=True, padding_value=False
830
+ )
831
+ global_position_ids = torch.nn.utils.rnn.pad_sequence(
832
+ global_position_ids_list, batch_first=True, padding_value=-1
833
+ )
834
+ global_labels = torch.nn.utils.rnn.pad_sequence(
835
+ global_labels_list, batch_first=True, padding_value=IGNORE_INDEX
836
+ )
837
+ global_inputs_embeds = torch.nn.utils.rnn.pad_sequence(
838
+ global_inputs_embeds_list, batch_first=True, padding_value=0
839
+ )
840
+
841
+ # Re-shard the inputs
842
+ if ring_degree > 1:
843
+ total_effective_seqlen = torch.sum(effective_seqlen, dim=1)
844
+ new_seqlen_per_rank = total_effective_seqlen // sp_degree
845
+ assert torch.all(
846
+ total_effective_seqlen % sp_degree == 0
847
+ ), "total_effective_seqlen must be divisible by sp_degree"
848
+
849
+ max_new_seqlen = torch.max(new_seqlen_per_rank).item()
850
+
851
+ new_attention_mask = torch.zeros(
852
+ (bs, max_new_seqlen), dtype=global_attention_mask.dtype, device=global_attention_mask.device
853
+ )
854
+ new_position_ids = torch.zeros(
855
+ (bs, max_new_seqlen), dtype=global_position_ids.dtype, device=global_position_ids.device
856
+ )
857
+ new_labels = torch.full(
858
+ (bs, max_new_seqlen), IGNORE_INDEX, dtype=global_labels.dtype, device=global_labels.device
859
+ )
860
+ new_inputs_embeds = torch.zeros(
861
+ (bs, max_new_seqlen, global_inputs_embeds.shape[-1]),
862
+ dtype=global_inputs_embeds.dtype,
863
+ device=global_inputs_embeds.device,
864
+ )
865
+
866
+ if ring_type == "ring_varlen":
867
+ for i in range(bs):
868
+ start_idx = new_seqlen_per_rank[i] * sp_rank
869
+ end_idx = start_idx + new_seqlen_per_rank[i]
870
+ new_attention_mask[i, : new_seqlen_per_rank[i]] = global_attention_mask[i, start_idx:end_idx]
871
+ new_position_ids[i, : new_seqlen_per_rank[i]] = global_position_ids[i, start_idx:end_idx]
872
+ new_labels[i, : new_seqlen_per_rank[i]] = global_labels[i, start_idx:end_idx]
873
+ new_inputs_embeds[i, : new_seqlen_per_rank[i], :] = global_inputs_embeds[
874
+ i, start_idx:end_idx, :
875
+ ]
876
+ elif ring_type == "zigzag_ring_varlen":
877
+ chunk_size = total_effective_seqlen // (2 * sp_degree)
878
+ for i in range(bs):
879
+ # Zigzag pattern indices
880
+ if sp_degree == ring_degree:
881
+ forward_rank_idx = sp_rank
882
+ backward_rank_idx = 2 * sp_degree - sp_rank - 1
883
+ else:
884
+ ulysses_offset = ulysses_rank * ring_degree * 2
885
+ forward_rank_idx = ring_rank + ulysses_offset
886
+ backward_rank_idx = sp_degree - ring_rank - 1 + ulysses_offset
887
+
888
+ # Calculate start and end indices for the forward and backward zigzag
889
+ start_idx_fwd = forward_rank_idx * chunk_size[i]
890
+ end_idx_fwd = start_idx_fwd + chunk_size[i]
891
+
892
+ start_idx_bwd = backward_rank_idx * chunk_size[i]
893
+ end_idx_bwd = start_idx_bwd + chunk_size[i]
894
+
895
+ # Fill new tensors with zigzag data
896
+ new_attention_mask[i, : chunk_size[i]] = global_attention_mask[i, start_idx_fwd:end_idx_fwd]
897
+ new_attention_mask[i, chunk_size[i] : 2 * chunk_size[i]] = global_attention_mask[
898
+ i, start_idx_bwd:end_idx_bwd
899
+ ]
900
+
901
+ new_position_ids[i, : chunk_size[i]] = global_position_ids[i, start_idx_fwd:end_idx_fwd]
902
+ new_position_ids[i, chunk_size[i] : 2 * chunk_size[i]] = global_position_ids[
903
+ i, start_idx_bwd:end_idx_bwd
904
+ ]
905
+
906
+ new_labels[i, : chunk_size[i]] = global_labels[i, start_idx_fwd:end_idx_fwd]
907
+ new_labels[i, chunk_size[i] : 2 * chunk_size[i]] = global_labels[i, start_idx_bwd:end_idx_bwd]
908
+
909
+ new_inputs_embeds[i, : chunk_size[i], :] = global_inputs_embeds[i, start_idx_fwd:end_idx_fwd, :]
910
+ new_inputs_embeds[i, chunk_size[i] : 2 * chunk_size[i], :] = global_inputs_embeds[
911
+ i, start_idx_bwd:end_idx_bwd, :
912
+ ]
913
+ else:
914
+ raise ValueError(f"Invalid ring_type: {ring_type}")
915
+ else:
916
+ global_seq_len = global_attention_mask.shape[-1]
917
+ seq_len_sharded = global_seq_len // sp_degree
918
+ start_idx_reshard = seq_len_sharded * sp_rank
919
+ end_idx_reshard = start_idx_reshard + seq_len_sharded if sp_rank < sp_degree - 1 else global_seq_len
920
+
921
+ new_attention_mask = torch.narrow(
922
+ global_attention_mask, 1, start_idx_reshard, end_idx_reshard - start_idx_reshard
923
+ )
924
+ new_position_ids = torch.narrow(
925
+ global_position_ids, 1, start_idx_reshard, end_idx_reshard - start_idx_reshard
926
+ )
927
+ new_labels = torch.narrow(global_labels, 1, start_idx_reshard, end_idx_reshard - start_idx_reshard)
928
+ new_inputs_embeds = torch.narrow(
929
+ global_inputs_embeds, 1, start_idx_reshard, end_idx_reshard - start_idx_reshard
930
+ )
931
+
932
+ return new_inputs_embeds, new_attention_mask, new_position_ids, new_labels
933
+
934
+ device = inputs_embeds.device
935
+ batch_size = inputs_embeds.shape[0]
936
+ seqlens = [attention_mask[k].sum().item() for k in range(batch_size)]
937
+
938
+ # Pack all sequences together
939
+ inputs_embeds_p = [inputs_embeds[k][attention_mask[k]] for k in range(batch_size)]
940
+ attention_mask_p = [torch.ones(seqlens[k], dtype=torch.int, device=device) for k in range(batch_size)]
941
+ position_ids_p = [torch.arange(seqlens[k], dtype=torch.int, device=device) for k in range(batch_size)]
942
+ labels_p = [labels[k][attention_mask[k]] for k in range(batch_size)]
943
+
944
+ # Add one dummy token at the end of the packed sequence to ensure that `_get_unpacked_data` will be called
945
+ inputs_embeds_p.append(torch.zeros(1, inputs_embeds.shape[-1], dtype=inputs_embeds.dtype, device=device))
946
+ attention_mask_p.append(torch.tensor([0], dtype=torch.int, device=device))
947
+ position_ids_p.append(torch.tensor([0], dtype=torch.int, device=device))
948
+ labels_p.append(torch.tensor([IGNORE_INDEX], dtype=torch.int, device=device))
949
+
950
+ # Mask the first token of each sequence to avoid contamination
951
+ for label in labels_p:
952
+ label[0] = IGNORE_INDEX
953
+
954
+ # Batch the data
955
+ inputs_embeds_p = torch.cat(inputs_embeds_p, dim=0).unsqueeze(0)
956
+ attention_mask_p = torch.cat(attention_mask_p, dim=0).unsqueeze(0)
957
+ position_ids_p = torch.cat(position_ids_p, dim=0).unsqueeze(0)
958
+ labels_p = torch.cat(labels_p, dim=0).unsqueeze(0)
959
+
960
+ if hasattr(
961
+ self, "pad_to_multiple_of"
962
+ ): # related to quantization, please refer to ModelArguments for more information.
963
+ assert len(labels_p.shape) == 2
964
+ batch_size, max_length, cur_length = labels_p.shape[0], labels_p.shape[1], labels_p.shape[1]
965
+ hidden_size = inputs_embeds_p.shape[-1]
966
+
967
+ if max_length % self.pad_to_multiple_of != 0:
968
+ max_length = ((max_length // self.pad_to_multiple_of) + 1) * self.pad_to_multiple_of
969
+ difference = max_length - cur_length
970
+
971
+ inputs_embeds_p = torch.cat(
972
+ (
973
+ inputs_embeds_p,
974
+ torch.full((batch_size, difference, hidden_size), self.llm.pad_token_id).to(inputs_embeds_p),
975
+ ),
976
+ dim=1,
977
+ )
978
+ labels_p = torch.cat((labels_p, torch.full((batch_size, difference), IGNORE_INDEX).to(labels_p)), dim=1)
979
+ attention_mask_p = torch.cat(
980
+ (
981
+ attention_mask_p,
982
+ torch.zeros((batch_size, difference), dtype=torch.bool).to(attention_mask_p),
983
+ ),
984
+ dim=1,
985
+ )
986
+ position_ids_p = torch.cat(
987
+ (position_ids_p, torch.full((batch_size, difference), -1).to(position_ids_p)), dim=1
988
+ )
989
+
990
+ return inputs_embeds_p, attention_mask_p, position_ids_p, labels_p
991
+
992
+ def get_xgr_logits_processor(self, response_format) -> List[LogitsProcessor]:
993
+ raise NotImplementedError("This method is not implemented for VILA model.")
994
+ # Convert response format to logits processor
995
+ import xgrammar as xgr
996
+
997
+ logging.info("[XGrammar] Compiling grammar for contrained output")
998
+
999
+ if self.grammar_compiler is None:
1000
+ # logging.info(f"[XGrammar] {self.tokenizer}, {self.tokenizer.vocab_size}, {self.vocab_size}")
1001
+ self.grammar_compiler = xgr.GrammarCompiler(
1002
+ xgr.TokenizerInfo.from_huggingface(self.tokenizer, vocab_size=self.vocab_size)
1003
+ )
1004
+
1005
+ if response_format.type == "json_schema":
1006
+ compiled_grammar = self.grammar_compiler.compile_json_schema(
1007
+ response_format.json_schema.schema_,
1008
+ indent=2,
1009
+ )
1010
+ else:
1011
+ compiled_grammar = self.grammar_compiler.compile_builtin_json_grammar()
1012
+
1013
+ return [xgr.contrib.hf.LogitsProcessor(compiled_grammar)]
1014
+
1015
+ def forward(
1016
+ self,
1017
+ input_ids: torch.LongTensor = None,
1018
+ media: Optional[Dict[str, List[torch.Tensor]]] = None,
1019
+ images: Optional[torch.FloatTensor] = None,
1020
+ media_config: Optional[List] = None,
1021
+ attention_mask: Optional[torch.Tensor] = None,
1022
+ position_ids: Optional[torch.LongTensor] = None,
1023
+ past_key_values: Optional[List[torch.FloatTensor]] = None,
1024
+ inputs_embeds: Optional[torch.FloatTensor] = None,
1025
+ labels: Optional[torch.LongTensor] = None,
1026
+ packing: bool = True,
1027
+ force_packing: bool = False,
1028
+ seqlens_in_batch: Optional[torch.LongTensor] = None,
1029
+ dpo_forward: bool = False,
1030
+ **kwargs,
1031
+ ) -> Union[Tuple, CausalLMOutputWithPast]:
1032
+ self.freezed_module_patch()
1033
+
1034
+ if images is not None:
1035
+ if media is not None:
1036
+ raise ValueError("Both 'media' and 'images' are provided. Please provide only one.")
1037
+ print("The 'images' argument is deprecated. Please use 'media' instead.")
1038
+ media = {"image": images}
1039
+
1040
+ if media_config is None:
1041
+ media_config = defaultdict(dict)
1042
+
1043
+ if inputs_embeds is None:
1044
+ inputs_embeds, labels, attention_mask = self._embed(input_ids, media, media_config, labels, attention_mask)
1045
+
1046
+ if force_packing or (packing and self.training and not dpo_forward):
1047
+ if seqlens_in_batch is None:
1048
+ seqlens_in_batch = torch.sum(attention_mask, dim=1)
1049
+ set_seqlens_in_batch(seqlens_in_batch)
1050
+
1051
+ (inputs_embeds, attention_mask, position_ids, labels) = self.repack_multimodal_data(
1052
+ inputs_embeds, attention_mask, position_ids, labels
1053
+ )
1054
+
1055
+ outputs = self.llm(
1056
+ inputs_embeds=inputs_embeds,
1057
+ attention_mask=attention_mask,
1058
+ position_ids=position_ids,
1059
+ past_key_values=past_key_values,
1060
+ labels=labels,
1061
+ **kwargs,
1062
+ )
1063
+
1064
+ if self.training and getattr(self.config, "time_token_ids", []):
1065
+ outputs.loss = soft_cross_entropy(
1066
+ outputs.logits,
1067
+ labels,
1068
+ soft_tokens=self.config.time_token_ids,
1069
+ std=self.config.soft_ce_std,
1070
+ )
1071
+
1072
+ if dpo_forward:
1073
+ return outputs.logits, labels
1074
+
1075
+ return outputs
1076
+
1077
+ @torch.inference_mode()
1078
+ def generate(
1079
+ self,
1080
+ input_ids: Optional[torch.FloatTensor] = None,
1081
+ media: Optional[Dict[str, List[torch.Tensor]]] = None,
1082
+ media_config: Dict[str, Dict[str, Any]] = None,
1083
+ attention_mask: Optional[torch.LongTensor] = None,
1084
+ **generation_kwargs,
1085
+ ):
1086
+ if self.training:
1087
+ warnings.warn(
1088
+ "Model is in training mode, using default padding strategy to right. This is not recommended for generation."
1089
+ )
1090
+ inputs_embeds, _, attention_mask = self._embed(input_ids, media, media_config, None, attention_mask)
1091
+ return self.llm.generate(inputs_embeds=inputs_embeds, attention_mask=attention_mask, **generation_kwargs)
1092
+
1093
+ @torch.inference_mode()
1094
+ def generate_content(
1095
+ self,
1096
+ prompt: Union[str, List],
1097
+ generation_config: Optional[GenerationConfig] = None,
1098
+ response_format=None,
1099
+ ) -> str:
1100
+ # TODO(zhijianl): Support directly taking conversation as input
1101
+ conversation = [{"from": "human", "value": prompt}]
1102
+
1103
+ # Convert response format to logits processor
1104
+ if response_format:
1105
+ xgr_logits_processor = self.get_xgr_logits_processor(response_format)
1106
+ else:
1107
+ xgr_logits_processor = None
1108
+
1109
+ # Extract media from the conversation
1110
+
1111
+ # TODO (extract and preprocess should be done together, as the preprocess of image and video can be different, i.e. when dynamic res is used)
1112
+ media = extract_media(conversation, self.config)
1113
+
1114
+ # Process media
1115
+ media_config = defaultdict(dict)
1116
+ for name in media:
1117
+ if name == "image":
1118
+ if len(media["image"]) == 1 and self.config.image_aspect_ratio in ["dynamic", "dynamic_s2"]:
1119
+ self.config.image_processor = self.vision_tower.image_processor
1120
+ if self.config.image_aspect_ratio == "dynamic":
1121
+ images = process_image(media["image"][0], self.config, None, enable_dynamic_res=True).half()
1122
+ conversation[0]["value"] = conversation[0]["value"].replace(
1123
+ DEFAULT_IMAGE_TOKEN, f"{DEFAULT_IMAGE_TOKEN}\n" * images.shape[0]
1124
+ )
1125
+ else:
1126
+ if type(self.config.s2_scales) is str:
1127
+ self.config.s2_scales = list(map(int, self.config.s2_scales.split(",")))
1128
+ images, block_sizes = process_image(
1129
+ media["image"][0], self.config, None, enable_dynamic_s2=True
1130
+ )
1131
+ images = images.half()
1132
+ media_config[name]["block_sizes"] = [block_sizes]
1133
+ else:
1134
+ images = process_images(media["image"], self.vision_tower.image_processor, self.config).half()
1135
+ media[name] = [image for image in images]
1136
+ elif name == "video":
1137
+ if self.config.image_aspect_ratio == "dynamic" and self.config.video_max_tiles > 1:
1138
+ media[name] = [
1139
+ process_images(
1140
+ images,
1141
+ self.vision_tower.image_processor,
1142
+ self.config,
1143
+ enable_dynamic_res=True,
1144
+ max_tiles=self.config.video_max_tiles,
1145
+ ).half()
1146
+ for images in media[name]
1147
+ ]
1148
+ elif self.config.image_aspect_ratio == "dynamic_s2" and self.config.video_max_tiles > 1:
1149
+ self.config.image_processor = self.vision_tower.image_processor
1150
+ if type(self.config.s2_scales) is str:
1151
+ self.config.s2_scales = list(map(int, self.config.s2_scales.split(",")))
1152
+ media[name] = [
1153
+ torch.cat(
1154
+ [
1155
+ process_image(
1156
+ image,
1157
+ self.config,
1158
+ None,
1159
+ enable_dynamic_s2=True,
1160
+ max_tiles=self.config.video_max_tiles,
1161
+ )[0].half()
1162
+ for image in images
1163
+ ]
1164
+ )
1165
+ for images in media[name]
1166
+ ]
1167
+ else:
1168
+ media[name] = [
1169
+ process_images(images, self.vision_tower.image_processor, self.config).half()
1170
+ for images in media[name]
1171
+ ]
1172
+ else:
1173
+ raise ValueError(f"Unsupported media type: {name}")
1174
+
1175
+ # Tokenize the conversation
1176
+ input_ids = tokenize_conversation(conversation, self.tokenizer, add_generation_prompt=True).cuda().unsqueeze(0)
1177
+
1178
+ # Set up the generation config
1179
+ generation_config = generation_config or self.default_generation_config
1180
+
1181
+ # print("input_ids", input_ids.shape)
1182
+ # print(input_ids)
1183
+ # print(self.tokenizer.batch_decode(input_ids))
1184
+ # print("media", {k: len(v) for k, v in media.items()})
1185
+ # print("media_config", media_config)
1186
+ # print("generation_config", generation_config)
1187
+ # input("wait for debug")
1188
+ # Generate the response
1189
+ try:
1190
+ output_ids = self.generate(
1191
+ input_ids=input_ids,
1192
+ media=media,
1193
+ media_config=media_config,
1194
+ generation_config=generation_config,
1195
+ logits_processor=xgr_logits_processor, # structured generation
1196
+ )
1197
+ except ValueError:
1198
+ if not generation_config.do_sample:
1199
+ raise
1200
+ # FIXME(zhijianl): This is a temporary workaround for the sampling issue
1201
+ logging.warning("Generation failed with sampling, retrying with greedy decoding.")
1202
+ generation_config.do_sample = False
1203
+ output_ids = self.generate(
1204
+ input_ids=input_ids,
1205
+ media=media,
1206
+ media_config=media_config,
1207
+ generation_config=generation_config,
1208
+ logits_processor=xgr_logits_processor,
1209
+ )
1210
+
1211
+ # Decode the response
1212
+ response = self.tokenizer.decode(output_ids[0], skip_special_tokens=True).strip()
1213
+ return response
1214
+
1215
+ @property
1216
+ def default_generation_config(self) -> GenerationConfig:
1217
+ generation_config = copy.deepcopy(self.generation_config or GenerationConfig())
1218
+ if self.tokenizer.eos_token_id is None:
1219
+ raise ValueError("Tokenizer must have an EOS token")
1220
+ if generation_config.max_length == GenerationConfig().max_length:
1221
+ generation_config.max_length = self.tokenizer.model_max_length
1222
+ if generation_config.pad_token_id is None:
1223
+ generation_config.pad_token_id = self.tokenizer.pad_token_id or self.tokenizer.eos_token_id
1224
+ if generation_config.bos_token_id is None:
1225
+ generation_config.bos_token_id = self.tokenizer.bos_token_id or self.tokenizer.eos_token_id
1226
+ if generation_config.eos_token_id is None:
1227
+ generation_config.eos_token_id = self.tokenizer.eos_token_id
1228
+ return generation_config
prediction.jsonl ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"question_id": "0", "text": "このイラストは、著名な映画監督である宮崎駿の作品であると考えられます。彼の作品は、独特のキャラクターデザインや細部へのこだわりが特徴です。このイラストには、手に持った羽根や、周囲に散らばった本、そして作業に集中している様子が描かれており、宮崎駿の作品に見られるような幻想的で創造的な要素が感じられます。また、彼の作品はしばしば自然や動物をテーマにしているため、羽根や本といったアイテムも彼のスタイルに合致しています。このように、イラストの特徴やテーマから、宮崎駿の作品である可能性が高いと推測できます。", "answer": "この作品は宮崎駿監督によるものだと考えられます。画像の説明から、細部への注意と物語の中での小さなアイテムの重要性を示すスタイルが宮崎駿の作品に特徴的です。また、「君たちはどう生きるか」というタイトルも、宮崎駿の作品のテーマに合致しています。", "input_text": "この作品は著名な映画監督により制作されました。イラストから誰の作品だと考えられますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
2
+ {"question_id": "1", "text": "映像に写っている少年は、羽根を切ったり、羽根の先を削ったりしています。", "answer": "映像に写っている少年は、机に置かれた青色の鳥の羽のうちの一つを小型ナイフで加工しています。机の左側には竹の棒、赤いワイヤー、2本の鉛筆が置かれており、右側には数冊の本といくつかの書類が配置されています。", "input_text": "映像に写っている少年は何をしていますか?", "heron-bench": {"score": 9, "score_gpt": 10}}
3
+ {"question_id": "2", "text": "鳥の羽の色は青色です。", "answer": "鳥の羽の色は青色です。", "input_text": "鳥の羽の色は何色でしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
4
+ {"question_id": "3", "text": "机の上には2本の鉛筆が置かれています。", "answer": "机の上には2本の鉛筆が置かれています。これらは机の左側に配置されています。", "input_text": "机の上には何本の鉛筆が置かれていますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
5
+ {"question_id": "4", "text": "このイラストには、男性がテーブルの上で作業をしている様子が描かれています。彼は手にナイフを持ち、青い羽を切っています。テーブルの上には、いくつかの本が散らばっており、作業のための資料として使われているようです。\n\n男性の周りには、羽の他にもいくつかの羽が見え、彼がそれらを整理している様子が伺えます。テーブルの一部には、羽を切るための道具や、作業に必要なアイテムが置かれているようです。全体的に、彼は集中して作業に取り組んでいる印象を与えます。", "answer": "このイラストでは、少年が机に座り、一枚の青い鳥の羽を小型ナイフで加工している様子が描かれています。机の左側には竹の棒、赤いワイヤー、2本の鉛筆が配置されており、右側には数冊の本といくつかの書類が整然と置かれています。また、机の上にはもう一枚の青い鳥の羽が置かれています。", "input_text": "このイラストについて詳しく説明してください。", "heron-bench": {"score": 8, "score_gpt": 10}}
6
+ {"question_id": "5", "text": "このイラストは、アニメーション映画『千と千尋の神隠し』のシーンを描いています。物語は、主人公の千尋が不思議な世界に迷い込むところから始まります。千尋は、両親と共に車で移動中に、突然のトンネルを通り抜け、異世界にたどり着きます。この世界では、両親が豚に変身してしまうという驚くべき出来事が起こります。\n\n千尋は、この異世界で働くために、湯婆婆の経営する「油屋」という温泉施設に雇われます。そこで、彼女はさまざまなキャラクターと出会い、成長していきます。このシーンでは、千尋が湯婆婆や他のキャラクターたちと一緒に食事をしている様子が描かれています。テーブルにはケーキやカップが並び、和やかな雰囲気が漂っています。この場面は、千尋が新しい環境に適応し、仲間たちとの絆を深める重要な瞬間を象徴しています。", "answer": "このイラストは、「千と千尋の神隠し」という映画の一場面を描いています。この作品では、主人公の少女・千尋が不思議な世界に迷い込み、両親を豚に変えられた後、彼らを元に戻すために奮闘します。千尋はこの世界で様々な個性的なキャラクターに出会い、成長していく物語です。", "input_text": "このイラストが示す作品のあらすじを詳細に教えてください。", "heron-bench": {"score": 10, "score_gpt": 8}}
7
+ {"question_id": "6", "text": "この映像の中で明らかに人間ではないのは、白いマスクをかぶったキャラクターです。彼は他のキャラクターたちと一緒にテーブルに座っていますが、その外見から人間ではないことがわかります。", "answer": "この映像の中で明らかに人間ではないのはカオナシです。カオナシは化け物であり、千尋の左隣に位置しています。また、湯婆婆も人間とは異なる特徴を持つキャラクターですが、カオナシが最も人間ではない外見をしています。", "input_text": "この映像の中で明らかに人間ではないのはどれでしょうか?", "heron-bench": {"score": 8, "score_gpt": 9}}
8
+ {"question_id": "7", "text": "このイラストの少女の名前は「千尋」です。", "answer": "イラストの少女の名前は千尋です。", "input_text": "イラストの少女の名前はなんですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
9
+ {"question_id": "8", "text": "いいえ、一番左にいるのは人間ではなく、白い仮面をかぶったキャラクターです。", "answer": "一番左にいるのは人間ではありません。それはカオナシという化け物です。", "input_text": "一番左にいるのは人間でしょうか?", "heron-bench": {"score": 9, "score_gpt": 10}}
10
+ {"question_id": "9", "text": "このイラストには、テーブルを囲んで座っている3人のキャラクターが描かれています。テーブルの上には、ケーキやカップ、フォークが並んでおり、食事を楽しんでいる様子が伺えます。テーブルの中央には、大きなケーキがあり、その周りにはいくつかのカップが配置されています。\n\nキャラクターの一人は、テーブルの左側に座っており、もう一人は右側にいます。さらに、テーブルの奥には、もう一人のキャラクターが見えます。テーブルの上には、フォークが2本あり、それぞれのカップの近くに置かれています。また、テーブルの上には花瓶も見え、部屋の雰囲気を和らげています。全体的に、和やかな食事のシーンが表現されています。", "answer": "このイラストでは、中心に千尋が大きなケーキ、紅茶、小菓子が並ぶテーブルに座っており、彼女の左隣には無表情のカオナシが立っています。千尋の右側には、特徴的な大きな鼻と目、そして独特な髪型を持つ老婦人の湯婆婆が微笑みながら座っています。画像の背景には、食器が並べられた食器棚が配置されています。", "input_text": "このイラストについて詳しく説明してください。", "heron-bench": {"score": 7, "score_gpt": 10}}
11
+ {"question_id": "10", "text": "この作品は、水墨画の技法を用いて描かれており、その独特な表現力が評価されています。水墨画は、墨の濃淡や筆の動きによって、自然の風景や物体の質感を表現する技法です。この作品では、山や木々、建物が描かれており、それぞれの要素が墨の濃淡によって強調されています。特に、山の輪郭や木の枝の細部が、筆のタッチによって生き生きと表現されており、観る者に深い印象を与えます。\n\nまた、水墨画はしばしばシンプルな構図と余白を重視し、その中で物語や感情を伝えることが求められます。この作品も、余白を巧みに使い、自然の美しさと静けさを強調しています。さらに、作品のタイトルや署名が含まれていることで、作者の意図や背景が感じられ、鑑賞者に深い理解を促します。このように、技法と構成が相まって、この作品は高い評価を得ているのです。", "answer": "この作品は、雪舟の独特な技法と空間構成によって高く評価されています。彼の強調された輪郭線と細い線による簡略化された表現は、日本の山岳風景を独自の視点で捉え、深い情感と静謐な美を伝えています。また、構築的な空間構成は、見る者をその風景の中に引き込み、自然との一体感を感じさせる効果を持っています。", "input_text": "この作品がなぜ評価されているのか、技法に触れて論じてください。", "heron-bench": {"score": 10, "score_gpt": 9}}
12
+ {"question_id": "11", "text": "作品に写っている人は、山の斜面を登っており、山の頂上に向かっています。", "answer": "作品に写っている人は、画像の下方にある坂道から家に向かって登っていま��。この人物は右下に位置する川の近くから出発し、左の中央にある家を目指している様子が描かれています。", "input_text": "作品に写っている人はどこからどこに向かっていますか?", "heron-bench": {"score": 6, "score_gpt": 9}}
13
+ {"question_id": "12", "text": "この水墨画の作品名は「雪峰禅寺」です。", "answer": "この水墨画の作品名は「秋冬山水図」です。雪舟筆による日本の山岳風景を描いた作品で、構築的な空間構成と強調された輪郭線、細い線による簡略化された技法が特徴です。", "input_text": "この水墨画の作品名はなんですか?", "heron-bench": {"score": 1, "score_gpt": 10}}
14
+ {"question_id": "13", "text": "「雪峰禅」と書かれています。", "answer": "左の真ん中あたりには家が描かれています。この家は山岳風景の中に位置しており、周囲は自然に囲まれています。家の構造は簡略化された線で表現されており、細かいディテールは省略されています。", "input_text": "左の真ん中あたりには何が書かれていますか?", "heron-bench": {"score": 1, "score_gpt": 10}}
15
+ {"question_id": "14", "text": "この水墨画は、山々とその間に広がる谷を描いた風景画です。画面の中央には、山の斜面に沿って建物が見え、その周囲には木々が点在しています。山の頂上には雪が積もっており、冬の厳しさを感じさせます。\n\n画面の左側には、山の斜面が広がり、その下には谷が見えます。右側には、さらに高い山がそびえ立ち、その山肌には木々が生い茂っています。全体的に、水墨画特有の淡い色合いと筆のタッチが、自然の美しさを引き立てています。この作品は、静寂で荘厳な雰囲気を醸し出しており、自然の力強さと美しさを表現しています。", "answer": "この水墨画は、秋冬の山岳風景を描いたもので、左中央には小さな家が、右側にはいくつかの木々が配置されています。画面の右下部には川が流れ、その川沿いの坂道を一人の人物が家に向かって登っている様子が描かれています。この作品は、構築的な空間構成と強調された輪郭線、細い線による簡略化された技法が特徴です。", "input_text": "この水墨画について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
16
+ {"question_id": "15", "text": "この作品では、白い妖怪と緑の妖怪が対比されています。白い妖怪は、円形の輪の中を跳び跳ねている姿が描かれており、その動きからは軽やかさや楽しさが感じられます。一方、緑の妖怪は、より力強く、力強い印象を与えています。この対比は、色の違いだけでなく、動きや表情にも表れており、白い妖怪の軽快さと緑の妖怪の力強さが対照的に描かれています。このような対比は、視覚的な興味を引き、観る者に異なる感情や印象を与える効果があります。", "answer": "この作品では、風を操る風神と雷を起こす雷神を対比させています。風神は右側に描かれ、風を吹き出しているのに対し、雷神は左側に描かれ、太鼓を打って雷を起こしています。これにより、自然界の二つの強大な力、風と雷をユーモラスに表現しています。", "input_text": "この作品では、何と何を対比させていますか?", "heron-bench": {"score": 8, "score_gpt": 10}}
17
+ {"question_id": "16", "text": "この作品は、日本の伝統的な妖怪や神話のキャラクターを描いたもので、視覚的に非常に魅力的です。二つの異なるキャラクターが描かれており、それぞれが異なる動きや表情を持っています。このような作品は、日本の文化や歴史、そしてその背後にあるストーリーを伝える重要な役割を果たしています。また、妖怪や神話のキャラクターは、時には恐怖や神秘を象徴し、観る者に想像力をかき立てる効果があります。この作品を通じて、私たちは日本の伝統や美意識、そして物語の力について考えさせられるでしょう。さらに、これらのキャラクターは、現代のポップカルチャーやアニメにも影響を与えているため、その文化的な影響力も無視できません。", "answer": "この作品は、自然の力を人間がコントロールできないものとして、しかし同時にその力をユーモラスに捉えることで、恐怖や畏敬の念を和らげる方法を示唆しています。風神と雷神の表現を通じて、自然現象への敬意と、それに対する人間の創造的な対応を伝えています。また、風と雷という自然の力を擬人化することで、それらの力が持つ生命力や動きを視覚的に表現しています。", "input_text": "この作品は私達に何を伝えていますか?", "heron-bench": {"score": 8, "score_gpt": 10}}
18
+ {"question_id": "17", "text": "この屏風は、江戸時代の浮世絵師である歌川国芳によって作成されました。", "answer": "この屏風は江戸時代中期を代表する画家、尾形光琳によって作成されました。", "input_text": "この屏風は誰によって作成されましたか?", "heron-bench": {"score": 1, "score_gpt": 10}}
19
+ {"question_id": "18", "text": "この作品は江戸時代のもので、18世紀後半から19世紀初頭にかけて描かれたと考えられます。", "answer": "この作品は江戸時代中期の作品です。尾形光琳によって描かれた風神雷神図屛風は、その時代を代表する芸術作品の一つとされています。", "input_text": "これはいつの時代の作品でしょうか?", "heron-bench": {"score": 9, "score_gpt": 10}}
20
+ {"question_id": "19", "text": "この屏風絵は、日本の伝統的な美術様式で描かれたもので、2つの異なる妖怪が描かれています。左側には、白い毛皮を持つ妖怪が、右側には緑色の肌を持つ妖怪が描かれています。両方の妖怪は、それぞれ異なるポーズをとっており、動きのある表現がされています。\n\n左側の妖怪は、まるで何かを捕まえようとしているかのように、手を伸ばしている姿が印象的です。一方、右側の妖怪は、より力強い姿勢で、まるで何かを追いかけているかのようです。背景には、自然の要素が描かれており、妖怪たちの存在感を引き立てています。この屏風絵は、日本の妖怪文化や伝説を表現しており、見る者に強い印象を与えます。", "answer": "この屏風絵は、尾形光琳による風神雷神図屛風で、二枚一対の屏風絵です。右側の屏風には、力強く風を吹き出している風神が描かれており、左側の屏風には、太鼓を激しく打ち鳴らして雷を起こしている雷神が描かれています。両者は動きが大きく、表情もユーモラスで、自然の力を生き生きと表現しています。", "input_text": "この屏風絵について詳しく説明してください。", "heron-bench": {"score": 4, "score_gpt": 10}}
21
+ {"question_id": "20", "text": "この作品は、動物たちが楽しそうに走り回る様子を描いたユーモラスな絵です。特に、カエルやウサギ、そして人間が一緒に競争しているシーンが描かれており、観る者に笑いを誘います。絵の中では、カエルがウサギを追いかけている姿が印象的で、彼らの動きからは生き生きとしたエネルギーが感じられます。また、背景には山々が広がり、自然の中での遊び心満載のシーンが展開されています。この作品は、動物たちの無邪気さや、競争の楽しさを表現しており、見る人に温かい気持ちをもたらします。", "answer": "この絵巻物は、京都の高山寺に伝わる鳥獣人物戯画の一部で、猿、兎、カエルが描かれた紙本墨画です。猿は首に麦わら帽子をかけ、一匹の兎と二匹のカエルに追いかけられる様子が描かれていますが、もう一匹の兎は猿とは反対方向を向いています。この作品は、動物たちを通じて人間社会の風刺を描いたものと解釈されており、平安時代のユーモアと洞察が感じられます。", "input_text": "あなたは美術館の学芸員です。この作品にどのような説明文をつけて展示しますか?", "heron-bench": {"score": 6, "score_gpt": 10}}
22
+ {"question_id": "21", "text": "この作品には、カエルが3匹います。", "answer": "この作品の中にはカエルが二匹います。", "input_text": "この作品のなかに、カエルは何匹いますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
23
+ {"question_id": "22", "text": "この作品の中には、兎が2匹います。", "answer": "この作品の中には兎が二匹います。一匹は猿を追いかけており、もう一匹は猿とは反対側に向かっています。", "input_text": "この作品の中に兎は何匹いますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
24
+ {"question_id": "23", "text": "この墨画は、動物たちが丘を駆け下りる様子を描いています。画面には、さまざまな動物が描かれており、特にカエルやウサギが目立っています。カエルは丘の斜面を滑り降りる姿が描かれており、その動きからは勢いを感じることができます。\n\nウサギは、丘の上から下へと走り降りる姿が描かれており、その姿勢からは楽しそうな様子が伝わってきます。また、他の動物たちも丘を駆け下りており、全体的に活気に満ちたシーンが展開されています。この墨画は、動物たちの動きや表情を巧みに捉えており、自然の中での生き生きとした瞬間を表現しています。", "answer": "この墨画は、猿が麦わら帽子を首にかけており、一匹の兎と二匹のカエルに追いかけられている様子を描いています。猿は画像の右側に位置し、追いかける兎とカエルはその左側にいます。また、もう一匹の兎は猿とは反対方向、つまり画像の左側を向いています。", "input_text": "この墨画について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 9}}
25
+ {"question_id": "24", "text": "この作品は、現在の東京都を対象に描かれたと考えられます。理由は、作品に描かれている風景や建物の特徴から、江戸時代の東京の様子を表現していると推測されるからです。特に、江戸時代の東京は「江戸」として知られ、多くの人々が集まり、商業や文化が栄えた場所でした。また、作品には多くの人々や舟が描かれており、当時の賑わいを示しています。さらに、背景に描かれた山は、富士山を連想させるものであり、江戸時代の東京の風景を象徴する要素の一つです。これらの要素から、この作品は東京都を対象に描かれたものであると推測できます。", "answer": "この作品は現在の東京都を対象に描かれています。理由は、画中に江戸日本橋が描かれており、江戸城の存在が示されているためです。江戸は現在の東京都にあたります。", "input_text": "この作品は現在のどの都道府県を対象に描かれたのか教えてください。また、なぜそのように考えたのか教えてください。", "heron-bench": {"score": 9, "score_gpt": 10}}
26
+ {"question_id": "25", "text": "町並みの先に写っているお城の名前は「富士山」です。お城の向こう側には、富士山が写っています。", "answer": "町並みの先に写っているお城の名前は江戸城です。江戸城の向こう側には富士山が写っています。", "input_text": "町並みの先に写っているお城の名前は何でしょうか?また、お城の向こう側には何が写っていますか?", "heron-bench": {"score": 1, "score_gpt": 10}}
27
+ {"question_id": "26", "text": "この作品は、江戸時代の日本、特に富士山が見える場所からの景色を描いています。", "answer": "この作品は江戸の日本橋からの景色を描いています。画中では、日本橋の賑わいとその上を行き交う人々が描かれており、背景には江戸城とその向こうに霞む富士山が見えます。", "input_text": "この作品はどこからの景色を描いていますか?", "heron-bench": {"score": 6, "score_gpt": 10}}
28
+ {"question_id": "27", "text": "この作品の作者は歌川広重です。", "answer": "この作品の作者は葛飾北斎です。彼は「冨嶽三十六景」シリーズの中で《江戸日本橋》を描いており、この作品はその一部です。北斎は江戸時代後期の日本の浮世絵師として広く知られています。", "input_text": "この作品の作者は誰ですか?", "heron-bench": {"score": 1, "score_gpt": 10}}
29
+ {"question_id": "28", "text": "この絵画は、江戸時代の日本の風景を描いたもので、川沿いの町並みが広がっています。川には多くのボートが浮かんでおり、その中には人々が乗っている様子が見受けられます。ボートは川の両側に並んでおり、賑やかな雰囲気を醸し出しています。\n\n町の背景には、伝統的な日本の建物が立ち並び、その中には富士山が遠くに見える風景が描かれています。富士山は日本の象徴的な山であり、この絵画の重要な要素となっています。また、町の中心には橋があり、その上を人々が行き交っている様子が描かれています。\n\n絵画全体は、色鮮やかで、特に青い空と川の水面が印象的です。人々は様々な服装をしており、当時の生活様式や文化を感じさせる要素が豊富に含まれています。この作品は、日本の歴史や文化を理解するための貴重な資料となっています。", "answer": "この絵画は、葛飾北斎の「冨嶽三十六景」シリーズの一部で、「江戸日本橋」を描いています。画面下部には、擬宝珠を中心に賑わう人々が描かれ、その背後には大胆な透視法を用いて描かれた江戸の街並みが広がり、さらにその向こうには江戸城が見えます。画面の最も遠い背景には、霞むような表現で富士山が描かれており、日本の自然と都市生活の調和を象徴しています。", "input_text": "この絵画に���いて詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
30
+ {"question_id": "29", "text": "こたつと言えば、みかんが思い浮かびます。", "answer": "こたつと言えば、みかんが思い浮かびます。画像には、赤いこたつの上にみかんが盛られた皿が置かれています。この光景は、冬の暖かいひとときを象徴しています。", "input_text": "こたつと言えば、何の果物が思い浮かびますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
31
+ {"question_id": "30", "text": "この部屋は日本のスタイルで、畳の床と布団が特徴的です。", "answer": "写真に写っている部屋は日本のスタイルです。畳の和室、こたつ、そしてみかんが盛られた皿は日本の伝統的な冬の風景を表しています。また、部屋の収納も日本の和室によく見られるデザインです。", "input_text": "写真に写っている部屋はどこの国のスタイルでしょうか?", "heron-bench": {"score": 8, "score_gpt": 10}}
32
+ {"question_id": "31", "text": "こたつです。", "answer": "中央にあるテーブルの名称は「こたつ」です。", "input_text": "中央にあるテーブルの名称はなんですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
33
+ {"question_id": "32", "text": "机の上にはオレンジが乗っています。", "answer": "机に乗っている果物はみかんです。みかんは皿に盛られており、こたつの上に置かれています。", "input_text": "机に乗っている果物は何ですか?", "heron-bench": {"score": 6, "score_gpt": 10}}
34
+ {"question_id": "33", "text": "この画像には、和室の床に敷かれた布団の上に小さなテーブルが置かれています。テーブルの上には、オレンジが入ったボウルが2つあり、色とりどりのオレンジが並んでいます。また、テーブルの近くには、いくつかのリンゴも見えます。\n\n布団は部屋の中央に広がっており、その上にはテーブルがしっかりと置かれています。テーブルの周りには、オレンジやリンゴが散らばっており、和室の落ち着いた雰囲気を引き立てています。全体的に、リラックスした空間が感じられるシーンです。", "answer": "この写真は、和室の中心に設置された赤いこたつを捉えています。こたつの上には、みかんが数個盛られた皿と、いくつかの小菓子が置かれており、和室の雰囲気に温かみを加えています。部屋の側面には、扉付きの収納が見え、部屋の整理整頓に役立っている様子が伺えます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 4, "score_gpt": 10}}
35
+ {"question_id": "34", "text": "旅客機に描かれているキャラクターの中で最も有名なのは、ピカチュウです。", "answer": "旅客機に写っている最も有名なキャラクターの名前はピカチュウです。", "input_text": "旅客機に写っているキャラクターで最も有名なキャラクターの名前を教えてください。", "heron-bench": {"score": 10, "score_gpt": 10}}
36
+ {"question_id": "35", "text": "ジェットエンジンにはポケモンの絵が描かれています。", "answer": "ジェットエンジンにはポケモンボールの絵が描かれています。", "input_text": "ジェットエンジンには何の絵が描かれていますか?", "heron-bench": {"score": 8, "score_gpt": 10}}
37
+ {"question_id": "36", "text": "写真には2機の飛行機が写っています。", "answer": "写真には2機の飛行機が写っています。", "input_text": "写真には何機の飛行機が写っていますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
38
+ {"question_id": "37", "text": "写真の奥の方には、海が広がっています。", "answer": "写真の奥の方には、海があり白波が立っています。", "input_text": "写真の奥の方には何が写っていますか?", "heron-bench": {"score": 9, "score_gpt": 10}}
39
+ {"question_id": "38", "text": "画像には、空港の滑走路に停まっている2機のカラフルな飛行機が写っています。これらの飛行機は、アニメのキャラクターで装飾されており、非常に目を引くデザインです。1機は左側に位置し、もう1機はその右側にあります。\n\n滑走路の背景には、海が広がっており、飛行機の鮮やかな色合いが海の青さと対比を成しています。また、滑走路の近くには数隻のボートが見え、海の風景をさらに引き立てています。全体的に、このシーンは楽しい雰囲気を醸し出しており、旅行や冒険の期待感を感じさせます。", "answer": "この写真には、ポケモンのキャラクターがデザインされた2機のANAの旅客機が飛行場に停まっています。一方のジェット機の先端にはピカチュウが描かれており、ジェットエンジンにはポケモンボールのデザインが施されています。背景には海が広がり、白波が見えます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 8, "score_gpt": 9}}
40
+ {"question_id": "39", "text": "力士たちは土俵の上で相撲の試合を行っています。彼らは互いに競い合い、力と技術を駆使して勝利を目指しています。", "answer": "力士たちは土俵で相撲の儀式を行っています。中央の横綱は土俵入りの型を演じており、これは相撲の伝統的な儀式の一つです。他の二人の力士はおそらく横綱の土俵入りを見守っているか、次の取組の準備をしている状態です。", "input_text": "力士たちは何を行っているか説明してください。", "heron-bench": {"score": 4, "score_gpt": 10}}
41
+ {"question_id": "40", "text": "水引幕から垂れている房の色は赤色です。", "answer": "水引幕から垂れている房の色は赤、緑、白、黒の4色です。", "input_text": "水引幕から垂れている房の色は何色ですか?", "heron-bench": {"score": 4, "score_gpt": 10}}
42
+ {"question_id": "41", "text": "土俵には2人の力士がいます。", "answer": "土俵には3人の力士がいます。中央で横綱が土俵入りの型を演じており、他の2人はおそらく彼の土俵入りを見守っています。", "input_text": "土俵には何人の力士がいますか?", "heron-bench": {"score": 6, "score_gpt": 10}}
43
+ {"question_id": "42", "text": "観客席は非常に混雑しており、多くの人々が座っています。", "answer": "観客席は満員で、数百人の観客が詰めかけています。多くの人がスマートフォンで撮影をしている様子が見受けられます。観客は土俵を囲むように座っており、全席が埋まっている状態です。", "input_text": "観客席に人はどのくらい入っていますか?", "heron-bench": {"score": 8, "score_gpt": 9}}
44
+ {"question_id": "43", "text": "この画像には、日本の伝統的な相撲の試合が行われている様子が写っています。土俵の上で2人の力士が激しく戦っており、その周りには多くの観客が集まっています。観客は試合を見守りながら、興奮した様子で応援しています。\n\n土俵の周囲には、さまざまな人々が立っており、彼らの表情からは試合の緊張感が伝わってきます。観客の中には、携帯電話で写真を撮っている人も見受けられます。また、観客の中にはネクタイを締めた人もおり、フォーマルな服装で試合を楽しんでいる様子が伺えます。\n\n全体的に、この場面は日本の文化と伝統が色濃く反映されており、力士たちの力強い動きと観客の熱気が融合した、非常に活気のある雰囲気が感じられます。", "answer": "この写真は、相撲場所の土俵で撮影されたもので、中央には横綱が土俵入りの型を演じている様子が写っています。土俵の周りには他の2人の力士がおり、背景には水引幕から垂れる赤、緑、白、黒の4本の房が見えます。観客席は満員で、多くの観客がスマートフォンでこの瞬間を撮影している様子が確認できます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 5, "score_gpt": 10}}
45
+ {"question_id": "44", "text": "この写真に写っているのは日本の料理です。", "answer": "写真に写っているのは日本の料理です。天ぷらは日本の伝統的な揚げ物料理で、野菜や海鮮を衣で包んで揚げたものです。この写真には、特にエビの天ぷらといくつかの野菜の天ぷらが盛り付けられており、日本料理の一例として認識されます。", "input_text": "写真に写っているのはどこの国の料理が教えてください。", "heron-bench": {"score": 10, "score_gpt": 10}}
46
+ {"question_id": "45", "text": "野菜の天ぷらはエビの天ぷらの隣に配置されています。", "answer": "野菜の天ぷらはエビの天ぷらの手前に置かれています。左からパプリカ、茄子、シシトウの順に並んでおり、その後ろに2尾のエビの天ぷらが配置されています。この配置により、野菜とエビの天ぷらが一緒に綺麗に盛り付けられている様子が見て取れます。", "input_text": "野菜の天ぷらとエビの天ぷらの位置関係はどのようになっていますか?", "heron-bench": {"score": 4, "score_gpt": 10}}
47
+ {"question_id": "46", "text": "エビの天ぷらは2つあります。", "answer": "エビの天ぷらは2尾あります。", "input_text": "エビの天ぷらはいくつありますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
48
+ {"question_id": "47", "text": "野菜の天ぷらは2つあります。", "answer": "野菜の天ぷらは3つあります。左からパプリカ、茄子、シシトウの順に盛り付けられています。", "input_text": "野菜の天ぷらはいくつありますか?", "heron-bench": {"score": 4, "score_gpt": 10}}
49
+ {"question_id": "48", "text": "この画像には、白い紙の上に盛り付けられた天ぷらが写っています。天ぷらには、エビ、ナス、ピーマン、そして赤いトマトが含まれています。エビは特に目を引く存在で、他の食材とともにカラフルな盛り付けをしています。\n\nテーブルの上には、天ぷらの他にもカップが置かれており、飲み物が入っているようです。また、テーブルの一部には椅子も見え、食事を楽しむための準備が整っている様子が伺えます。全体的に、食欲をそそる美味しそうな料理が並んでいます。", "answer": "この写真は、美しく盛り付けられた天ぷらの一皿を捉えています。前方にはパプリカ、茄子、シシトウの野菜天ぷらが左から順に並び、その奥には2尾のエビの天ぷらが置かれています。写真の右奥には、グラスが1つ配置されており、全体的に料理の魅力を引き立てるシンプルながらも洗練された演出がなされています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
50
+ {"question_id": "49", "text": "この料理は、肉や野菜がたっぷりと盛り付けられたボウルで、特に鶏肉やネギが目立っています。このような料理には、醤油やごま油、またはラー油などの調味料が非常に合います。醤油は、料理の風味を引き立て、塩味を加えるのに最適です。また、ごま油は香ばしさを加え、料理全体に豊かな風味をもたらします。さらに、ラー油を少し加えることで、ピリッとした辛味が加わり、食欲をそそる一品に仕上がります。これらの調味料を組み合わせることで、料理の味わいが一層引き立ち、より美味しく楽しむことができるでしょう。", "answer": "この料理にはラー油や酢がぴったりです。ラー油は辛味を加え、酢は麺にさっぱりとした風味をもたらします。これらの調味料は油そばの濃厚な味わいを引き立て、バランスの良い食感を提供します。", "input_text": "この料理を食べるときにぴったりの調味料を教えてください。", "heron-bench": {"score": 7, "score_gpt": 10}}
51
+ {"question_id": "50", "text": "このラーメンは、一般的なラーメンとは異なる特徴を持っています。まず、ラーメンの上には、ネギや肉、卵などのトッピングが豊富に盛り付けられています。特に、ネギがたっぷりと使われているため、見た目にも鮮やかで食欲をそそります。また、ラーメンのスープは、通常のラーメンとは異なる風味を持っている可能性があります。さらに、ラーメンの器は黒いボウルで、全体的に高級感や特別感を演出しています。このような特徴から、このラーメンは一般的なラーメンよりも豪華で、特別な場面や特別なメニューとして提供されることが考えられます。", "answer": "油そばは普通のラーメンと異なり、スープがなく、特製の油と醤油ベースのソースで味付けされています。また、トッピングには温泉卵、角切りチャーシュー、刻みネギ、海苔、メンマが含まれ、ラー油や酢を好みで加えることが一般的です。これに対して、普通のラーメンはスープベースで提供され、具材や味付けにも違いがあります。", "input_text": "普通のラーメンとの違いを教えてください。", "heron-bench": {"score": 5, "score_gpt": 10}}
52
+ {"question_id": "51", "text": "この写真の料理は、ラーメンの上に様々なトッピングが載ったもので、特にネギや肉が目立っています。", "answer": "この写真は東京油組の油そばの料理です。トッピングには温泉卵、角切りチャーシュー、刻みネギ、海苔、メンマがあり、ラー油や酢が調味料として添えられています。油そばはスープのない麺料理で、ラーメンに似ています。", "input_text": "この写真の料理はなんですか?", "heron-bench": {"score": 6, "score_gpt": 10}}
53
+ {"question_id": "52", "text": "写真に写っている卵は半熟の状態で、麺の上に置かれています。", "answer": "写真に写っている卵は温泉卵です。黄身が半熟状態で、白身はやわらかく固まっています。この温泉卵は油そばの上に乗せられており、他のトッピングと一緒に中���に配置されています。", "input_text": "写真に写っている卵はどんな状態ですか?", "heron-bench": {"score": 9, "score_gpt": 10}}
54
+ {"question_id": "53", "text": "画像には、テーブルの上に置かれた黒いボウルが写っています。このボウルには、麺と肉、そしてネギがたっぷりと盛り付けられています。ボウルの周りには、いくつかの調味料が置かれており、食事を楽しむ準備が整っています。\n\nテーブルの上には、ボウルの他にもカップが2つ見えます。1つはボウルの左側にあり、もう1つは右側に配置されています。また、ボウルの近くには、箸が置かれているのが見えます。全体的に、食事の準備が整った温かみのあるシーンが広がっています。", "answer": "この写真は、東京油組の油そばを映しており、麺の上には温泉卵、角切りチャーシュー、刻みネギ、海苔、メンマが美しくトッピングされています。麺は艶やかで、トッピングの配置がバランス良く、色彩豊かな見た目をしています。また、写真の端にはラー油と酢の小皿が置かれており、これらの調味料が油そばの味を引き立てることが予想されます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 7, "score_gpt": 9}}
55
+ {"question_id": "54", "text": "この写真に写っている彫像は、伝統的な日本の狛犬(こまいぬ)であり、通常は神社や寺院の入口に置かれています。狛犬は、邪悪な霊や悪運を防ぐ守護神としての役割を果たします。この彫像は、建物の前に立っており、訪れる人々に安心感を与え、神聖な場所を守る存在としての重要性を持っています。また、狛犬は通常、一対で置かれることが多く、それぞれが異なる表情や姿勢を持っていることが一般的です。この彫像は、その地域の文化や歴史を象徴するものでもあり、訪れる人々にその場所の特別な意味を伝える役割も果たしています。", "answer": "この写真に写っているシーサーの彫像は、琉球の伝統的な守り神としての役割を持っています。主に悪霊や災いを避け、家や村を守るために屋根の上や門の入り口に設置されます。沖縄県文化財指定の文字が示すように、このシーサーは文化的に重要な意味を持つアイテムであり、地域の伝統や信仰を象徴しています。", "input_text": "この写真に写っている彫像の役割について教えてください。", "heron-bench": {"score": 4, "score_gpt": 10}}
56
+ {"question_id": "55", "text": "この写真は沖縄県で撮影されました。", "answer": "この写真は沖縄県で撮影されました。写真には「沖縄県文化財指定」という文字が見えるため、撮影場所が沖縄県であることが確認できます。また、シーサーは沖縄の伝統的な守り神であり、その存在も撮影地が沖縄県であることを支持しています。", "input_text": "この写真は何県で撮影されましたか?", "heron-bench": {"score": 10, "score_gpt": 10}}
57
+ {"question_id": "56", "text": "写真に写っている獣像は「狛犬」です。", "answer": "写真に写っている獣像の名前は「シーサー」です。シーサーは琉球の伝統的な守り神で、魔除けの目的で屋根の上などに設置されます。", "input_text": "写真に写っている獣像の名前はなんですか?", "heron-bench": {"score": 1, "score_gpt": 10}}
58
+ {"question_id": "57", "text": "画像にはシーサーが1体写っています。", "answer": "シーサーは1体写っています。", "input_text": "シーサーは何体写っていますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
59
+ {"question_id": "58", "text": "この画像には、建物の前に立つ大きなシーサーの像が写っています。シーサーは沖縄の伝統的な守り神で、その特徴的な姿が目を引きます。像は建物の壁に寄りかかっており、その存在感が際立っています。\n\nシーサーの像の近くには、いくつかの鉢植えが配置されており、緑が建物の外観を引き立てています。鉢植えは、シーサーの像の左側と右側にそれぞれ置かれており、全体的に和やかな雰囲気を醸し出しています。また、建物の上部には電線が見え、現代的な要素も感じられます。", "answer": "この写真は、琉球の伝統的な守り神であるシーサーの彫像を特徴としています。彫像は、魔除けとして屋根の上に設置されている様子が写されており、背景には沖縄県文化財指定の文字が見える琉球の建物があります。また、左後方には緑豊かな木が生い茂っています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 9}}
60
+ {"question_id": "59", "text": "この写真に写っている神社は、赤い鳥居とその背後に広がる山々が特徴的です。鳥居は水の上に立っており、その周囲には美しい自然が広がっています。この神社は、日本の伝統的な建築様式を反映しており、特に赤い色合いが目を引きます。また、鳥居の近くには木々が生い茂っており、自然との調和が感じられます。このような神社は、訪れる人々に静けさや神聖さを提供し、観光地としても人気があります。", "answer": "この写真に写っている厳島神社の特徴として、目立つのはその象徴的な赤い鳥居で、潮の満ち引きによって海上に浮かぶかのように見えます。背景には緑豊かな山々が広がり、その自然の美しさと調和しています。また、鳥居の左右には厳島神社の伝統的な建築様式を持つ建物が見え、その歴史的な雰囲気を一層際立たせています。", "input_text": "この写真に写っている神社の特徴について説明してください。", "heron-bench": {"score": 9, "score_gpt": 10}}
61
+ {"question_id": "60", "text": "この写真に写っている鳥居は、通常の鳥居とは異なり、水の中に立っています。一般的に、鳥居は神社の入り口に設置され、地面にしっかりと固定されていますが、ここでは水の中に浮かんでいるように見えます。この特異な状況は、周囲の環境や季節によって引き起こされる可能性があります。例えば、洪水や高水位の影響で、鳥居が水に浸かっている状態が見られることがあります。このような状況は、地域の自然環境や気候条件を反映しており、訪れる人々にとって印象的な光景となるでしょう。また、この鳥居の存在は、神聖な場所であることを示す一方で、自然の力の強さや変化をも象徴しています。", "answer": "この写真に写っている鳥居の普通とは違うところは、水に浮かんでいる点です。通常、鳥居は地上に設置されますが、この鳥居は潮の満ち引きによって海上に現れる特徴があります。また、その背後に広がる緑豊かな山々とのコントラストが美しい景色を作り出しています。", "input_text": "この写真に写っている鳥居の普通とは違うところはどこですか?", "heron-bench": {"score": 8, "score_gpt": 9}}
62
+ {"question_id": "61", "text": "この写真は厳島神社で撮影されました。厳島神社は広島県廿日市市宮島町に位置し、海に浮かぶ鳥居が特徴的です。", "answer": "この写真は日本の広島県にある厳島神社で撮影されました。", "input_text": "この写真はどこの神社で撮影されましたか?", "heron-bench": {"score": 10, "score_gpt": 10}}
63
+ {"question_id": "62", "text": "写真の鳥居は水の中にあり、その背後には山々が広がっています。", "answer": "写真の鳥居は、緑豊かな山々を背景にして、厳島神社の前に位置しています。左右には厳島神社の建物が見え、山のふもとにはホテルがあります。この鳥居は水面に立っているように見えます。", "input_text": "写真の鳥居はどこにありますか?", "heron-bench": {"score": 10, "score_gpt": 9}}
64
+ {"question_id": "63", "text": "この画像には、美しい湖の上に浮かぶ赤い鳥居が写っています。鳥居は日本の神社の入り口を示すもので、湖の水面に映り込んでいます。周囲にはいくつかの建物が見え、その中には神社の一部と思われる建物も含まれています。\n\n湖の近くには、いくつかのボートが停泊しており、その中には小型のボートがいくつか見受けられます。また、湖の対岸には山々が広がっており、自然の美しさが際立っています。全体的に、静かで穏やかな雰囲気が漂う風景です。", "answer": "この写真は、緑豊かな山々を背景に、その前に位置する厳島神社の象徴的な赤い鳥居を捉えています。鳥居の左右には、厳島神社の伝統的な建築様式を持つ建物が見え、山のふもとにはホテルが建っています。この構図は、自然と人間の作り出した美が調和している様子を示しています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
65
+ {"question_id": "64", "text": "この写真の面白い点は、高層ビルの上に立つ大きなテレビ塔と、その近くに置かれた小さなレッドブルの缶の対比です。テレビ塔は非常に高く、その存在感が際立っていますが、その隣にあるレッドブ��の缶は、その大きさの違いがユーモラスに感じられます。この対比は、日常的なアイテムが巨大な構造物の近くに置かれることで、視覚的に面白い効果を生み出しています。また、レッドブルの缶は、エネルギー飲料としてのイメージを強調し、都市の活気やエネルギーを象徴しているとも考えられます。このように、異なるスケールの物体が共存することで、視覚的な興味を引き、観る人に印象的なシーンを提供しています。", "answer": "この写真の面白い点は、東京スカイツリーとRedBullの缶を模した広告オブジェが同一の視界に収まっていることです。スカイツリーの優雅な構造と、エネルギッシュなイメージのRedBull缶オブジェが対照的な印象を与え、都市のダイナミズムとクリエイティビティを象徴しています。また、高層ビルの背景がこのユニークなコントラストを一層際立たせています。", "input_text": "この写真の面白い点は何か説明してもらえますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
66
+ {"question_id": "65", "text": "この写真は、東京スカイツリーとその隣にある建物の高さを対比しています。スカイツリーは非常に高く、その隣の建物と比べてその大きさが際立っています。", "answer": "この写真は、東京スカイツリーという現代的な建築物と、RedBullの缶を模した広告オブジェがあるビルの屋上という、商業的なアイテムを対比しています。また、これらの特徴的なオブジェクトと背後に見える高層ビル群との間の都市的な景観も対比しています。", "input_text": "この写真は何と何を対比していますか?", "heron-bench": {"score": 6, "score_gpt": 9}}
67
+ {"question_id": "66", "text": "写真に写っているランドマークは東京スカイツリーです。", "answer": "写真に写っているランドマークの名称は東京スカイツリーです。", "input_text": "写真に写っているランドマークの名称はなんですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
68
+ {"question_id": "67", "text": "左側に写っている飲みものは「レッドブル」の缶です。", "answer": "左側に写っている飲み物はRedBullです。これはビルの屋上に設置されたRedBullの缶を模した広告オブジェによるものです。", "input_text": "左側に写っている飲みものは何ですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
69
+ {"question_id": "68", "text": "この画像には、東京スカイツリーの近くに立つ建物の前にある赤い缶が写っています。スカイツリーは非常に高く、その存在感が際立っています。赤い缶は、建物の前に置かれており、周囲の景色と対比を成しています。\n\nスカイツリーの背景には、青空が広がっており、その下に建物が立ち並んでいます。また、スカイツリーの近くには、いくつかの人が見え、彼らはスカイツリーを眺めたり、写真を撮ったりしているようです。全体的に、都市の活気とスカイツリーの壮大さが感じられるシーンです。", "answer": "この写真は、地上から見上げた青空の下の風景を捉えています。右側には、東京スカイツリーがそびえ立ち、左手にあるビルの屋上にはRedBullの缶を模した大きな広告オブジェが設置されています。このオブジェの後方には、いくつかの高層ビルが見え、都市の活気を感じさせます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
70
+ {"question_id": "69", "text": "この建物は16世紀に建設されました。", "answer": "金閣寺は室町時代に建設されました。", "input_text": "この建物はいつの時代に建設されましたか?", "heron-bench": {"score": 6, "score_gpt": 10}}
71
+ {"question_id": "70", "text": "写真の池には、金色の建物が写っています。この建物は池の中央に位置しており、その美しい反射が水面に映っています。", "answer": "写真の池には金閣寺が反射して写っています。池の表面は静かで、金閣寺の鮮やかな金色の外観が鮮明に映し出されています。また、池の周囲には緑豊かな庭園が広がっており、その一部も水面に映り込んでいます。", "input_text": "写真の池には何が写っていますか?", "heron-bench": {"score": 9, "score_gpt": 10}}
72
+ {"question_id": "71", "text": "この建物は「金閣寺」です。正式には「鹿苑寺」と呼ばれ、京都にある有名な寺院です。", "answer": "写真に写っている建物の名称は金閣寺です。", "input_text": "写真に写っている建物の名称はなん���すか?", "heron-bench": {"score": 10, "score_gpt": 10}}
73
+ {"question_id": "72", "text": "この建物は金色です。", "answer": "この建物は金色です。金閣寺はその名の通り、外壁が金箔で覆われており、その輝きが池の水面にも美しく反映されています。", "input_text": "この建物は何色でしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
74
+ {"question_id": "73", "text": "この画像には、美しい池の中央に浮かぶ金色の建物が写っています。この建物は、池の水面に映り込み、非常に印象的な景観を作り出しています。池の周りには緑豊かな木々が立ち並び、自然の美しさが際立っています。\n\n建物は二階建てで、金色の外観が特徴的です。池の水面には、その建物の反射が映り、まるで鏡のように見えます。また、池の周囲にはいくつかの木が点在しており、自然との調和が感じられます。全体的に、静かで穏やかな雰囲気が漂う風景です。", "answer": "この写真は、金色に輝く金閣寺が中心に位置しており、その美しい姿が静かな池に映り込んでいます。池の周囲には、様々な種類の緑の樹木が豊かに生い茂り、金閣寺の周囲を囲むように広がっています。金閣寺とその反射、そして周囲の緑が、和の美しさを際立たせる調和のとれた風景を作り出しています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 10, "score_gpt": 10}}
75
+ {"question_id": "74", "text": "ある日、二羽の白鳥が美しい緑の田んぼに降り立ちました。彼らは水辺で静かに佇み、周囲の自然を楽しんでいました。この田んぼは、穏やかな水が流れ、豊かな緑の草が生い茂る場所で、白鳥たちにとって理想的な休息の場所でした。\n\n白鳥たちは、お互いに寄り添いながら、穏やかな時間を過ごしていました。しかし、突然、空から大きな影が落ち、彼らの周りに何かが近づいてくるのを感じました。それは、田んぼの上を飛ぶ大きな鳥でした。白鳥たちは驚き、少し警戒しながらも、その鳥が何者であるのかを観察しました。\n\nその鳥は、白鳥たちに優しく近づき、彼らに話しかけました。その鳥は、この田んぼの守護者であり、白鳥たちが安全に過ごせるように見守っていると告げました。白鳥たちは、その鳥の優しさに感動し、安心してその場に留まることにしました。\n\nその後、白鳥た", "answer": "かつて、綺麗な水田に住む2羽の白鷺がいました。彼らは互いに背を向けて立っているものの、実は深い絆で結ばれた兄弟でした。ある日、彼らは互いの違いを乗り越え、力を合わせて水田を守る大冒険に出ることになります。", "input_text": "この白鳥二羽を主人公にしたおとぎ話を書いてください。", "heron-bench": {"score": 7, "score_gpt": 9}}
76
+ {"question_id": "75", "text": "2羽の鳥は、互いに反対の方向を向いています。", "answer": "2羽の白鷺は互いに反対方向を向いています。", "input_text": "2羽の鳥はどちらを向いていますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
77
+ {"question_id": "76", "text": "画像には2羽の鳥が写っています。", "answer": "画像には2羽の白鷺がいます。", "input_text": "鳥は何羽いますか?", "heron-bench": {"score": 10, "score_gpt": 10}}
78
+ {"question_id": "77", "text": "白い鳥が2羽います。", "answer": "画像に基づいて、鳥の種類は白鷺です。画像には2羽の白鷺が写っており、それぞれが反対方向を向いて静かに立っています。白鷺はその純白の羽毛と優雅な姿で知られています。", "input_text": "鳥の種類はなんですか?", "heron-bench": {"score": 6, "score_gpt": 10}}
79
+ {"question_id": "78", "text": "画像には、緑豊かな田んぼの中で2羽の白い鳥が水を飲んでいる様子が写っています。鳥たちはそれぞれ異なる位置に立っており、一方は画面の左側に、もう一方は右側にいます。彼らは穏やかな水辺でリラックスしているように見え、周囲の自然と調和しています。\n\n田んぼの水面は穏やかで、鳥たちの姿が映り込んでいます。背景には広がる緑の田んぼが見え、自然の美しさが感じられます。このシーンは、静かな田園風景を思わせる、穏やかな雰囲気を醸し出しています。", "answer": "この写真は、緑豊かな水田の中に2羽の白鷺が映っています。白鷺たちは互いに背を向け合っており、一羽は左を、もう一羽は右を向いて静かに立っています。彼らの周りは静寂に包まれており、自然の美しさと調和しています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 8, "score_gpt": 10}}
80
+ {"question_id": "79", "text": "この写真は富士山が背景に見えることから、静岡県または山梨県で撮影されたと考えられます。", "answer": "この写真は静岡県で撮影されたと考えられます。宝永山が富士山の右側に見えることから、この地理的特徴は静岡県からの視点に一致します。また、東海道線の電車が写っていることも、この地域で撮影されたことを示唆しています。", "input_text": "この写真はどの都道府県で撮影されたと考えられますか?", "heron-bench": {"score": 8, "score_gpt": 10}}
81
+ {"question_id": "80", "text": "写真に写っているのは、富士山です。", "answer": "写真に写っているのは富士山です。また、富士山の右側には宝永山が見えます。これらの山々は、静岡県から撮影されたことが示唆されています。", "input_text": "写真に写っているのは、何という山ですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
82
+ {"question_id": "81", "text": "写真に写っている山の頂上付近は雪に覆われており、白く輝いています。", "answer": "富士山の頂上付近は雪に覆われており、その白さが澄み切った空に映えています。頂上は平らで、特徴的な円錐形のシルエットを描いています。宝永山が右側に見えることから、富士山の頂上は画像の中央よりやや左側に位置しています。", "input_text": "写真に写っている山の頂上付近はどのように見えますか?", "heron-bench": {"score": 10, "score_gpt": 9}}
83
+ {"question_id": "82", "text": "この画像には、電車が駅に停車している様子が写っています。電車はオレンジとグレーの色合いで、背景には美しい山が見えます。電車の近くには、数人の人々が立っており、彼らは電車の到着を待っているようです。\n\n電車の左側には、一人の人物が立っており、その近くにはもう一人がいます。さらに、右側には別の人物がいて、彼らは電車のドアの近くに集まっています。電車のドアは開いており、乗客が乗り降りする準備をしている様子が伺えます。全体的に、駅の活気ある雰囲気が感じられます。", "answer": "この写真は、雪を頂に戴いた壮大な富士山を背景に、東海道線の特徴的なオレンジラインが入った電車が走行している様子を捉えています。電車は画像の中央やや下に位置し、その背後には宝永山が富士山の右側に小さく見えています。また、電柱とその間に張られた電線が画像の前景に複数存在し、日本の典型的な田園風景の一部として描かれています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 3, "score_gpt": 10}}
84
+ {"question_id": "83", "text": "この写真は春に撮影されたと考えられます。桜の花が咲いていることから、春の訪れを示しています。", "answer": "この写真は春の季節に撮影されたものです。満開の桜が春の訪れを告げており、青空がその背景を美しく彩っています。桜の花がこの時期特有の風景を作り出しています。", "input_text": "この写真が撮影された季節はいつでしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
85
+ {"question_id": "84", "text": "この写真は桜の花が満開の時期に撮影されたもので、春の訪れを象徴しています。この時期、多くの学校では「入学式」や「卒業式」などの重要な行事が行われます。特に桜の花は、新しい始まりや別れを象徴するため、これらの行事と結びついています。また、桜の花が咲く時期は、多くの学生や保護者が学校の行事に参加するため、特別な意味を持つことが多いです。このように、桜の花が咲く時期は、学校生活の重要な節目を祝う機会でもあるのです。", "answer": "この写真が取られた時期に実施される学校行事は、入学式や卒業式です。春の季節は新しい生活が始まる時期であり、学生たちが新たなスタートを切る象徴的な行事が行われます。特に、桜の満開の下での式典は、日本の学校において美しい風物詩となっています。", "input_text": "この写真が取られた時期に実施される学校行事は何でしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
86
+ {"question_id": "85", "text": "写真には桜の花が写っています。桜の花は、春の象徴として知られ、美しいピンク色の花びらを持っています。", "answer": "写真に写っている花は桜です。��開の状態で、春の青空の下に美しく咲いています。これらの桜は、季節の象徴として、新しい始まりを感じさせます。", "input_text": "写真に写っている花は何ですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
87
+ {"question_id": "86", "text": "写真に写っている花は満開で、多くの花が咲いている様子が見られます。", "answer": "写真に写っている桜は満開です。空に向かって広がる枝には、ほとんどの花が開いており、見事な花見景色を提供しています。この光景は春の訪れを象徴しています。", "input_text": "写真に写っている花は何分咲きでしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
88
+ {"question_id": "87", "text": "この画像には、白い花が咲き誇る木が写っています。木の枝には、たくさんの小さな白い花が密集しており、まるで雪が降り積もったかのように見えます。花は非常に美しく、青空を背景に鮮やかに映えています。\n\n木の全体が花で覆われており、特に枝の先端には多くの花が集まっています。花の色合いは淡いピンクから白にかけて変化しており、全体的に柔らかい印象を与えています。この木は、春の訪れを感じさせるような、穏やかで心地よい雰囲気を醸し出しています。", "answer": "この写真は、春の青空を背景に、満開の桜の木が中心に写っています。桜の花びらが密集して咲いており、その下では数人が花見を楽しんでいる様子が見受けられます。画像の前景には、桜の花びらが散り始めている様子も捉えられており、季節の移り変わりを感じさせます。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 10, "score_gpt": 9}}
89
+ {"question_id": "88", "text": "茶畑が段々に分かれている理由は、主に地形の利用と効率的な栽培方法に関連しています。この画像では、茶畑が山の斜面に沿って段々に配置されていることがわかります。このような設計は、急な斜面での水はけを良くし、土壌の浸食を防ぐために重要です。また、段々にすることで、茶の木が均等に日光を受けることができ、成長を促進します。さらに、段々の茶畑は、作業効率を高めるためにも役立ちます。農家は、段々の畑を移動しながら作業を行いやすくなり、収穫や管理が容易になります。このように、段々に分かれた茶畑は、自然環境を最大限に活用し、持続可能な農業を実現するための工夫がなされているのです。", "answer": "茶畑が段々に分かれているのは、斜面を最大限に利用して栽培面積を増やし、水はけと日照条件を改善するためと考えられます。このような構造は、不均一な地形においても農作物の生育環境を最適化するのに役立ちます。また、段々畑は土壌の浸食を防ぎ、水資源の管理にも有効です。", "input_text": "茶畑はなぜ段々に分かれていると考えられるか論じてください。", "heron-bench": {"score": 10, "score_gpt": 10}}
90
+ {"question_id": "89", "text": "この写真に写っているのは茶畑であり、主に緑茶がつくられる農作物です。", "answer": "この写真の農作物から作られる飲み物はお茶です。", "input_text": "この写真の農作物からつくられる飲み物は何でしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
91
+ {"question_id": "90", "text": "この写真は、緑豊かな丘陵地帯の風景を対象にして撮影されています。特に、茶畑が広がる美しい景色が特徴です。", "answer": "この写真は、日本の茶畑を対象に撮影されています。茶畑は複数の段々に分かれており、中央左手では3人の農家が作業をしています。また、写真の中央右手には木造の作業小屋が見えます。", "input_text": "この写真はどのような風景を対象にして、撮影されていますか?", "heron-bench": {"score": 9, "score_gpt": 10}}
92
+ {"question_id": "91", "text": "作業小屋は写真の中央やや右寄りに位置しています。", "answer": "作業小屋は写真の中央右手に位置しています。木造であり、茶畑の段々の上部に見えます。小屋は農家が作業している場所から見て、右側にあります。", "input_text": "作業小屋は写真のどのあたりにうつっていますか?", "heron-bench": {"score": 10, "score_gpt": 9}}
93
+ {"question_id": "92", "text": "この画像には、緑豊かな丘陵地帯が広がっており、その中には小さな小屋がいくつか点在しています。丘の斜面には、茶畑が広がっており、その美しい景観が印象的です。小屋は、丘の上���中腹に位置しており、自然に溶け込んでいます。\n\n丘の上には、数人の人々が見え、彼らはおそらく茶畑の手入れや観光を楽しんでいるのでしょう。人々はそれぞれ異なる位置に立っており、丘の斜面を歩いている様子が伺えます。全体的に、穏やかで自然豊かな風景が広がっており、リラックスした雰囲気が漂っています。", "answer": "この写真は、緑豊かな茶畑が特徴的な風景を捉えています。茶畑は美しく整備された段々に分かれており、中央左手では3人の農家が丁寧に作業を行っています。中央右手には、伝統的な木造の作業小屋があり、その周囲には自然な緑が広がっています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
94
+ {"question_id": "93", "text": "いいえ、交差点に向かうことはできません。画像には、交通整理をしている作業員が立っており、その作業員は交通を制御しています。このため、交差点を通過する前に、作業員の指示に従う必要があります。作業員が交通を制御している場合、特に工事や道路の状況によっては、通行が制限されている可能性があります。安全を確保するためにも、作業員の指示に従い、交差点を通過する際には注意が必要です。", "answer": "いいえ、このまま交差点に向かってはいけません。信号機が赤色であり、手前の交通誘導員が「止まれ」の合図をしているため、停止する必要があります。また、片側交互通行の指示があるため、交通誘導員の指示に従う必要があります。", "input_text": "あなたは車を運転しており、交差点で右折しようと思っています。このまま交差点に向かってよいでしょうか?", "heron-bench": {"score": 9, "score_gpt": 10}}
95
+ {"question_id": "94", "text": "はい、青信号になったら車を発進させても問題ありません。画像には、青信号が点灯している交通信号が映っており、その信号は車両の進行を許可しています。ただし、周囲の状況にも注意が必要です。特に、道路工事のためのコーンが設置されていることから、工事区域に近づく際には、他の作業員や車両の動きにも気を配る必要があります。また、工事区域では通常の交通ルールが異なる場合があるため、工事の指示に従うことが重要です。安全運転を心がけ、周囲の状況を確認しながら進むことが大切です。", "answer": "いいえ、青信号になったとしても、交通誘導員が「止まれ」の合図をしているため、車を発進させてはいけません。交通誘導員の指示は信号よりも優先されます。また、片側交互通行の状況下では、誘導員の指示に従う必要があります。", "input_text": "映像の状況において、青信号になったら車を発進させてもよいでしょうか?", "heron-bench": {"score": 4, "score_gpt": 10}}
96
+ {"question_id": "95", "text": "信号機の色は赤色です。", "answer": "信号機の色は赤色です。", "input_text": "信号機の色は何色ですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
97
+ {"question_id": "96", "text": "交通誘導員は、道路を横断しようとしている人々に対して、赤い旗を振って停止の合図を出しています。", "answer": "交通誘導員は「止まれ」の合図を出しています。信号機が赤色であり、手前の交通誘導員が手を上げて車両の進行を停止させるジェスチャーをしています。これは、ドライバーに対して現在進行方向に進むことを止めるよう指示していることを意味します。", "input_text": "交通誘導員はどのような指示を出していますか?", "heron-bench": {"score": 4, "score_gpt": 10}}
98
+ {"question_id": "97", "text": "画像には、道路の真ん中に立っている作業員が写っています。彼は青い作業服を着ており、交通を制御するために赤い旗を持っています。周囲にはいくつかの交通信号が見え、道路の両側には車が停まっている様子が確認できます。\n\n作業員の近くには、数台の車が並んでおり、その中にはトラックも含まれています。また、道路の一部にはコーンが設置されており、作業区域を示しているようです。全体的に、交通の流れを管理するための作業が行われている様子が伺えます。", "answer": "この写真は、道路工事現場の様子を捉えており、前方には「止まれ」の合図をしている交通誘導員が一人立っています。信号機は赤色で、左側には片側交互通行を示す看板と右矢印がありま��。また、多数の青色カラーコーンが配置されており、その内側には白いトラックが停車しています。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
99
+ {"question_id": "98", "text": "奥に見える山の名前は「富士山」です。", "answer": "奥に見える山の名前は羊蹄山です。", "input_text": "奥に見える山の名前はなんですか?", "heron-bench": {"score": 1, "score_gpt": 10}}
100
+ {"question_id": "99", "text": "この道を運転する際には、いくつかの重要な点に注意する必要があります。まず、雪が積もっているため、路面が滑りやすくなっています。特に、雪が深い場所や凍結している部分では、ブレーキをかける際やカーブを曲がる際に慎重になる必要があります。また、周囲の交通標識や信号も確認し、他の車両や歩行者との距離を保つことが重要です。さらに、視界が悪くなる可能性があるため、ヘッドライトを点灯し、他のドライバーに自分の存在を知らせることが大切です。最後に、急な天候の変化や雪の降り方にも注意を払い、必要に応じて運転を控える判断も必要です。安全運転を心がけることで、事故を未然に防ぐことができます。", "answer": "この道を運転する上で、まず雪に覆われた道路のため滑りやすい可能性があるので、慎重に運転する必要があります。次に、制限速度40kmの標識があるため、速度を適切に抑えることが重要です。また、青信号ではありますが、交差点や他の車両にも注意を払う必要があります。", "input_text": "この道を運転する上で気をつけるべきことは何でしょうか?", "heron-bench": {"score": 10, "score_gpt": 9}}
101
+ {"question_id": "100", "text": "この場所の制限速度は40キロメートル毎時です。", "answer": "この場所の制限速度は40kmです。左側に制限速度40kmを示す標識が見えます。", "input_text": "この場所における制限速度はいくつですか?", "heron-bench": {"score": 10, "score_gpt": 10}}
102
+ {"question_id": "101", "text": "12kmです。", "answer": "現在地からニセコまでは12kmです。", "input_text": "現在地からニセコまで何kmでしょうか?", "heron-bench": {"score": 10, "score_gpt": 10}}
103
+ {"question_id": "102", "text": "この画像には、雪に覆われた道路が写っており、その先には大きな山がそびえています。道路は雪で覆われており、周囲には雪が積もった建物が見えます。道路の両側には、いくつかの交通標識が立っており、運転手に道案内をしています。\n\n道路の左側には、雪に覆われた建物がいくつか見え、その中にはバスも停まっているようです。また、道路の中央付近には信号機が設置されており、交通の流れを管理しています。全体的に、冬の静けさと雪の美しさが感じられる風景です。", "answer": "この写真は、冬の日に車窓から撮影された風景を捉えています。雪に覆われた道路が中央を通り、遠くには美しい羊蹄山が青空の下にそびえ立っています。画像の左側には制限速度40kmを示す標識があり、中央には青色の信号が見えます。また、ニセコまで12km、倶知安まで23kmであることを示す標識もあります。", "input_text": "この写真について詳しく説明してください。", "heron-bench": {"score": 6, "score_gpt": 10}}
qwen2_jp.jinja ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% if messages[0]['role'] != 'system' %}
2
+ {{ '<|im_start|>system\n以下は、タスクを説明する指示です。要求を適切に満たす応答を書きなさい。<|im_end|>\n' }}
3
+ {% endif %}
4
+
5
+ {% for message in messages if message['content'] is not none %}
6
+ {{ '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n' }}
7
+ {% endfor %}
8
+
9
+ {% if add_generation_prompt %}
10
+ {{ '<|im_start|>assistant\n' }}
11
+ {% endif %}
siglip_encoder.py ADDED
@@ -0,0 +1,288 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ import torch
18
+ import torch.nn as nn
19
+ import torch.nn.functional as F
20
+ from accelerate.hooks import add_hook_to_module
21
+ from einops import rearrange
22
+ from s2wrapper import forward as multiscale_forward
23
+ from transformers import AutoConfig, PretrainedConfig, PreTrainedModel, SiglipImageProcessor
24
+ from transformers.image_processing_utils import BaseImageProcessor
25
+ from transformers.integrations.deepspeed import is_deepspeed_zero3_enabled
26
+ from transformers.models.siglip import SiglipVisionModel
27
+
28
+
29
+ class VisionTower(nn.Module):
30
+ def __init__(self, vision_tower, args, delay_load=False):
31
+ super().__init__()
32
+
33
+ self.is_loaded = False
34
+
35
+ self.vision_tower_name = vision_tower
36
+ self.select_layer = getattr(args, "mm_vision_select_layer", -2)
37
+ self.select_feature = getattr(args, "mm_vision_select_feature", "patch")
38
+
39
+ self.cfg_only = None
40
+
41
+ def feature_select(self, image_forward_outs):
42
+ image_features = image_forward_outs.hidden_states[self.select_layer]
43
+ if self.select_feature == "patch":
44
+ image_features = image_features[:, 1:]
45
+ elif self.select_feature == "cls_patch":
46
+ image_features = image_features
47
+ else:
48
+ raise ValueError(f"Unexpected select feature: {self.select_feature}")
49
+ return image_features
50
+
51
+ def _maybe_resize_pos_embeds(
52
+ self,
53
+ model: PreTrainedModel,
54
+ image_processor: BaseImageProcessor,
55
+ resolution: int = -1,
56
+ interpolate_mode: str = "linear",
57
+ ):
58
+ if resolution in [model.config.image_size, -1]:
59
+ return
60
+ print(
61
+ f"Resizing vision model's position embeddings to support higher vision resolution: from {model.config.image_size} to {resolution} ..."
62
+ )
63
+ embeddings = model.vision_model.embeddings
64
+ patch_size = embeddings.patch_size
65
+ num_new_tokens = int((resolution // patch_size) ** 2)
66
+
67
+ old_embeddings = embeddings.position_embedding
68
+ match interpolate_mode:
69
+ case "linear":
70
+ ## Step 1: Calculate the corresponding patch ID (pid) in the current resolution (M patches) based on the target resolution (N patches). Formula: pid = pid / N * M
71
+ ## Step 2: Obtain new embeddings by interpolating between the embeddings of the two nearest calculated patch IDs. Formula: new_embeds = (pid - floor(pid)) * embeds[ceil(pid)] + (ceil(pid) - pid) * embeds[floor(pid)]
72
+ import torch
73
+ import torch.nn as nn
74
+
75
+ if is_deepspeed_zero3_enabled():
76
+ try:
77
+ import deepspeed
78
+ except ImportError:
79
+ raise ImportError("DeepSpeed is not installed. Please install it with `pip install deepspeed`.")
80
+ with deepspeed.zero.GatheredParameters([old_embeddings.weight], modifier_rank=None):
81
+ old_num_tokens, old_embedding_dim = old_embeddings.weight.size()
82
+ else:
83
+ old_num_tokens, old_embedding_dim = old_embeddings.weight.size()
84
+ new_embeddings = nn.Embedding(
85
+ num_new_tokens,
86
+ old_embedding_dim,
87
+ dtype=old_embeddings.weight.dtype,
88
+ device=old_embeddings.weight.device,
89
+ )
90
+ mapped_indices = (
91
+ torch.arange(num_new_tokens).to(old_embeddings.weight.device)
92
+ / (num_new_tokens - 1)
93
+ * (old_num_tokens - 1)
94
+ )
95
+ floor_indices = torch.clamp(mapped_indices.floor().long(), min=0, max=old_num_tokens - 1)
96
+ ceil_indices = torch.clamp(mapped_indices.ceil().long(), min=0, max=old_num_tokens - 1)
97
+ if is_deepspeed_zero3_enabled():
98
+ params = [old_embeddings.weight, new_embeddings.weight]
99
+ with deepspeed.zero.GatheredParameters(params, modifier_rank=0):
100
+ interpolated_embeds = (mapped_indices - floor_indices)[:, None] * old_embeddings.weight.data[
101
+ ceil_indices, :
102
+ ] + (ceil_indices - mapped_indices)[:, None] * old_embeddings.weight.data[floor_indices, :]
103
+ else:
104
+ interpolated_embeds = (mapped_indices - floor_indices)[:, None] * old_embeddings.weight.data[
105
+ ceil_indices, :
106
+ ] + (ceil_indices - mapped_indices)[:, None] * old_embeddings.weight.data[floor_indices, :]
107
+ new_embeddings.weight.data = interpolated_embeds
108
+ case _:
109
+ raise NotImplementedError
110
+
111
+ if hasattr(old_embeddings, "_hf_hook"):
112
+ hook = old_embeddings._hf_hook
113
+ add_hook_to_module(new_embeddings, hook)
114
+ new_embeddings.requires_grad_(old_embeddings.weight.requires_grad)
115
+ ## update vision encoder's configurations
116
+ model.config.image_size = resolution
117
+ if hasattr(image_processor, "crop_size"):
118
+ # CLIP vision tower
119
+ image_processor.crop_size = resolution
120
+ else:
121
+ # SIGLIP vision tower
122
+ assert hasattr(image_processor, "size")
123
+ image_processor.size = {"height": resolution, "width": resolution}
124
+ ## TODO define a '_reinitialize' method for VisionTower
125
+ embeddings.position_embedding = new_embeddings
126
+ embeddings.image_size = resolution
127
+ embeddings.num_patches = embeddings.num_positions = num_new_tokens
128
+ embeddings.position_ids = (
129
+ torch.arange(embeddings.num_positions).expand((1, -1)).to(old_embeddings.weight.device)
130
+ )
131
+
132
+ def forward(self, images):
133
+ if type(images) is list:
134
+ image_features = []
135
+ for image in images:
136
+ image_forward_out = self.vision_tower(
137
+ image.to(device=self.device, dtype=self.dtype).unsqueeze(0),
138
+ output_hidden_states=True,
139
+ )
140
+ image_feature = self.feature_select(image_forward_out).to(image.dtype)
141
+ image_features.append(image_feature)
142
+ else:
143
+ image_forward_outs = self.vision_tower(
144
+ images.to(device=self.device, dtype=self.dtype),
145
+ output_hidden_states=True,
146
+ )
147
+ image_features = self.feature_select(image_forward_outs).to(images.dtype)
148
+
149
+ return image_features
150
+
151
+ @property
152
+ def dummy_feature(self):
153
+ return torch.zeros(1, self.hidden_size, device=self.device, dtype=self.dtype)
154
+
155
+ @property
156
+ def dtype(self):
157
+ return self.vision_tower.dtype
158
+
159
+ @property
160
+ def device(self):
161
+ return self.vision_tower.device
162
+
163
+ @property
164
+ def config(self):
165
+ if self.is_loaded:
166
+ return self.vision_tower.config
167
+ else:
168
+ return self.cfg_only
169
+
170
+ @property
171
+ def hidden_size(self):
172
+ return self.config.hidden_size
173
+
174
+ @property
175
+ def num_patches(self):
176
+ return (self.config.image_size // self.config.patch_size) ** 2
177
+
178
+
179
+ class VisionTowerS2(VisionTower):
180
+ def __init__(self, vision_tower, args, delay_load=False):
181
+ super().__init__(vision_tower, args, delay_load)
182
+
183
+ self.scales = list(map(int, args.s2_scales.split(",")))
184
+ self.scales.sort()
185
+ self.max_split_size = args.s2_max_split_size
186
+ self.resize_output_to_scale_idx = getattr(args, "s2_resize_output_to_scale_idx", 0)
187
+
188
+ def forward_feature(self, images):
189
+ image_forward_outs = self.vision_tower(
190
+ images.to(device=self.device, dtype=self.dtype), output_hidden_states=True
191
+ )
192
+ image_features = self.feature_select(image_forward_outs).to(images.dtype)
193
+ return image_features
194
+
195
+ def forward(self, images):
196
+ if type(images) is list:
197
+ image_feature = []
198
+ for image in images:
199
+ image_feature = multiscale_forward(
200
+ self.forward_feature,
201
+ image.unsqueeze(0),
202
+ img_sizes=self.scales,
203
+ max_split_size=self.max_split_size,
204
+ resize_output_to_idx=self.resize_output_to_scale_idx,
205
+ )
206
+ image_features.append(image_feature)
207
+ else:
208
+ image_features = multiscale_forward(
209
+ self.forward_feature,
210
+ images,
211
+ img_sizes=self.scales,
212
+ max_split_size=self.max_split_size,
213
+ resize_output_to_idx=self.resize_output_to_scale_idx,
214
+ )
215
+
216
+ return image_features
217
+
218
+ @property
219
+ def hidden_size(self):
220
+ return self.config.hidden_size * len(self.scales)
221
+
222
+
223
+ class VisionTowerDynamicS2(VisionTower):
224
+ def __init__(self, vision_tower, args, delay_load=False):
225
+ super().__init__(vision_tower, args, delay_load)
226
+
227
+ self.scales = list(map(int, args.s2_scales.split(",")))
228
+ self.scales.sort()
229
+ self.max_split_size = args.s2_max_split_size
230
+ self.resize_output_to_scale_idx = getattr(args, "s2_resize_output_to_scale_idx", 0)
231
+
232
+ def forward_feature(self, images):
233
+ image_forward_outs = self.vision_tower(
234
+ images.to(device=self.device, dtype=self.dtype), output_hidden_states=True
235
+ )
236
+ image_features = self.feature_select(image_forward_outs).to(images.dtype)
237
+ return image_features
238
+
239
+ def forward(self, images):
240
+ assert type(images) is not list
241
+ image_features = self.forward_feature(images)
242
+
243
+ return image_features
244
+
245
+ @property
246
+ def hidden_size(self):
247
+ return self.config.hidden_size * len(self.scales)
248
+
249
+
250
+ class SiglipVisionTower(VisionTower):
251
+ def __init__(self, model_name_or_path: str, config: PretrainedConfig) -> None:
252
+ super().__init__(model_name_or_path, config)
253
+ # TODO(ligengl): why pass config here leading to errors?
254
+ self.vision_tower = SiglipVisionModel.from_pretrained(
255
+ model_name_or_path,
256
+ attn_implementation=config._attn_implementation,
257
+ torch_dtype=eval(config.model_dtype),
258
+ )
259
+ self.image_processor = SiglipImageProcessor.from_pretrained(model_name_or_path)
260
+ self.is_loaded = True
261
+
262
+
263
+ class SiglipVisionTowerS2(VisionTowerS2):
264
+ def __init__(self, model_name_or_path: str, config: PretrainedConfig) -> None:
265
+ super().__init__(model_name_or_path, config)
266
+ self.vision_tower = SiglipVisionModel.from_pretrained(
267
+ model_name_or_path,
268
+ attn_implementation=config._attn_implementation,
269
+ torch_dtype=eval(config.model_dtype),
270
+ )
271
+ self.image_processor = SiglipImageProcessor.from_pretrained(model_name_or_path)
272
+ # Make sure it crops/resizes the image to the largest scale in self.scales to maintain high-res information
273
+ self.image_processor.size["height"] = self.image_processor.size["width"] = self.scales[-1]
274
+ self.is_loaded = True
275
+
276
+
277
+ class SiglipVisionTowerDynamicS2(VisionTowerDynamicS2):
278
+ def __init__(self, model_name_or_path: str, config: PretrainedConfig) -> None:
279
+ super().__init__(model_name_or_path, config)
280
+ self.vision_tower = SiglipVisionModel.from_pretrained(
281
+ model_name_or_path,
282
+ attn_implementation="flash_attention_2",
283
+ torch_dtype=eval(config.model_dtype),
284
+ )
285
+ self.image_processor = SiglipImageProcessor.from_pretrained(model_name_or_path)
286
+ # Make sure it crops/resizes the image to the largest scale in self.scales to maintain high-res information
287
+ self.image_processor.size["height"] = self.image_processor.size["width"] = self.scales[0]
288
+ self.is_loaded = True
tokenizer_utils.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+
17
+ from typing import Any, Dict, List, Optional, Sequence
18
+
19
+ import torch
20
+ import transformers
21
+
22
+ from .constants import IGNORE_INDEX, SENTINEL_TOKEN
23
+ from .conversation import SeparatorStyle, default_conversation
24
+ from .mm_utils import tokenizer_image_token
25
+
26
+ # __all__ = [
27
+ # "tokenize_conversation",
28
+ # "preprocess_conversation",
29
+ # "infer_stop_tokens",
30
+ # ]
31
+
32
+ DUMMY_CONVERSATION = [
33
+ {"from": "human", "value": "question"},
34
+ {"from": "gpt", "value": "answer"},
35
+ ] * 10
36
+
37
+
38
+ def tokenize_conversation_legacy(
39
+ messages: Sequence[Dict[str, str]],
40
+ tokenizer: transformers.PreTrainedTokenizer,
41
+ add_generation_prompt: bool = False,
42
+ overrides: Optional[Dict[str, str]] = None,
43
+ no_system_prompt: bool = False,
44
+ ) -> torch.Tensor:
45
+ conv = default_conversation.copy()
46
+ roles = {"human": conv.roles[0], "gpt": conv.roles[1]}
47
+
48
+ if no_system_prompt:
49
+ conv.system = ""
50
+
51
+ # Skip the first message if it is not from human
52
+ if messages[0]["from"] != "human":
53
+ messages = messages[1:]
54
+
55
+ # Add a generation prompt if needed
56
+ if add_generation_prompt:
57
+ messages.append({"from": "gpt", "value": None})
58
+
59
+ conv.messages = []
60
+ for turn, message in enumerate(messages):
61
+ role = roles[message["from"]]
62
+ assert role == conv.roles[turn % 2]
63
+ if overrides is not None and message["from"] in overrides:
64
+ conv.append_message(role, overrides[message["from"]])
65
+ else:
66
+ conv.append_message(role, message["value"])
67
+
68
+ return tokenizer_image_token(conv.get_prompt(), tokenizer, return_tensors="pt")
69
+
70
+
71
+ def tokenize_conversation(
72
+ messages: Sequence[Dict[str, str]],
73
+ tokenizer: transformers.PreTrainedTokenizer,
74
+ add_generation_prompt: bool = False,
75
+ overrides: Optional[Dict[str, str]] = None,
76
+ no_system_prompt: bool = False,
77
+ ) -> torch.Tensor:
78
+ # Normalize the conversation before tokenization
79
+ for message in messages:
80
+ message["value"] = message["value"].strip()
81
+
82
+ if default_conversation.sep_style != SeparatorStyle.AUTO:
83
+ return tokenize_conversation_legacy(
84
+ messages,
85
+ tokenizer,
86
+ add_generation_prompt=add_generation_prompt,
87
+ overrides=overrides,
88
+ no_system_prompt=no_system_prompt,
89
+ )
90
+
91
+ conversation = []
92
+ for m in messages:
93
+ message = {}
94
+ if m["from"] == "human":
95
+ message["role"] = "user"
96
+ elif m["from"] == "gpt":
97
+ message["role"] = "assistant"
98
+ else:
99
+ raise ValueError(f"Unexpected sender '{m['from']}' in conversation entry.")
100
+
101
+ message["content"] = m["value"]
102
+ if overrides is not None and m["from"] in overrides:
103
+ message["content"] = overrides[m["from"]]
104
+ conversation.append(message)
105
+
106
+ if no_system_prompt:
107
+ conversation = [{"role": "system", "content": ""}] + conversation
108
+
109
+ text = tokenizer.apply_chat_template(
110
+ conversation,
111
+ add_generation_prompt=add_generation_prompt,
112
+ tokenize=False,
113
+ )
114
+ return tokenizer_image_token(text, tokenizer, return_tensors="pt")
115
+
116
+
117
+ def _maybe_add_sentinel_token(tokenizer: transformers.PreTrainedTokenizer) -> None:
118
+ if not hasattr(tokenizer, "sentinel_token"):
119
+ tokenizer.add_tokens([SENTINEL_TOKEN], special_tokens=True)
120
+ tokenizer.sentinel_token = SENTINEL_TOKEN
121
+ tokenizer.sentinel_token_id = tokenizer.convert_tokens_to_ids(SENTINEL_TOKEN)
122
+
123
+
124
+ def preprocess_conversation(
125
+ conversation: Sequence[Dict[str, str]],
126
+ tokenizer: transformers.PreTrainedTokenizer,
127
+ no_system_prompt: bool = False,
128
+ retried: bool = False,
129
+ ) -> Dict[str, Any]:
130
+ inputs = tokenize_conversation(conversation, tokenizer, no_system_prompt=no_system_prompt)
131
+ labels = torch.ones_like(inputs) * IGNORE_INDEX
132
+
133
+ # Generate the template by replacing the assistant's response with a sentinel.
134
+ _maybe_add_sentinel_token(tokenizer)
135
+ template = tokenize_conversation(
136
+ conversation, tokenizer, overrides={"gpt": SENTINEL_TOKEN}, no_system_prompt=no_system_prompt
137
+ )
138
+
139
+ # Remove sentinel tokens from the template.
140
+ mask = torch.ones_like(template, dtype=torch.bool)
141
+ for k in range(template.size(0) - 1):
142
+ if template[k] == tokenizer.sentinel_token_id:
143
+ mask[k : k + 2] = False
144
+ # NOTE(zhijianl): This is to handle the corner case where there is an empty token before the sentinel token.
145
+ if k > 0 and retried:
146
+ mask[k - 1] = False
147
+ template = template[mask]
148
+
149
+ # Match the tokenized conversation with the template (with no assistant's response).
150
+ # Every token that is not matched will be included in the label for training.
151
+ p = 0
152
+ for k in range(inputs.size(0)):
153
+ if p < template.size(0) and inputs[k] == template[p]:
154
+ p += 1
155
+ else:
156
+ labels[k] = inputs[k]
157
+
158
+ # Mask all tokens in the label if the template is not fully matched.
159
+ if p < template.size(0):
160
+ if not retried:
161
+ return preprocess_conversation(
162
+ conversation,
163
+ tokenizer,
164
+ no_system_prompt=no_system_prompt,
165
+ retried=True,
166
+ )
167
+ print(f"Failed to process the conversation: '{conversation}'. All tokens will be masked in the label.")
168
+ labels[:] = IGNORE_INDEX
169
+
170
+ return {"input_ids": inputs, "labels": labels}
171
+
172
+
173
+ def infer_stop_tokens(tokenizer: transformers.PreTrainedTokenizer) -> List[str]:
174
+ _maybe_add_sentinel_token(tokenizer)
175
+ template = tokenize_conversation(DUMMY_CONVERSATION, tokenizer, overrides={"gpt": SENTINEL_TOKEN})
176
+
177
+ stop_tokens = {tokenizer.eos_token}
178
+ for k in range(template.size(0) - 1):
179
+ if template[k] == tokenizer.sentinel_token_id:
180
+ stop_token = tokenizer.decode(template[k + 1])
181
+ stop_tokens.add(stop_token)
182
+ return list(stop_tokens)
trainer_state.json ADDED
@@ -0,0 +1,3983 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 1.0,
5
+ "eval_steps": 500,
6
+ "global_step": 563,
7
+ "is_hyper_param_search": false,
8
+ "is_local_process_zero": true,
9
+ "is_world_process_zero": true,
10
+ "log_history": [
11
+ {
12
+ "epoch": 0.0,
13
+ "grad_norm": 8.507063209836788,
14
+ "learning_rate": 1.1764705882352942e-06,
15
+ "loss": 1.4995,
16
+ "step": 1
17
+ },
18
+ {
19
+ "epoch": 0.0,
20
+ "grad_norm": 8.380837976348499,
21
+ "learning_rate": 2.3529411764705885e-06,
22
+ "loss": 1.4748,
23
+ "step": 2
24
+ },
25
+ {
26
+ "epoch": 0.01,
27
+ "grad_norm": 16.153712765062593,
28
+ "learning_rate": 3.529411764705883e-06,
29
+ "loss": 1.5095,
30
+ "step": 3
31
+ },
32
+ {
33
+ "epoch": 0.01,
34
+ "grad_norm": 6.32918606424435,
35
+ "learning_rate": 4.705882352941177e-06,
36
+ "loss": 1.5469,
37
+ "step": 4
38
+ },
39
+ {
40
+ "epoch": 0.01,
41
+ "grad_norm": 7.9385610864888605,
42
+ "learning_rate": 5.882352941176471e-06,
43
+ "loss": 1.3485,
44
+ "step": 5
45
+ },
46
+ {
47
+ "epoch": 0.01,
48
+ "grad_norm": 8.466808791062784,
49
+ "learning_rate": 7.058823529411766e-06,
50
+ "loss": 1.1535,
51
+ "step": 6
52
+ },
53
+ {
54
+ "epoch": 0.01,
55
+ "grad_norm": 9.197832520423505,
56
+ "learning_rate": 8.23529411764706e-06,
57
+ "loss": 1.1178,
58
+ "step": 7
59
+ },
60
+ {
61
+ "epoch": 0.01,
62
+ "grad_norm": 6.450381889902437,
63
+ "learning_rate": 9.411764705882354e-06,
64
+ "loss": 1.1143,
65
+ "step": 8
66
+ },
67
+ {
68
+ "epoch": 0.02,
69
+ "grad_norm": 5.943842042765044,
70
+ "learning_rate": 1.0588235294117648e-05,
71
+ "loss": 1.0598,
72
+ "step": 9
73
+ },
74
+ {
75
+ "epoch": 0.02,
76
+ "grad_norm": 5.210792511369386,
77
+ "learning_rate": 1.1764705882352942e-05,
78
+ "loss": 1.0608,
79
+ "step": 10
80
+ },
81
+ {
82
+ "epoch": 0.02,
83
+ "grad_norm": 6.530214268858284,
84
+ "learning_rate": 1.2941176470588238e-05,
85
+ "loss": 0.9929,
86
+ "step": 11
87
+ },
88
+ {
89
+ "epoch": 0.02,
90
+ "grad_norm": 4.087686549913091,
91
+ "learning_rate": 1.4117647058823532e-05,
92
+ "loss": 1.0114,
93
+ "step": 12
94
+ },
95
+ {
96
+ "epoch": 0.02,
97
+ "grad_norm": 3.9477045662395813,
98
+ "learning_rate": 1.5294117647058822e-05,
99
+ "loss": 0.9954,
100
+ "step": 13
101
+ },
102
+ {
103
+ "epoch": 0.02,
104
+ "grad_norm": 4.1326622498960095,
105
+ "learning_rate": 1.647058823529412e-05,
106
+ "loss": 0.9655,
107
+ "step": 14
108
+ },
109
+ {
110
+ "epoch": 0.03,
111
+ "grad_norm": 2.8320217201459146,
112
+ "learning_rate": 1.7647058823529414e-05,
113
+ "loss": 0.9806,
114
+ "step": 15
115
+ },
116
+ {
117
+ "epoch": 0.03,
118
+ "grad_norm": 3.2554966057925836,
119
+ "learning_rate": 1.8823529411764708e-05,
120
+ "loss": 0.9477,
121
+ "step": 16
122
+ },
123
+ {
124
+ "epoch": 0.03,
125
+ "grad_norm": 3.2675871177766234,
126
+ "learning_rate": 2e-05,
127
+ "loss": 0.951,
128
+ "step": 17
129
+ },
130
+ {
131
+ "epoch": 0.03,
132
+ "grad_norm": 3.934063085197528,
133
+ "learning_rate": 1.999983446750305e-05,
134
+ "loss": 0.9663,
135
+ "step": 18
136
+ },
137
+ {
138
+ "epoch": 0.03,
139
+ "grad_norm": 3.241094261577659,
140
+ "learning_rate": 1.9999337875492412e-05,
141
+ "loss": 0.9121,
142
+ "step": 19
143
+ },
144
+ {
145
+ "epoch": 0.04,
146
+ "grad_norm": 4.544380597079295,
147
+ "learning_rate": 1.9998510240408495e-05,
148
+ "loss": 0.935,
149
+ "step": 20
150
+ },
151
+ {
152
+ "epoch": 0.04,
153
+ "grad_norm": 3.9294827890898,
154
+ "learning_rate": 1.999735158965141e-05,
155
+ "loss": 0.9038,
156
+ "step": 21
157
+ },
158
+ {
159
+ "epoch": 0.04,
160
+ "grad_norm": 8.623886416931795,
161
+ "learning_rate": 1.9995861961580024e-05,
162
+ "loss": 0.9155,
163
+ "step": 22
164
+ },
165
+ {
166
+ "epoch": 0.04,
167
+ "grad_norm": 5.132365358995958,
168
+ "learning_rate": 1.9994041405510705e-05,
169
+ "loss": 0.9172,
170
+ "step": 23
171
+ },
172
+ {
173
+ "epoch": 0.04,
174
+ "grad_norm": 19.8213188609718,
175
+ "learning_rate": 1.9991889981715696e-05,
176
+ "loss": 0.8447,
177
+ "step": 24
178
+ },
179
+ {
180
+ "epoch": 0.04,
181
+ "grad_norm": 2.2943297073592803,
182
+ "learning_rate": 1.998940776142111e-05,
183
+ "loss": 0.9511,
184
+ "step": 25
185
+ },
186
+ {
187
+ "epoch": 0.05,
188
+ "grad_norm": 2.621703554351971,
189
+ "learning_rate": 1.9986594826804563e-05,
190
+ "loss": 0.8948,
191
+ "step": 26
192
+ },
193
+ {
194
+ "epoch": 0.05,
195
+ "grad_norm": 10.369292417211861,
196
+ "learning_rate": 1.998345127099248e-05,
197
+ "loss": 0.9247,
198
+ "step": 27
199
+ },
200
+ {
201
+ "epoch": 0.05,
202
+ "grad_norm": 2.1594855526771366,
203
+ "learning_rate": 1.9979977198056986e-05,
204
+ "loss": 0.896,
205
+ "step": 28
206
+ },
207
+ {
208
+ "epoch": 0.05,
209
+ "grad_norm": 1.95675488611705,
210
+ "learning_rate": 1.997617272301248e-05,
211
+ "loss": 0.9416,
212
+ "step": 29
213
+ },
214
+ {
215
+ "epoch": 0.05,
216
+ "grad_norm": 2.8649894461349144,
217
+ "learning_rate": 1.9972037971811802e-05,
218
+ "loss": 0.8633,
219
+ "step": 30
220
+ },
221
+ {
222
+ "epoch": 0.06,
223
+ "grad_norm": 1.7651028451161137,
224
+ "learning_rate": 1.9967573081342103e-05,
225
+ "loss": 0.933,
226
+ "step": 31
227
+ },
228
+ {
229
+ "epoch": 0.06,
230
+ "grad_norm": 2.8772648372928935,
231
+ "learning_rate": 1.9962778199420265e-05,
232
+ "loss": 0.8624,
233
+ "step": 32
234
+ },
235
+ {
236
+ "epoch": 0.06,
237
+ "grad_norm": 1.619118612925012,
238
+ "learning_rate": 1.9957653484788054e-05,
239
+ "loss": 0.8723,
240
+ "step": 33
241
+ },
242
+ {
243
+ "epoch": 0.06,
244
+ "grad_norm": 1.847616171745648,
245
+ "learning_rate": 1.995219910710682e-05,
246
+ "loss": 0.9186,
247
+ "step": 34
248
+ },
249
+ {
250
+ "epoch": 0.06,
251
+ "grad_norm": 1.8003449391174806,
252
+ "learning_rate": 1.9946415246951928e-05,
253
+ "loss": 0.8574,
254
+ "step": 35
255
+ },
256
+ {
257
+ "epoch": 0.06,
258
+ "grad_norm": 1.5572245128267164,
259
+ "learning_rate": 1.9940302095806733e-05,
260
+ "loss": 0.9054,
261
+ "step": 36
262
+ },
263
+ {
264
+ "epoch": 0.07,
265
+ "grad_norm": 1.429846538560356,
266
+ "learning_rate": 1.9933859856056264e-05,
267
+ "loss": 0.8959,
268
+ "step": 37
269
+ },
270
+ {
271
+ "epoch": 0.07,
272
+ "grad_norm": 2.3135286173820884,
273
+ "learning_rate": 1.992708874098054e-05,
274
+ "loss": 0.7889,
275
+ "step": 38
276
+ },
277
+ {
278
+ "epoch": 0.07,
279
+ "grad_norm": 1.7675896646055616,
280
+ "learning_rate": 1.9919988974747473e-05,
281
+ "loss": 0.8598,
282
+ "step": 39
283
+ },
284
+ {
285
+ "epoch": 0.07,
286
+ "grad_norm": 1.6088010620771458,
287
+ "learning_rate": 1.9912560792405465e-05,
288
+ "loss": 0.8749,
289
+ "step": 40
290
+ },
291
+ {
292
+ "epoch": 0.07,
293
+ "grad_norm": 1.4194262632230676,
294
+ "learning_rate": 1.9904804439875635e-05,
295
+ "loss": 0.8915,
296
+ "step": 41
297
+ },
298
+ {
299
+ "epoch": 0.07,
300
+ "grad_norm": 2.234751299184324,
301
+ "learning_rate": 1.9896720173943657e-05,
302
+ "loss": 0.8515,
303
+ "step": 42
304
+ },
305
+ {
306
+ "epoch": 0.08,
307
+ "grad_norm": 1.6675796150462,
308
+ "learning_rate": 1.9888308262251286e-05,
309
+ "loss": 0.8868,
310
+ "step": 43
311
+ },
312
+ {
313
+ "epoch": 0.08,
314
+ "grad_norm": 1.5198896510379474,
315
+ "learning_rate": 1.9879568983287468e-05,
316
+ "loss": 0.8712,
317
+ "step": 44
318
+ },
319
+ {
320
+ "epoch": 0.08,
321
+ "grad_norm": 1.4817760559180928,
322
+ "learning_rate": 1.9870502626379127e-05,
323
+ "loss": 0.8518,
324
+ "step": 45
325
+ },
326
+ {
327
+ "epoch": 0.08,
328
+ "grad_norm": 1.2950833873505025,
329
+ "learning_rate": 1.986110949168162e-05,
330
+ "loss": 0.8903,
331
+ "step": 46
332
+ },
333
+ {
334
+ "epoch": 0.08,
335
+ "grad_norm": 1.8499963418893206,
336
+ "learning_rate": 1.9851389890168738e-05,
337
+ "loss": 0.7847,
338
+ "step": 47
339
+ },
340
+ {
341
+ "epoch": 0.09,
342
+ "grad_norm": 1.7242837081062508,
343
+ "learning_rate": 1.9841344143622472e-05,
344
+ "loss": 0.847,
345
+ "step": 48
346
+ },
347
+ {
348
+ "epoch": 0.09,
349
+ "grad_norm": 1.2806401368832885,
350
+ "learning_rate": 1.9830972584622327e-05,
351
+ "loss": 0.8828,
352
+ "step": 49
353
+ },
354
+ {
355
+ "epoch": 0.09,
356
+ "grad_norm": 1.5629477066468145,
357
+ "learning_rate": 1.9820275556534306e-05,
358
+ "loss": 0.8251,
359
+ "step": 50
360
+ },
361
+ {
362
+ "epoch": 0.09,
363
+ "grad_norm": 1.4745129474955476,
364
+ "learning_rate": 1.9809253413499565e-05,
365
+ "loss": 0.8397,
366
+ "step": 51
367
+ },
368
+ {
369
+ "epoch": 0.09,
370
+ "grad_norm": 1.3870891516090702,
371
+ "learning_rate": 1.979790652042268e-05,
372
+ "loss": 0.8159,
373
+ "step": 52
374
+ },
375
+ {
376
+ "epoch": 0.09,
377
+ "grad_norm": 1.4153257317082082,
378
+ "learning_rate": 1.9786235252959555e-05,
379
+ "loss": 0.8729,
380
+ "step": 53
381
+ },
382
+ {
383
+ "epoch": 0.1,
384
+ "grad_norm": 1.5032889887849479,
385
+ "learning_rate": 1.9774239997505e-05,
386
+ "loss": 0.8311,
387
+ "step": 54
388
+ },
389
+ {
390
+ "epoch": 0.1,
391
+ "grad_norm": 1.4793054274886537,
392
+ "learning_rate": 1.9761921151179937e-05,
393
+ "loss": 0.8304,
394
+ "step": 55
395
+ },
396
+ {
397
+ "epoch": 0.1,
398
+ "grad_norm": 1.3623327446068922,
399
+ "learning_rate": 1.9749279121818235e-05,
400
+ "loss": 0.8246,
401
+ "step": 56
402
+ },
403
+ {
404
+ "epoch": 0.1,
405
+ "grad_norm": 1.711010136615301,
406
+ "learning_rate": 1.9736314327953242e-05,
407
+ "loss": 0.8575,
408
+ "step": 57
409
+ },
410
+ {
411
+ "epoch": 0.1,
412
+ "grad_norm": 2.1030806528939197,
413
+ "learning_rate": 1.9723027198803896e-05,
414
+ "loss": 0.884,
415
+ "step": 58
416
+ },
417
+ {
418
+ "epoch": 0.1,
419
+ "grad_norm": 1.8114692078531625,
420
+ "learning_rate": 1.9709418174260523e-05,
421
+ "loss": 0.832,
422
+ "step": 59
423
+ },
424
+ {
425
+ "epoch": 0.11,
426
+ "grad_norm": 4.199754342127851,
427
+ "learning_rate": 1.969548770487029e-05,
428
+ "loss": 0.8548,
429
+ "step": 60
430
+ },
431
+ {
432
+ "epoch": 0.11,
433
+ "grad_norm": 1.8197457491567695,
434
+ "learning_rate": 1.9681236251822274e-05,
435
+ "loss": 0.7631,
436
+ "step": 61
437
+ },
438
+ {
439
+ "epoch": 0.11,
440
+ "grad_norm": 3.9438599409073496,
441
+ "learning_rate": 1.9666664286932198e-05,
442
+ "loss": 0.8848,
443
+ "step": 62
444
+ },
445
+ {
446
+ "epoch": 0.11,
447
+ "grad_norm": 1.2465928817428147,
448
+ "learning_rate": 1.9651772292626804e-05,
449
+ "loss": 0.8544,
450
+ "step": 63
451
+ },
452
+ {
453
+ "epoch": 0.11,
454
+ "grad_norm": 1.5494633367087811,
455
+ "learning_rate": 1.96365607619279e-05,
456
+ "loss": 0.7678,
457
+ "step": 64
458
+ },
459
+ {
460
+ "epoch": 0.12,
461
+ "grad_norm": 1.7179370824588993,
462
+ "learning_rate": 1.9621030198436007e-05,
463
+ "loss": 0.8439,
464
+ "step": 65
465
+ },
466
+ {
467
+ "epoch": 0.12,
468
+ "grad_norm": 2.271674256525051,
469
+ "learning_rate": 1.9605181116313725e-05,
470
+ "loss": 0.8706,
471
+ "step": 66
472
+ },
473
+ {
474
+ "epoch": 0.12,
475
+ "grad_norm": 1.8765382998169675,
476
+ "learning_rate": 1.9589014040268678e-05,
477
+ "loss": 0.8203,
478
+ "step": 67
479
+ },
480
+ {
481
+ "epoch": 0.12,
482
+ "grad_norm": 1.7244243284677303,
483
+ "learning_rate": 1.957252950553616e-05,
484
+ "loss": 0.835,
485
+ "step": 68
486
+ },
487
+ {
488
+ "epoch": 0.12,
489
+ "grad_norm": 1.4614578596506242,
490
+ "learning_rate": 1.955572805786141e-05,
491
+ "loss": 0.7874,
492
+ "step": 69
493
+ },
494
+ {
495
+ "epoch": 0.12,
496
+ "grad_norm": 1.5281931827918855,
497
+ "learning_rate": 1.9538610253481542e-05,
498
+ "loss": 0.8225,
499
+ "step": 70
500
+ },
501
+ {
502
+ "epoch": 0.13,
503
+ "grad_norm": 1.82847520738767,
504
+ "learning_rate": 1.952117665910714e-05,
505
+ "loss": 0.8493,
506
+ "step": 71
507
+ },
508
+ {
509
+ "epoch": 0.13,
510
+ "grad_norm": 1.3951596613953592,
511
+ "learning_rate": 1.950342785190349e-05,
512
+ "loss": 0.8324,
513
+ "step": 72
514
+ },
515
+ {
516
+ "epoch": 0.13,
517
+ "grad_norm": 2.0697823165315503,
518
+ "learning_rate": 1.9485364419471454e-05,
519
+ "loss": 0.7796,
520
+ "step": 73
521
+ },
522
+ {
523
+ "epoch": 0.13,
524
+ "grad_norm": 1.2907212439977902,
525
+ "learning_rate": 1.9466986959828063e-05,
526
+ "loss": 0.8388,
527
+ "step": 74
528
+ },
529
+ {
530
+ "epoch": 0.13,
531
+ "grad_norm": 1.8757593351488622,
532
+ "learning_rate": 1.9448296081386656e-05,
533
+ "loss": 0.8262,
534
+ "step": 75
535
+ },
536
+ {
537
+ "epoch": 0.13,
538
+ "grad_norm": 1.0842852719284728,
539
+ "learning_rate": 1.9429292402936804e-05,
540
+ "loss": 0.8655,
541
+ "step": 76
542
+ },
543
+ {
544
+ "epoch": 0.14,
545
+ "grad_norm": 1.849794221228235,
546
+ "learning_rate": 1.9409976553623767e-05,
547
+ "loss": 0.7859,
548
+ "step": 77
549
+ },
550
+ {
551
+ "epoch": 0.14,
552
+ "grad_norm": 2.0412614125126365,
553
+ "learning_rate": 1.93903491729277e-05,
554
+ "loss": 0.8108,
555
+ "step": 78
556
+ },
557
+ {
558
+ "epoch": 0.14,
559
+ "grad_norm": 1.2056345210077357,
560
+ "learning_rate": 1.9370410910642473e-05,
561
+ "loss": 0.8035,
562
+ "step": 79
563
+ },
564
+ {
565
+ "epoch": 0.14,
566
+ "grad_norm": 1.374462281110202,
567
+ "learning_rate": 1.9350162426854152e-05,
568
+ "loss": 0.836,
569
+ "step": 80
570
+ },
571
+ {
572
+ "epoch": 0.14,
573
+ "grad_norm": 1.3148936377412426,
574
+ "learning_rate": 1.932960439191915e-05,
575
+ "loss": 0.7965,
576
+ "step": 81
577
+ },
578
+ {
579
+ "epoch": 0.15,
580
+ "grad_norm": 1.108816627540348,
581
+ "learning_rate": 1.9308737486442045e-05,
582
+ "loss": 0.8034,
583
+ "step": 82
584
+ },
585
+ {
586
+ "epoch": 0.15,
587
+ "grad_norm": 1.0106641852379432,
588
+ "learning_rate": 1.9287562401253023e-05,
589
+ "loss": 0.8895,
590
+ "step": 83
591
+ },
592
+ {
593
+ "epoch": 0.15,
594
+ "grad_norm": 1.0643031247749164,
595
+ "learning_rate": 1.926607983738504e-05,
596
+ "loss": 0.7938,
597
+ "step": 84
598
+ },
599
+ {
600
+ "epoch": 0.15,
601
+ "grad_norm": 1.6202434008438316,
602
+ "learning_rate": 1.924429050605057e-05,
603
+ "loss": 0.8174,
604
+ "step": 85
605
+ },
606
+ {
607
+ "epoch": 0.15,
608
+ "grad_norm": 1.1277481220625152,
609
+ "learning_rate": 1.9222195128618108e-05,
610
+ "loss": 0.7965,
611
+ "step": 86
612
+ },
613
+ {
614
+ "epoch": 0.15,
615
+ "grad_norm": 1.2288767977862927,
616
+ "learning_rate": 1.9199794436588244e-05,
617
+ "loss": 0.8108,
618
+ "step": 87
619
+ },
620
+ {
621
+ "epoch": 0.16,
622
+ "grad_norm": 1.8547807452034146,
623
+ "learning_rate": 1.9177089171569484e-05,
624
+ "loss": 0.7788,
625
+ "step": 88
626
+ },
627
+ {
628
+ "epoch": 0.16,
629
+ "grad_norm": 1.02129245587083,
630
+ "learning_rate": 1.9154080085253665e-05,
631
+ "loss": 0.8123,
632
+ "step": 89
633
+ },
634
+ {
635
+ "epoch": 0.16,
636
+ "grad_norm": 1.0460991831102135,
637
+ "learning_rate": 1.9130767939391092e-05,
638
+ "loss": 0.8053,
639
+ "step": 90
640
+ },
641
+ {
642
+ "epoch": 0.16,
643
+ "grad_norm": 1.4621605349515425,
644
+ "learning_rate": 1.9107153505765308e-05,
645
+ "loss": 0.8817,
646
+ "step": 91
647
+ },
648
+ {
649
+ "epoch": 0.16,
650
+ "grad_norm": 1.072411126394728,
651
+ "learning_rate": 1.908323756616754e-05,
652
+ "loss": 0.8013,
653
+ "step": 92
654
+ },
655
+ {
656
+ "epoch": 0.17,
657
+ "grad_norm": 1.260321384657037,
658
+ "learning_rate": 1.9059020912370836e-05,
659
+ "loss": 0.8172,
660
+ "step": 93
661
+ },
662
+ {
663
+ "epoch": 0.17,
664
+ "grad_norm": 1.3234441337963823,
665
+ "learning_rate": 1.9034504346103825e-05,
666
+ "loss": 0.7731,
667
+ "step": 94
668
+ },
669
+ {
670
+ "epoch": 0.17,
671
+ "grad_norm": 1.2328175633896823,
672
+ "learning_rate": 1.900968867902419e-05,
673
+ "loss": 0.8484,
674
+ "step": 95
675
+ },
676
+ {
677
+ "epoch": 0.17,
678
+ "grad_norm": 1.550206231336332,
679
+ "learning_rate": 1.898457473269181e-05,
680
+ "loss": 0.7686,
681
+ "step": 96
682
+ },
683
+ {
684
+ "epoch": 0.17,
685
+ "grad_norm": 1.1944254976680975,
686
+ "learning_rate": 1.895916333854152e-05,
687
+ "loss": 0.7743,
688
+ "step": 97
689
+ },
690
+ {
691
+ "epoch": 0.17,
692
+ "grad_norm": 1.3111106744110506,
693
+ "learning_rate": 1.8933455337855633e-05,
694
+ "loss": 0.824,
695
+ "step": 98
696
+ },
697
+ {
698
+ "epoch": 0.18,
699
+ "grad_norm": 1.27000399731967,
700
+ "learning_rate": 1.8907451581736052e-05,
701
+ "loss": 0.7887,
702
+ "step": 99
703
+ },
704
+ {
705
+ "epoch": 0.18,
706
+ "grad_norm": 1.0853884228742083,
707
+ "learning_rate": 1.8881152931076126e-05,
708
+ "loss": 0.8801,
709
+ "step": 100
710
+ },
711
+ {
712
+ "epoch": 0.18,
713
+ "grad_norm": 1.1505416374261161,
714
+ "learning_rate": 1.8854560256532098e-05,
715
+ "loss": 0.7937,
716
+ "step": 101
717
+ },
718
+ {
719
+ "epoch": 0.18,
720
+ "grad_norm": 1.136615577492445,
721
+ "learning_rate": 1.882767443849435e-05,
722
+ "loss": 0.817,
723
+ "step": 102
724
+ },
725
+ {
726
+ "epoch": 0.18,
727
+ "grad_norm": 1.2158975241416552,
728
+ "learning_rate": 1.8800496367058187e-05,
729
+ "loss": 0.7749,
730
+ "step": 103
731
+ },
732
+ {
733
+ "epoch": 0.18,
734
+ "grad_norm": 1.7879520459848115,
735
+ "learning_rate": 1.877302694199442e-05,
736
+ "loss": 0.7924,
737
+ "step": 104
738
+ },
739
+ {
740
+ "epoch": 0.19,
741
+ "grad_norm": 1.3883544371253298,
742
+ "learning_rate": 1.8745267072719555e-05,
743
+ "loss": 0.7704,
744
+ "step": 105
745
+ },
746
+ {
747
+ "epoch": 0.19,
748
+ "grad_norm": 1.7872291898285468,
749
+ "learning_rate": 1.8717217678265682e-05,
750
+ "loss": 0.7794,
751
+ "step": 106
752
+ },
753
+ {
754
+ "epoch": 0.19,
755
+ "grad_norm": 1.3311382018956643,
756
+ "learning_rate": 1.8688879687250067e-05,
757
+ "loss": 0.8308,
758
+ "step": 107
759
+ },
760
+ {
761
+ "epoch": 0.19,
762
+ "grad_norm": 1.2893581866568486,
763
+ "learning_rate": 1.866025403784439e-05,
764
+ "loss": 0.7793,
765
+ "step": 108
766
+ },
767
+ {
768
+ "epoch": 0.19,
769
+ "grad_norm": 1.139241829453439,
770
+ "learning_rate": 1.863134167774369e-05,
771
+ "loss": 0.8892,
772
+ "step": 109
773
+ },
774
+ {
775
+ "epoch": 0.2,
776
+ "grad_norm": 2.6133328625978893,
777
+ "learning_rate": 1.860214356413501e-05,
778
+ "loss": 0.8023,
779
+ "step": 110
780
+ },
781
+ {
782
+ "epoch": 0.2,
783
+ "grad_norm": 1.5841826966676458,
784
+ "learning_rate": 1.8572660663665672e-05,
785
+ "loss": 0.8248,
786
+ "step": 111
787
+ },
788
+ {
789
+ "epoch": 0.2,
790
+ "grad_norm": 1.4270048951849372,
791
+ "learning_rate": 1.8542893952411302e-05,
792
+ "loss": 0.7757,
793
+ "step": 112
794
+ },
795
+ {
796
+ "epoch": 0.2,
797
+ "grad_norm": 1.7093625023294083,
798
+ "learning_rate": 1.8512844415843514e-05,
799
+ "loss": 0.7922,
800
+ "step": 113
801
+ },
802
+ {
803
+ "epoch": 0.2,
804
+ "grad_norm": 1.3617190025737091,
805
+ "learning_rate": 1.8482513048797267e-05,
806
+ "loss": 0.787,
807
+ "step": 114
808
+ },
809
+ {
810
+ "epoch": 0.2,
811
+ "grad_norm": 1.8071893998904143,
812
+ "learning_rate": 1.845190085543795e-05,
813
+ "loss": 0.8116,
814
+ "step": 115
815
+ },
816
+ {
817
+ "epoch": 0.21,
818
+ "grad_norm": 1.3814019945231775,
819
+ "learning_rate": 1.842100884922812e-05,
820
+ "loss": 0.802,
821
+ "step": 116
822
+ },
823
+ {
824
+ "epoch": 0.21,
825
+ "grad_norm": 1.4512890833634728,
826
+ "learning_rate": 1.838983805289396e-05,
827
+ "loss": 0.8536,
828
+ "step": 117
829
+ },
830
+ {
831
+ "epoch": 0.21,
832
+ "grad_norm": 1.2549934379051162,
833
+ "learning_rate": 1.835838949839143e-05,
834
+ "loss": 0.7743,
835
+ "step": 118
836
+ },
837
+ {
838
+ "epoch": 0.21,
839
+ "grad_norm": 1.208372599156025,
840
+ "learning_rate": 1.8326664226872063e-05,
841
+ "loss": 0.8024,
842
+ "step": 119
843
+ },
844
+ {
845
+ "epoch": 0.21,
846
+ "grad_norm": 1.0972220457411088,
847
+ "learning_rate": 1.829466328864856e-05,
848
+ "loss": 0.8344,
849
+ "step": 120
850
+ },
851
+ {
852
+ "epoch": 0.21,
853
+ "grad_norm": 1.2822175154411732,
854
+ "learning_rate": 1.826238774315995e-05,
855
+ "loss": 0.797,
856
+ "step": 121
857
+ },
858
+ {
859
+ "epoch": 0.22,
860
+ "grad_norm": 1.2107730495640208,
861
+ "learning_rate": 1.8229838658936566e-05,
862
+ "loss": 0.7739,
863
+ "step": 122
864
+ },
865
+ {
866
+ "epoch": 0.22,
867
+ "grad_norm": 0.9365728161852094,
868
+ "learning_rate": 1.819701711356464e-05,
869
+ "loss": 0.8338,
870
+ "step": 123
871
+ },
872
+ {
873
+ "epoch": 0.22,
874
+ "grad_norm": 1.0864214560239218,
875
+ "learning_rate": 1.816392419365065e-05,
876
+ "loss": 0.7793,
877
+ "step": 124
878
+ },
879
+ {
880
+ "epoch": 0.22,
881
+ "grad_norm": 0.9218244394223452,
882
+ "learning_rate": 1.8130560994785325e-05,
883
+ "loss": 0.7612,
884
+ "step": 125
885
+ },
886
+ {
887
+ "epoch": 0.22,
888
+ "grad_norm": 2.080436030466144,
889
+ "learning_rate": 1.809692862150739e-05,
890
+ "loss": 0.8612,
891
+ "step": 126
892
+ },
893
+ {
894
+ "epoch": 0.23,
895
+ "grad_norm": 1.4900488161819043,
896
+ "learning_rate": 1.8063028187266987e-05,
897
+ "loss": 0.7464,
898
+ "step": 127
899
+ },
900
+ {
901
+ "epoch": 0.23,
902
+ "grad_norm": 0.8798162644545249,
903
+ "learning_rate": 1.8028860814388826e-05,
904
+ "loss": 0.8367,
905
+ "step": 128
906
+ },
907
+ {
908
+ "epoch": 0.23,
909
+ "grad_norm": 0.8812260971377114,
910
+ "learning_rate": 1.7994427634035016e-05,
911
+ "loss": 0.755,
912
+ "step": 129
913
+ },
914
+ {
915
+ "epoch": 0.23,
916
+ "grad_norm": 0.9676476461621292,
917
+ "learning_rate": 1.7959729786167616e-05,
918
+ "loss": 0.8508,
919
+ "step": 130
920
+ },
921
+ {
922
+ "epoch": 0.23,
923
+ "grad_norm": 0.9256406288268074,
924
+ "learning_rate": 1.7924768419510906e-05,
925
+ "loss": 0.7292,
926
+ "step": 131
927
+ },
928
+ {
929
+ "epoch": 0.23,
930
+ "grad_norm": 0.760232197066633,
931
+ "learning_rate": 1.7889544691513357e-05,
932
+ "loss": 0.797,
933
+ "step": 132
934
+ },
935
+ {
936
+ "epoch": 0.24,
937
+ "grad_norm": 1.0639511668001849,
938
+ "learning_rate": 1.7854059768309292e-05,
939
+ "loss": 0.7521,
940
+ "step": 133
941
+ },
942
+ {
943
+ "epoch": 0.24,
944
+ "grad_norm": 0.9073895992533008,
945
+ "learning_rate": 1.78183148246803e-05,
946
+ "loss": 0.8134,
947
+ "step": 134
948
+ },
949
+ {
950
+ "epoch": 0.24,
951
+ "grad_norm": 0.905361446098707,
952
+ "learning_rate": 1.778231104401634e-05,
953
+ "loss": 0.7921,
954
+ "step": 135
955
+ },
956
+ {
957
+ "epoch": 0.24,
958
+ "grad_norm": 1.0000546401715837,
959
+ "learning_rate": 1.7746049618276545e-05,
960
+ "loss": 0.7719,
961
+ "step": 136
962
+ },
963
+ {
964
+ "epoch": 0.24,
965
+ "grad_norm": 1.2991918331253864,
966
+ "learning_rate": 1.7709531747949796e-05,
967
+ "loss": 0.7825,
968
+ "step": 137
969
+ },
970
+ {
971
+ "epoch": 0.25,
972
+ "grad_norm": 0.9040019002054857,
973
+ "learning_rate": 1.767275864201494e-05,
974
+ "loss": 0.7751,
975
+ "step": 138
976
+ },
977
+ {
978
+ "epoch": 0.25,
979
+ "grad_norm": 1.4065727827842003,
980
+ "learning_rate": 1.7635731517900782e-05,
981
+ "loss": 0.828,
982
+ "step": 139
983
+ },
984
+ {
985
+ "epoch": 0.25,
986
+ "grad_norm": 1.6988580043162866,
987
+ "learning_rate": 1.759845160144579e-05,
988
+ "loss": 0.8597,
989
+ "step": 140
990
+ },
991
+ {
992
+ "epoch": 0.25,
993
+ "grad_norm": 0.900317786852657,
994
+ "learning_rate": 1.756092012685749e-05,
995
+ "loss": 0.7999,
996
+ "step": 141
997
+ },
998
+ {
999
+ "epoch": 0.25,
1000
+ "grad_norm": 1.2873306206831179,
1001
+ "learning_rate": 1.7523138336671628e-05,
1002
+ "loss": 0.8174,
1003
+ "step": 142
1004
+ },
1005
+ {
1006
+ "epoch": 0.25,
1007
+ "grad_norm": 1.133316576026692,
1008
+ "learning_rate": 1.7485107481711014e-05,
1009
+ "loss": 0.7603,
1010
+ "step": 143
1011
+ },
1012
+ {
1013
+ "epoch": 0.26,
1014
+ "grad_norm": 1.953496025978647,
1015
+ "learning_rate": 1.7446828821044123e-05,
1016
+ "loss": 0.7743,
1017
+ "step": 144
1018
+ },
1019
+ {
1020
+ "epoch": 0.26,
1021
+ "grad_norm": 1.3312782549575295,
1022
+ "learning_rate": 1.7408303621943417e-05,
1023
+ "loss": 0.7661,
1024
+ "step": 145
1025
+ },
1026
+ {
1027
+ "epoch": 0.26,
1028
+ "grad_norm": 1.4629213396365295,
1029
+ "learning_rate": 1.7369533159843368e-05,
1030
+ "loss": 0.753,
1031
+ "step": 146
1032
+ },
1033
+ {
1034
+ "epoch": 0.26,
1035
+ "grad_norm": 0.9279779565723256,
1036
+ "learning_rate": 1.7330518718298263e-05,
1037
+ "loss": 0.8161,
1038
+ "step": 147
1039
+ },
1040
+ {
1041
+ "epoch": 0.26,
1042
+ "grad_norm": 1.1467927655177639,
1043
+ "learning_rate": 1.729126158893969e-05,
1044
+ "loss": 0.7701,
1045
+ "step": 148
1046
+ },
1047
+ {
1048
+ "epoch": 0.26,
1049
+ "grad_norm": 0.946811505107358,
1050
+ "learning_rate": 1.7251763071433767e-05,
1051
+ "loss": 0.8386,
1052
+ "step": 149
1053
+ },
1054
+ {
1055
+ "epoch": 0.27,
1056
+ "grad_norm": 1.33369128616317,
1057
+ "learning_rate": 1.7212024473438145e-05,
1058
+ "loss": 0.7646,
1059
+ "step": 150
1060
+ },
1061
+ {
1062
+ "epoch": 0.27,
1063
+ "grad_norm": 1.6320245391058008,
1064
+ "learning_rate": 1.71720471105587e-05,
1065
+ "loss": 0.7407,
1066
+ "step": 151
1067
+ },
1068
+ {
1069
+ "epoch": 0.27,
1070
+ "grad_norm": 1.5229292166958899,
1071
+ "learning_rate": 1.7131832306305964e-05,
1072
+ "loss": 0.8306,
1073
+ "step": 152
1074
+ },
1075
+ {
1076
+ "epoch": 0.27,
1077
+ "grad_norm": 0.949232772230085,
1078
+ "learning_rate": 1.7091381392051333e-05,
1079
+ "loss": 0.7453,
1080
+ "step": 153
1081
+ },
1082
+ {
1083
+ "epoch": 0.27,
1084
+ "grad_norm": 1.1465110573538513,
1085
+ "learning_rate": 1.7050695706982977e-05,
1086
+ "loss": 0.766,
1087
+ "step": 154
1088
+ },
1089
+ {
1090
+ "epoch": 0.28,
1091
+ "grad_norm": 1.5154779450711096,
1092
+ "learning_rate": 1.7009776598061496e-05,
1093
+ "loss": 0.7694,
1094
+ "step": 155
1095
+ },
1096
+ {
1097
+ "epoch": 0.28,
1098
+ "grad_norm": 1.0139789984795697,
1099
+ "learning_rate": 1.6968625419975355e-05,
1100
+ "loss": 0.8019,
1101
+ "step": 156
1102
+ },
1103
+ {
1104
+ "epoch": 0.28,
1105
+ "grad_norm": 1.1079537252923364,
1106
+ "learning_rate": 1.6927243535095995e-05,
1107
+ "loss": 0.7735,
1108
+ "step": 157
1109
+ },
1110
+ {
1111
+ "epoch": 0.28,
1112
+ "grad_norm": 1.0291789122473398,
1113
+ "learning_rate": 1.6885632313432772e-05,
1114
+ "loss": 0.8687,
1115
+ "step": 158
1116
+ },
1117
+ {
1118
+ "epoch": 0.28,
1119
+ "grad_norm": 1.0108245776654075,
1120
+ "learning_rate": 1.684379313258757e-05,
1121
+ "loss": 0.7863,
1122
+ "step": 159
1123
+ },
1124
+ {
1125
+ "epoch": 0.28,
1126
+ "grad_norm": 0.8450335525589678,
1127
+ "learning_rate": 1.6801727377709195e-05,
1128
+ "loss": 0.7804,
1129
+ "step": 160
1130
+ },
1131
+ {
1132
+ "epoch": 0.29,
1133
+ "grad_norm": 0.9063906180650181,
1134
+ "learning_rate": 1.6759436441447544e-05,
1135
+ "loss": 0.7411,
1136
+ "step": 161
1137
+ },
1138
+ {
1139
+ "epoch": 0.29,
1140
+ "grad_norm": 1.4659728097146998,
1141
+ "learning_rate": 1.6716921723907472e-05,
1142
+ "loss": 0.7311,
1143
+ "step": 162
1144
+ },
1145
+ {
1146
+ "epoch": 0.29,
1147
+ "grad_norm": 1.1450889946261562,
1148
+ "learning_rate": 1.6674184632602447e-05,
1149
+ "loss": 0.7997,
1150
+ "step": 163
1151
+ },
1152
+ {
1153
+ "epoch": 0.29,
1154
+ "grad_norm": 2.2474639045647633,
1155
+ "learning_rate": 1.6631226582407954e-05,
1156
+ "loss": 0.7823,
1157
+ "step": 164
1158
+ },
1159
+ {
1160
+ "epoch": 0.29,
1161
+ "grad_norm": 1.0473794040487285,
1162
+ "learning_rate": 1.6588048995514657e-05,
1163
+ "loss": 0.759,
1164
+ "step": 165
1165
+ },
1166
+ {
1167
+ "epoch": 0.29,
1168
+ "grad_norm": 1.131898412640055,
1169
+ "learning_rate": 1.6544653301381318e-05,
1170
+ "loss": 0.822,
1171
+ "step": 166
1172
+ },
1173
+ {
1174
+ "epoch": 0.3,
1175
+ "grad_norm": 1.3959580024538538,
1176
+ "learning_rate": 1.6501040936687444e-05,
1177
+ "loss": 0.8124,
1178
+ "step": 167
1179
+ },
1180
+ {
1181
+ "epoch": 0.3,
1182
+ "grad_norm": 1.1510662240838245,
1183
+ "learning_rate": 1.645721334528577e-05,
1184
+ "loss": 0.7697,
1185
+ "step": 168
1186
+ },
1187
+ {
1188
+ "epoch": 0.3,
1189
+ "grad_norm": 0.8682977945159439,
1190
+ "learning_rate": 1.641317197815442e-05,
1191
+ "loss": 0.7743,
1192
+ "step": 169
1193
+ },
1194
+ {
1195
+ "epoch": 0.3,
1196
+ "grad_norm": 1.4212192981288094,
1197
+ "learning_rate": 1.6368918293348893e-05,
1198
+ "loss": 0.7987,
1199
+ "step": 170
1200
+ },
1201
+ {
1202
+ "epoch": 0.3,
1203
+ "grad_norm": 1.005593257735101,
1204
+ "learning_rate": 1.6324453755953772e-05,
1205
+ "loss": 0.7801,
1206
+ "step": 171
1207
+ },
1208
+ {
1209
+ "epoch": 0.31,
1210
+ "grad_norm": 1.4643600406891248,
1211
+ "learning_rate": 1.627977983803424e-05,
1212
+ "loss": 0.7466,
1213
+ "step": 172
1214
+ },
1215
+ {
1216
+ "epoch": 0.31,
1217
+ "grad_norm": 1.3023912771038668,
1218
+ "learning_rate": 1.6234898018587336e-05,
1219
+ "loss": 0.8037,
1220
+ "step": 173
1221
+ },
1222
+ {
1223
+ "epoch": 0.31,
1224
+ "grad_norm": 1.311996017760399,
1225
+ "learning_rate": 1.6189809783492984e-05,
1226
+ "loss": 0.7564,
1227
+ "step": 174
1228
+ },
1229
+ {
1230
+ "epoch": 0.31,
1231
+ "grad_norm": 0.9928204683020392,
1232
+ "learning_rate": 1.6144516625464813e-05,
1233
+ "loss": 0.8662,
1234
+ "step": 175
1235
+ },
1236
+ {
1237
+ "epoch": 0.31,
1238
+ "grad_norm": 1.6857925213687284,
1239
+ "learning_rate": 1.609902004400073e-05,
1240
+ "loss": 0.7446,
1241
+ "step": 176
1242
+ },
1243
+ {
1244
+ "epoch": 0.31,
1245
+ "grad_norm": 1.2049608818051798,
1246
+ "learning_rate": 1.605332154533328e-05,
1247
+ "loss": 0.7564,
1248
+ "step": 177
1249
+ },
1250
+ {
1251
+ "epoch": 0.32,
1252
+ "grad_norm": 1.037483746060024,
1253
+ "learning_rate": 1.600742264237979e-05,
1254
+ "loss": 0.7439,
1255
+ "step": 178
1256
+ },
1257
+ {
1258
+ "epoch": 0.32,
1259
+ "grad_norm": 1.2577074894891214,
1260
+ "learning_rate": 1.5961324854692254e-05,
1261
+ "loss": 0.8322,
1262
+ "step": 179
1263
+ },
1264
+ {
1265
+ "epoch": 0.32,
1266
+ "grad_norm": 1.1897741362610719,
1267
+ "learning_rate": 1.5915029708407056e-05,
1268
+ "loss": 0.773,
1269
+ "step": 180
1270
+ },
1271
+ {
1272
+ "epoch": 0.32,
1273
+ "grad_norm": 1.2430173497955095,
1274
+ "learning_rate": 1.5868538736194427e-05,
1275
+ "loss": 0.7524,
1276
+ "step": 181
1277
+ },
1278
+ {
1279
+ "epoch": 0.32,
1280
+ "grad_norm": 1.3567406768823702,
1281
+ "learning_rate": 1.582185347720771e-05,
1282
+ "loss": 0.8127,
1283
+ "step": 182
1284
+ },
1285
+ {
1286
+ "epoch": 0.33,
1287
+ "grad_norm": 1.4881992614206114,
1288
+ "learning_rate": 1.57749754770324e-05,
1289
+ "loss": 0.8067,
1290
+ "step": 183
1291
+ },
1292
+ {
1293
+ "epoch": 0.33,
1294
+ "grad_norm": 1.0306297593822549,
1295
+ "learning_rate": 1.5727906287634986e-05,
1296
+ "loss": 0.7811,
1297
+ "step": 184
1298
+ },
1299
+ {
1300
+ "epoch": 0.33,
1301
+ "grad_norm": 2.0461723719467053,
1302
+ "learning_rate": 1.568064746731156e-05,
1303
+ "loss": 0.7193,
1304
+ "step": 185
1305
+ },
1306
+ {
1307
+ "epoch": 0.33,
1308
+ "grad_norm": 1.0088861798153181,
1309
+ "learning_rate": 1.563320058063622e-05,
1310
+ "loss": 0.803,
1311
+ "step": 186
1312
+ },
1313
+ {
1314
+ "epoch": 0.33,
1315
+ "grad_norm": 1.1671931811922227,
1316
+ "learning_rate": 1.55855671984093e-05,
1317
+ "loss": 0.7398,
1318
+ "step": 187
1319
+ },
1320
+ {
1321
+ "epoch": 0.33,
1322
+ "grad_norm": 0.9106562766396383,
1323
+ "learning_rate": 1.553774889760533e-05,
1324
+ "loss": 0.8089,
1325
+ "step": 188
1326
+ },
1327
+ {
1328
+ "epoch": 0.34,
1329
+ "grad_norm": 1.1983507765271422,
1330
+ "learning_rate": 1.5489747261320866e-05,
1331
+ "loss": 0.7691,
1332
+ "step": 189
1333
+ },
1334
+ {
1335
+ "epoch": 0.34,
1336
+ "grad_norm": 1.0575825543404433,
1337
+ "learning_rate": 1.5441563878722042e-05,
1338
+ "loss": 0.7866,
1339
+ "step": 190
1340
+ },
1341
+ {
1342
+ "epoch": 0.34,
1343
+ "grad_norm": 0.9806900643594609,
1344
+ "learning_rate": 1.5393200344991993e-05,
1345
+ "loss": 0.8081,
1346
+ "step": 191
1347
+ },
1348
+ {
1349
+ "epoch": 0.34,
1350
+ "grad_norm": 0.9313407419052266,
1351
+ "learning_rate": 1.5344658261278013e-05,
1352
+ "loss": 0.7764,
1353
+ "step": 192
1354
+ },
1355
+ {
1356
+ "epoch": 0.34,
1357
+ "grad_norm": 0.992472391192496,
1358
+ "learning_rate": 1.5295939234638566e-05,
1359
+ "loss": 0.768,
1360
+ "step": 193
1361
+ },
1362
+ {
1363
+ "epoch": 0.34,
1364
+ "grad_norm": 2.174356436614505,
1365
+ "learning_rate": 1.524704487799008e-05,
1366
+ "loss": 0.7436,
1367
+ "step": 194
1368
+ },
1369
+ {
1370
+ "epoch": 0.35,
1371
+ "grad_norm": 0.9838293314441882,
1372
+ "learning_rate": 1.5197976810053546e-05,
1373
+ "loss": 0.759,
1374
+ "step": 195
1375
+ },
1376
+ {
1377
+ "epoch": 0.35,
1378
+ "grad_norm": 1.1277555782814377,
1379
+ "learning_rate": 1.5148736655300922e-05,
1380
+ "loss": 0.8158,
1381
+ "step": 196
1382
+ },
1383
+ {
1384
+ "epoch": 0.35,
1385
+ "grad_norm": 1.027047047472426,
1386
+ "learning_rate": 1.5099326043901361e-05,
1387
+ "loss": 0.7511,
1388
+ "step": 197
1389
+ },
1390
+ {
1391
+ "epoch": 0.35,
1392
+ "grad_norm": 1.7265548361992147,
1393
+ "learning_rate": 1.504974661166724e-05,
1394
+ "loss": 0.7734,
1395
+ "step": 198
1396
+ },
1397
+ {
1398
+ "epoch": 0.35,
1399
+ "grad_norm": 17.66044356313852,
1400
+ "learning_rate": 1.5000000000000002e-05,
1401
+ "loss": 0.7617,
1402
+ "step": 199
1403
+ },
1404
+ {
1405
+ "epoch": 0.36,
1406
+ "grad_norm": 1.6424117340223483,
1407
+ "learning_rate": 1.4950087855835816e-05,
1408
+ "loss": 0.8207,
1409
+ "step": 200
1410
+ },
1411
+ {
1412
+ "epoch": 0.36,
1413
+ "grad_norm": 1.368367595003515,
1414
+ "learning_rate": 1.490001183159105e-05,
1415
+ "loss": 0.7698,
1416
+ "step": 201
1417
+ },
1418
+ {
1419
+ "epoch": 0.36,
1420
+ "grad_norm": 1.1195914174852997,
1421
+ "learning_rate": 1.4849773585107574e-05,
1422
+ "loss": 0.7486,
1423
+ "step": 202
1424
+ },
1425
+ {
1426
+ "epoch": 0.36,
1427
+ "grad_norm": 0.9960466064073642,
1428
+ "learning_rate": 1.4799374779597866e-05,
1429
+ "loss": 0.7687,
1430
+ "step": 203
1431
+ },
1432
+ {
1433
+ "epoch": 0.36,
1434
+ "grad_norm": 3.40677503554284,
1435
+ "learning_rate": 1.4748817083589943e-05,
1436
+ "loss": 0.7689,
1437
+ "step": 204
1438
+ },
1439
+ {
1440
+ "epoch": 0.36,
1441
+ "grad_norm": 1.1744057232173357,
1442
+ "learning_rate": 1.4698102170872142e-05,
1443
+ "loss": 0.7953,
1444
+ "step": 205
1445
+ },
1446
+ {
1447
+ "epoch": 0.37,
1448
+ "grad_norm": 0.9709376500781769,
1449
+ "learning_rate": 1.4647231720437687e-05,
1450
+ "loss": 0.7996,
1451
+ "step": 206
1452
+ },
1453
+ {
1454
+ "epoch": 0.37,
1455
+ "grad_norm": 1.0780628041187534,
1456
+ "learning_rate": 1.4596207416429119e-05,
1457
+ "loss": 0.7793,
1458
+ "step": 207
1459
+ },
1460
+ {
1461
+ "epoch": 0.37,
1462
+ "grad_norm": 1.198486325581988,
1463
+ "learning_rate": 1.4545030948082518e-05,
1464
+ "loss": 0.7584,
1465
+ "step": 208
1466
+ },
1467
+ {
1468
+ "epoch": 0.37,
1469
+ "grad_norm": 0.9476564594417786,
1470
+ "learning_rate": 1.4493704009671614e-05,
1471
+ "loss": 0.8241,
1472
+ "step": 209
1473
+ },
1474
+ {
1475
+ "epoch": 0.37,
1476
+ "grad_norm": 0.876018870277804,
1477
+ "learning_rate": 1.4442228300451655e-05,
1478
+ "loss": 0.7778,
1479
+ "step": 210
1480
+ },
1481
+ {
1482
+ "epoch": 0.37,
1483
+ "grad_norm": 0.8272624022636804,
1484
+ "learning_rate": 1.439060552460318e-05,
1485
+ "loss": 0.6966,
1486
+ "step": 211
1487
+ },
1488
+ {
1489
+ "epoch": 0.38,
1490
+ "grad_norm": 0.8534456906469495,
1491
+ "learning_rate": 1.4338837391175582e-05,
1492
+ "loss": 0.8315,
1493
+ "step": 212
1494
+ },
1495
+ {
1496
+ "epoch": 0.38,
1497
+ "grad_norm": 0.8151679715897892,
1498
+ "learning_rate": 1.4286925614030542e-05,
1499
+ "loss": 0.7912,
1500
+ "step": 213
1501
+ },
1502
+ {
1503
+ "epoch": 0.38,
1504
+ "grad_norm": 1.0240572196453213,
1505
+ "learning_rate": 1.423487191178528e-05,
1506
+ "loss": 0.7632,
1507
+ "step": 214
1508
+ },
1509
+ {
1510
+ "epoch": 0.38,
1511
+ "grad_norm": 0.9373128897118324,
1512
+ "learning_rate": 1.4182678007755653e-05,
1513
+ "loss": 0.7991,
1514
+ "step": 215
1515
+ },
1516
+ {
1517
+ "epoch": 0.38,
1518
+ "grad_norm": 0.9074042298617393,
1519
+ "learning_rate": 1.4130345629899116e-05,
1520
+ "loss": 0.7241,
1521
+ "step": 216
1522
+ },
1523
+ {
1524
+ "epoch": 0.39,
1525
+ "grad_norm": 0.9820070319451613,
1526
+ "learning_rate": 1.4077876510757502e-05,
1527
+ "loss": 0.8254,
1528
+ "step": 217
1529
+ },
1530
+ {
1531
+ "epoch": 0.39,
1532
+ "grad_norm": 1.5066789735427286,
1533
+ "learning_rate": 1.4025272387399676e-05,
1534
+ "loss": 0.6886,
1535
+ "step": 218
1536
+ },
1537
+ {
1538
+ "epoch": 0.39,
1539
+ "grad_norm": 1.047602052004599,
1540
+ "learning_rate": 1.3972535001364014e-05,
1541
+ "loss": 0.8107,
1542
+ "step": 219
1543
+ },
1544
+ {
1545
+ "epoch": 0.39,
1546
+ "grad_norm": 1.9028584981292163,
1547
+ "learning_rate": 1.3919666098600753e-05,
1548
+ "loss": 0.7859,
1549
+ "step": 220
1550
+ },
1551
+ {
1552
+ "epoch": 0.39,
1553
+ "grad_norm": 1.1236913663983221,
1554
+ "learning_rate": 1.3866667429414188e-05,
1555
+ "loss": 0.7656,
1556
+ "step": 221
1557
+ },
1558
+ {
1559
+ "epoch": 0.39,
1560
+ "grad_norm": 1.0891172388783499,
1561
+ "learning_rate": 1.3813540748404734e-05,
1562
+ "loss": 0.8203,
1563
+ "step": 222
1564
+ },
1565
+ {
1566
+ "epoch": 0.4,
1567
+ "grad_norm": 1.1667104560101977,
1568
+ "learning_rate": 1.3760287814410822e-05,
1569
+ "loss": 0.7695,
1570
+ "step": 223
1571
+ },
1572
+ {
1573
+ "epoch": 0.4,
1574
+ "grad_norm": 1.0970968340081568,
1575
+ "learning_rate": 1.3706910390450679e-05,
1576
+ "loss": 0.7794,
1577
+ "step": 224
1578
+ },
1579
+ {
1580
+ "epoch": 0.4,
1581
+ "grad_norm": 1.0353263645139252,
1582
+ "learning_rate": 1.3653410243663953e-05,
1583
+ "loss": 0.7557,
1584
+ "step": 225
1585
+ },
1586
+ {
1587
+ "epoch": 0.4,
1588
+ "grad_norm": 1.1246530594282715,
1589
+ "learning_rate": 1.3599789145253226e-05,
1590
+ "loss": 0.7557,
1591
+ "step": 226
1592
+ },
1593
+ {
1594
+ "epoch": 0.4,
1595
+ "grad_norm": 1.036301793654716,
1596
+ "learning_rate": 1.3546048870425356e-05,
1597
+ "loss": 0.7556,
1598
+ "step": 227
1599
+ },
1600
+ {
1601
+ "epoch": 0.4,
1602
+ "grad_norm": 1.092416722925642,
1603
+ "learning_rate": 1.3492191198332725e-05,
1604
+ "loss": 0.8048,
1605
+ "step": 228
1606
+ },
1607
+ {
1608
+ "epoch": 0.41,
1609
+ "grad_norm": 1.3287906600486554,
1610
+ "learning_rate": 1.3438217912014318e-05,
1611
+ "loss": 0.7952,
1612
+ "step": 229
1613
+ },
1614
+ {
1615
+ "epoch": 0.41,
1616
+ "grad_norm": 1.3462381401254768,
1617
+ "learning_rate": 1.3384130798336705e-05,
1618
+ "loss": 0.7581,
1619
+ "step": 230
1620
+ },
1621
+ {
1622
+ "epoch": 0.41,
1623
+ "grad_norm": 1.3294253157215177,
1624
+ "learning_rate": 1.3329931647934884e-05,
1625
+ "loss": 0.7723,
1626
+ "step": 231
1627
+ },
1628
+ {
1629
+ "epoch": 0.41,
1630
+ "grad_norm": 1.534142920030296,
1631
+ "learning_rate": 1.3275622255152994e-05,
1632
+ "loss": 0.7712,
1633
+ "step": 232
1634
+ },
1635
+ {
1636
+ "epoch": 0.41,
1637
+ "grad_norm": 1.122000700902407,
1638
+ "learning_rate": 1.3221204417984907e-05,
1639
+ "loss": 0.7998,
1640
+ "step": 233
1641
+ },
1642
+ {
1643
+ "epoch": 0.42,
1644
+ "grad_norm": 1.219606607341259,
1645
+ "learning_rate": 1.3166679938014728e-05,
1646
+ "loss": 0.7467,
1647
+ "step": 234
1648
+ },
1649
+ {
1650
+ "epoch": 0.42,
1651
+ "grad_norm": 1.2888174749050882,
1652
+ "learning_rate": 1.311205062035711e-05,
1653
+ "loss": 0.783,
1654
+ "step": 235
1655
+ },
1656
+ {
1657
+ "epoch": 0.42,
1658
+ "grad_norm": 0.9381076410902784,
1659
+ "learning_rate": 1.3057318273597531e-05,
1660
+ "loss": 0.7808,
1661
+ "step": 236
1662
+ },
1663
+ {
1664
+ "epoch": 0.42,
1665
+ "grad_norm": 1.0511440079542627,
1666
+ "learning_rate": 1.300248470973239e-05,
1667
+ "loss": 0.7559,
1668
+ "step": 237
1669
+ },
1670
+ {
1671
+ "epoch": 0.42,
1672
+ "grad_norm": 1.0349236600724503,
1673
+ "learning_rate": 1.2947551744109044e-05,
1674
+ "loss": 0.7867,
1675
+ "step": 238
1676
+ },
1677
+ {
1678
+ "epoch": 0.42,
1679
+ "grad_norm": 0.9962346927775738,
1680
+ "learning_rate": 1.2892521195365679e-05,
1681
+ "loss": 0.7784,
1682
+ "step": 239
1683
+ },
1684
+ {
1685
+ "epoch": 0.43,
1686
+ "grad_norm": 1.01211478570776,
1687
+ "learning_rate": 1.2837394885371124e-05,
1688
+ "loss": 0.7505,
1689
+ "step": 240
1690
+ },
1691
+ {
1692
+ "epoch": 0.43,
1693
+ "grad_norm": 1.1594840054734818,
1694
+ "learning_rate": 1.2782174639164528e-05,
1695
+ "loss": 0.8209,
1696
+ "step": 241
1697
+ },
1698
+ {
1699
+ "epoch": 0.43,
1700
+ "grad_norm": 1.5411694924722625,
1701
+ "learning_rate": 1.2726862284894939e-05,
1702
+ "loss": 0.7022,
1703
+ "step": 242
1704
+ },
1705
+ {
1706
+ "epoch": 0.43,
1707
+ "grad_norm": 11.599019209766738,
1708
+ "learning_rate": 1.2671459653760781e-05,
1709
+ "loss": 0.7805,
1710
+ "step": 243
1711
+ },
1712
+ {
1713
+ "epoch": 0.43,
1714
+ "grad_norm": 1.440097235149696,
1715
+ "learning_rate": 1.2615968579949225e-05,
1716
+ "loss": 0.7316,
1717
+ "step": 244
1718
+ },
1719
+ {
1720
+ "epoch": 0.44,
1721
+ "grad_norm": 1.3372366896231092,
1722
+ "learning_rate": 1.2560390900575472e-05,
1723
+ "loss": 0.7589,
1724
+ "step": 245
1725
+ },
1726
+ {
1727
+ "epoch": 0.44,
1728
+ "grad_norm": 1.105604126041751,
1729
+ "learning_rate": 1.2504728455621935e-05,
1730
+ "loss": 0.795,
1731
+ "step": 246
1732
+ },
1733
+ {
1734
+ "epoch": 0.44,
1735
+ "grad_norm": 1.5393643288243302,
1736
+ "learning_rate": 1.244898308787731e-05,
1737
+ "loss": 0.7405,
1738
+ "step": 247
1739
+ },
1740
+ {
1741
+ "epoch": 0.44,
1742
+ "grad_norm": 2.468274498361346,
1743
+ "learning_rate": 1.2393156642875579e-05,
1744
+ "loss": 0.761,
1745
+ "step": 248
1746
+ },
1747
+ {
1748
+ "epoch": 0.44,
1749
+ "grad_norm": 1.3238659895664049,
1750
+ "learning_rate": 1.2337250968834912e-05,
1751
+ "loss": 0.7449,
1752
+ "step": 249
1753
+ },
1754
+ {
1755
+ "epoch": 0.44,
1756
+ "grad_norm": 1.0300122533315417,
1757
+ "learning_rate": 1.2281267916596474e-05,
1758
+ "loss": 0.8029,
1759
+ "step": 250
1760
+ },
1761
+ {
1762
+ "epoch": 0.45,
1763
+ "grad_norm": 1.7441854429035688,
1764
+ "learning_rate": 1.2225209339563144e-05,
1765
+ "loss": 0.7578,
1766
+ "step": 251
1767
+ },
1768
+ {
1769
+ "epoch": 0.45,
1770
+ "grad_norm": 1.019686827811183,
1771
+ "learning_rate": 1.2169077093638175e-05,
1772
+ "loss": 0.7683,
1773
+ "step": 252
1774
+ },
1775
+ {
1776
+ "epoch": 0.45,
1777
+ "grad_norm": 1.1348511043608238,
1778
+ "learning_rate": 1.2112873037163728e-05,
1779
+ "loss": 0.7656,
1780
+ "step": 253
1781
+ },
1782
+ {
1783
+ "epoch": 0.45,
1784
+ "grad_norm": 1.226402214745372,
1785
+ "learning_rate": 1.2056599030859367e-05,
1786
+ "loss": 0.8597,
1787
+ "step": 254
1788
+ },
1789
+ {
1790
+ "epoch": 0.45,
1791
+ "grad_norm": 0.945689755126611,
1792
+ "learning_rate": 1.2000256937760446e-05,
1793
+ "loss": 0.7545,
1794
+ "step": 255
1795
+ },
1796
+ {
1797
+ "epoch": 0.45,
1798
+ "grad_norm": 1.3506734624035819,
1799
+ "learning_rate": 1.1943848623156436e-05,
1800
+ "loss": 0.762,
1801
+ "step": 256
1802
+ },
1803
+ {
1804
+ "epoch": 0.46,
1805
+ "grad_norm": 1.1218264228304475,
1806
+ "learning_rate": 1.1887375954529167e-05,
1807
+ "loss": 0.734,
1808
+ "step": 257
1809
+ },
1810
+ {
1811
+ "epoch": 0.46,
1812
+ "grad_norm": 1.1724721829239755,
1813
+ "learning_rate": 1.1830840801491014e-05,
1814
+ "loss": 0.7525,
1815
+ "step": 258
1816
+ },
1817
+ {
1818
+ "epoch": 0.46,
1819
+ "grad_norm": 0.8740511029135943,
1820
+ "learning_rate": 1.1774245035722984e-05,
1821
+ "loss": 0.8227,
1822
+ "step": 259
1823
+ },
1824
+ {
1825
+ "epoch": 0.46,
1826
+ "grad_norm": 1.1338144219674435,
1827
+ "learning_rate": 1.1717590530912764e-05,
1828
+ "loss": 0.7997,
1829
+ "step": 260
1830
+ },
1831
+ {
1832
+ "epoch": 0.46,
1833
+ "grad_norm": 2.4527177700373994,
1834
+ "learning_rate": 1.1660879162692676e-05,
1835
+ "loss": 0.6995,
1836
+ "step": 261
1837
+ },
1838
+ {
1839
+ "epoch": 0.47,
1840
+ "grad_norm": 1.1079167279809168,
1841
+ "learning_rate": 1.1604112808577603e-05,
1842
+ "loss": 0.8415,
1843
+ "step": 262
1844
+ },
1845
+ {
1846
+ "epoch": 0.47,
1847
+ "grad_norm": 1.3963442463864142,
1848
+ "learning_rate": 1.1547293347902813e-05,
1849
+ "loss": 0.7237,
1850
+ "step": 263
1851
+ },
1852
+ {
1853
+ "epoch": 0.47,
1854
+ "grad_norm": 1.060519941420844,
1855
+ "learning_rate": 1.1490422661761744e-05,
1856
+ "loss": 0.7969,
1857
+ "step": 264
1858
+ },
1859
+ {
1860
+ "epoch": 0.47,
1861
+ "grad_norm": 2.4247537601070173,
1862
+ "learning_rate": 1.1433502632943735e-05,
1863
+ "loss": 0.7365,
1864
+ "step": 265
1865
+ },
1866
+ {
1867
+ "epoch": 0.47,
1868
+ "grad_norm": 1.0395011318393783,
1869
+ "learning_rate": 1.1376535145871685e-05,
1870
+ "loss": 0.7323,
1871
+ "step": 266
1872
+ },
1873
+ {
1874
+ "epoch": 0.47,
1875
+ "grad_norm": 1.2872576522201582,
1876
+ "learning_rate": 1.1319522086539666e-05,
1877
+ "loss": 0.7514,
1878
+ "step": 267
1879
+ },
1880
+ {
1881
+ "epoch": 0.48,
1882
+ "grad_norm": 0.8579921224078123,
1883
+ "learning_rate": 1.1262465342450494e-05,
1884
+ "loss": 0.7888,
1885
+ "step": 268
1886
+ },
1887
+ {
1888
+ "epoch": 0.48,
1889
+ "grad_norm": 1.1043236121717428,
1890
+ "learning_rate": 1.1205366802553231e-05,
1891
+ "loss": 0.7512,
1892
+ "step": 269
1893
+ },
1894
+ {
1895
+ "epoch": 0.48,
1896
+ "grad_norm": 1.314140212229249,
1897
+ "learning_rate": 1.1148228357180657e-05,
1898
+ "loss": 0.7945,
1899
+ "step": 270
1900
+ },
1901
+ {
1902
+ "epoch": 0.48,
1903
+ "grad_norm": 0.8645287535152224,
1904
+ "learning_rate": 1.1091051897986677e-05,
1905
+ "loss": 0.7964,
1906
+ "step": 271
1907
+ },
1908
+ {
1909
+ "epoch": 0.48,
1910
+ "grad_norm": 1.0606036174497515,
1911
+ "learning_rate": 1.10338393178837e-05,
1912
+ "loss": 0.7485,
1913
+ "step": 272
1914
+ },
1915
+ {
1916
+ "epoch": 0.48,
1917
+ "grad_norm": 1.3434898828929964,
1918
+ "learning_rate": 1.0976592510979982e-05,
1919
+ "loss": 0.7659,
1920
+ "step": 273
1921
+ },
1922
+ {
1923
+ "epoch": 0.49,
1924
+ "grad_norm": 1.0226310780483951,
1925
+ "learning_rate": 1.0919313372516894e-05,
1926
+ "loss": 0.7436,
1927
+ "step": 274
1928
+ },
1929
+ {
1930
+ "epoch": 0.49,
1931
+ "grad_norm": 1.0194327081170713,
1932
+ "learning_rate": 1.0862003798806195e-05,
1933
+ "loss": 0.7326,
1934
+ "step": 275
1935
+ },
1936
+ {
1937
+ "epoch": 0.49,
1938
+ "grad_norm": 1.1420415262511832,
1939
+ "learning_rate": 1.0804665687167262e-05,
1940
+ "loss": 0.7716,
1941
+ "step": 276
1942
+ },
1943
+ {
1944
+ "epoch": 0.49,
1945
+ "grad_norm": 1.0405745082215876,
1946
+ "learning_rate": 1.0747300935864245e-05,
1947
+ "loss": 0.7562,
1948
+ "step": 277
1949
+ },
1950
+ {
1951
+ "epoch": 0.49,
1952
+ "grad_norm": 0.9411416560859605,
1953
+ "learning_rate": 1.0689911444043249e-05,
1954
+ "loss": 0.7892,
1955
+ "step": 278
1956
+ },
1957
+ {
1958
+ "epoch": 0.5,
1959
+ "grad_norm": 1.0638350695922085,
1960
+ "learning_rate": 1.0632499111669453e-05,
1961
+ "loss": 0.7924,
1962
+ "step": 279
1963
+ },
1964
+ {
1965
+ "epoch": 0.5,
1966
+ "grad_norm": 0.8896644123246137,
1967
+ "learning_rate": 1.0575065839464207e-05,
1968
+ "loss": 0.7944,
1969
+ "step": 280
1970
+ },
1971
+ {
1972
+ "epoch": 0.5,
1973
+ "grad_norm": 1.3851887010258916,
1974
+ "learning_rate": 1.0517613528842096e-05,
1975
+ "loss": 0.7523,
1976
+ "step": 281
1977
+ },
1978
+ {
1979
+ "epoch": 0.5,
1980
+ "grad_norm": 0.8564790731817052,
1981
+ "learning_rate": 1.0460144081848006e-05,
1982
+ "loss": 0.8007,
1983
+ "step": 282
1984
+ },
1985
+ {
1986
+ "epoch": 0.5,
1987
+ "grad_norm": 1.472385478361725,
1988
+ "learning_rate": 1.0402659401094154e-05,
1989
+ "loss": 0.742,
1990
+ "step": 283
1991
+ },
1992
+ {
1993
+ "epoch": 0.5,
1994
+ "grad_norm": 1.2343696078506177,
1995
+ "learning_rate": 1.0345161389697083e-05,
1996
+ "loss": 0.735,
1997
+ "step": 284
1998
+ },
1999
+ {
2000
+ "epoch": 0.51,
2001
+ "grad_norm": 1.0664256469995077,
2002
+ "learning_rate": 1.0287651951214675e-05,
2003
+ "loss": 0.7707,
2004
+ "step": 285
2005
+ },
2006
+ {
2007
+ "epoch": 0.51,
2008
+ "grad_norm": 2.7853431478072315,
2009
+ "learning_rate": 1.0230132989583122e-05,
2010
+ "loss": 0.7754,
2011
+ "step": 286
2012
+ },
2013
+ {
2014
+ "epoch": 0.51,
2015
+ "grad_norm": 1.4312677584129017,
2016
+ "learning_rate": 1.0172606409053887e-05,
2017
+ "loss": 0.7561,
2018
+ "step": 287
2019
+ },
2020
+ {
2021
+ "epoch": 0.51,
2022
+ "grad_norm": 1.434894152042441,
2023
+ "learning_rate": 1.0115074114130676e-05,
2024
+ "loss": 0.8314,
2025
+ "step": 288
2026
+ },
2027
+ {
2028
+ "epoch": 0.51,
2029
+ "grad_norm": 1.40363743791131,
2030
+ "learning_rate": 1.0057538009506378e-05,
2031
+ "loss": 0.7358,
2032
+ "step": 289
2033
+ },
2034
+ {
2035
+ "epoch": 0.52,
2036
+ "grad_norm": 1.4216319281561687,
2037
+ "learning_rate": 1e-05,
2038
+ "loss": 0.7821,
2039
+ "step": 290
2040
+ },
2041
+ {
2042
+ "epoch": 0.52,
2043
+ "grad_norm": 1.1843530926281,
2044
+ "learning_rate": 9.942461990493627e-06,
2045
+ "loss": 0.7269,
2046
+ "step": 291
2047
+ },
2048
+ {
2049
+ "epoch": 0.52,
2050
+ "grad_norm": 1.198960472374662,
2051
+ "learning_rate": 9.884925885869326e-06,
2052
+ "loss": 0.774,
2053
+ "step": 292
2054
+ },
2055
+ {
2056
+ "epoch": 0.52,
2057
+ "grad_norm": 1.3700679139092526,
2058
+ "learning_rate": 9.827393590946116e-06,
2059
+ "loss": 0.7289,
2060
+ "step": 293
2061
+ },
2062
+ {
2063
+ "epoch": 0.52,
2064
+ "grad_norm": 1.3134346846483278,
2065
+ "learning_rate": 9.769867010416883e-06,
2066
+ "loss": 0.735,
2067
+ "step": 294
2068
+ },
2069
+ {
2070
+ "epoch": 0.52,
2071
+ "grad_norm": 1.766483532838929,
2072
+ "learning_rate": 9.71234804878533e-06,
2073
+ "loss": 0.7761,
2074
+ "step": 295
2075
+ },
2076
+ {
2077
+ "epoch": 0.53,
2078
+ "grad_norm": 1.1321036509904978,
2079
+ "learning_rate": 9.654838610302922e-06,
2080
+ "loss": 0.7386,
2081
+ "step": 296
2082
+ },
2083
+ {
2084
+ "epoch": 0.53,
2085
+ "grad_norm": 1.1929839213242892,
2086
+ "learning_rate": 9.597340598905851e-06,
2087
+ "loss": 0.8203,
2088
+ "step": 297
2089
+ },
2090
+ {
2091
+ "epoch": 0.53,
2092
+ "grad_norm": 1.1981861529295657,
2093
+ "learning_rate": 9.539855918151999e-06,
2094
+ "loss": 0.7094,
2095
+ "step": 298
2096
+ },
2097
+ {
2098
+ "epoch": 0.53,
2099
+ "grad_norm": 1.0586477146206266,
2100
+ "learning_rate": 9.482386471157905e-06,
2101
+ "loss": 0.8288,
2102
+ "step": 299
2103
+ },
2104
+ {
2105
+ "epoch": 0.53,
2106
+ "grad_norm": 2.2947958743267374,
2107
+ "learning_rate": 9.424934160535795e-06,
2108
+ "loss": 0.6719,
2109
+ "step": 300
2110
+ },
2111
+ {
2112
+ "epoch": 0.53,
2113
+ "grad_norm": 1.1695655494977126,
2114
+ "learning_rate": 9.367500888330546e-06,
2115
+ "loss": 0.8039,
2116
+ "step": 301
2117
+ },
2118
+ {
2119
+ "epoch": 0.54,
2120
+ "grad_norm": 1.1394813339124892,
2121
+ "learning_rate": 9.310088555956751e-06,
2122
+ "loss": 0.7279,
2123
+ "step": 302
2124
+ },
2125
+ {
2126
+ "epoch": 0.54,
2127
+ "grad_norm": 1.2737270910437388,
2128
+ "learning_rate": 9.252699064135759e-06,
2129
+ "loss": 0.7462,
2130
+ "step": 303
2131
+ },
2132
+ {
2133
+ "epoch": 0.54,
2134
+ "grad_norm": 1.1045855514533351,
2135
+ "learning_rate": 9.195334312832742e-06,
2136
+ "loss": 0.7522,
2137
+ "step": 304
2138
+ },
2139
+ {
2140
+ "epoch": 0.54,
2141
+ "grad_norm": 1.1375565719120944,
2142
+ "learning_rate": 9.137996201193807e-06,
2143
+ "loss": 0.7923,
2144
+ "step": 305
2145
+ },
2146
+ {
2147
+ "epoch": 0.54,
2148
+ "grad_norm": 1.0738044490098744,
2149
+ "learning_rate": 9.080686627483111e-06,
2150
+ "loss": 0.7591,
2151
+ "step": 306
2152
+ },
2153
+ {
2154
+ "epoch": 0.55,
2155
+ "grad_norm": 1.2993614485597482,
2156
+ "learning_rate": 9.02340748902002e-06,
2157
+ "loss": 0.6994,
2158
+ "step": 307
2159
+ },
2160
+ {
2161
+ "epoch": 0.55,
2162
+ "grad_norm": 1.5117034251500119,
2163
+ "learning_rate": 8.966160682116301e-06,
2164
+ "loss": 0.8261,
2165
+ "step": 308
2166
+ },
2167
+ {
2168
+ "epoch": 0.55,
2169
+ "grad_norm": 1.3780522053648592,
2170
+ "learning_rate": 8.908948102013326e-06,
2171
+ "loss": 0.7309,
2172
+ "step": 309
2173
+ },
2174
+ {
2175
+ "epoch": 0.55,
2176
+ "grad_norm": 1.4972338805756236,
2177
+ "learning_rate": 8.851771642819346e-06,
2178
+ "loss": 0.727,
2179
+ "step": 310
2180
+ },
2181
+ {
2182
+ "epoch": 0.55,
2183
+ "grad_norm": 1.4680656432100794,
2184
+ "learning_rate": 8.79463319744677e-06,
2185
+ "loss": 0.7285,
2186
+ "step": 311
2187
+ },
2188
+ {
2189
+ "epoch": 0.55,
2190
+ "grad_norm": 2.313846141986661,
2191
+ "learning_rate": 8.73753465754951e-06,
2192
+ "loss": 0.7945,
2193
+ "step": 312
2194
+ },
2195
+ {
2196
+ "epoch": 0.56,
2197
+ "grad_norm": 1.2869463268384915,
2198
+ "learning_rate": 8.680477913460339e-06,
2199
+ "loss": 0.7959,
2200
+ "step": 313
2201
+ },
2202
+ {
2203
+ "epoch": 0.56,
2204
+ "grad_norm": 2.106280518292013,
2205
+ "learning_rate": 8.62346485412832e-06,
2206
+ "loss": 0.74,
2207
+ "step": 314
2208
+ },
2209
+ {
2210
+ "epoch": 0.56,
2211
+ "grad_norm": 1.3531581194667899,
2212
+ "learning_rate": 8.566497367056268e-06,
2213
+ "loss": 0.6986,
2214
+ "step": 315
2215
+ },
2216
+ {
2217
+ "epoch": 0.56,
2218
+ "grad_norm": 1.4197697588908693,
2219
+ "learning_rate": 8.509577338238255e-06,
2220
+ "loss": 0.781,
2221
+ "step": 316
2222
+ },
2223
+ {
2224
+ "epoch": 0.56,
2225
+ "grad_norm": 1.4349145256946136,
2226
+ "learning_rate": 8.452706652097187e-06,
2227
+ "loss": 0.7567,
2228
+ "step": 317
2229
+ },
2230
+ {
2231
+ "epoch": 0.56,
2232
+ "grad_norm": 1.677424093901339,
2233
+ "learning_rate": 8.395887191422397e-06,
2234
+ "loss": 0.7277,
2235
+ "step": 318
2236
+ },
2237
+ {
2238
+ "epoch": 0.57,
2239
+ "grad_norm": 3.0582740634732097,
2240
+ "learning_rate": 8.339120837307324e-06,
2241
+ "loss": 0.722,
2242
+ "step": 319
2243
+ },
2244
+ {
2245
+ "epoch": 0.57,
2246
+ "grad_norm": 3.7393227504364246,
2247
+ "learning_rate": 8.28240946908724e-06,
2248
+ "loss": 0.8167,
2249
+ "step": 320
2250
+ },
2251
+ {
2252
+ "epoch": 0.57,
2253
+ "grad_norm": 1.581227401509297,
2254
+ "learning_rate": 8.225754964277018e-06,
2255
+ "loss": 0.7352,
2256
+ "step": 321
2257
+ },
2258
+ {
2259
+ "epoch": 0.57,
2260
+ "grad_norm": 1.470503432709286,
2261
+ "learning_rate": 8.169159198508987e-06,
2262
+ "loss": 0.7977,
2263
+ "step": 322
2264
+ },
2265
+ {
2266
+ "epoch": 0.57,
2267
+ "grad_norm": 1.4594103330779356,
2268
+ "learning_rate": 8.112624045470834e-06,
2269
+ "loss": 0.7568,
2270
+ "step": 323
2271
+ },
2272
+ {
2273
+ "epoch": 0.58,
2274
+ "grad_norm": 1.5307349721492423,
2275
+ "learning_rate": 8.056151376843568e-06,
2276
+ "loss": 0.6967,
2277
+ "step": 324
2278
+ },
2279
+ {
2280
+ "epoch": 0.58,
2281
+ "grad_norm": 1.5603332209161358,
2282
+ "learning_rate": 7.999743062239557e-06,
2283
+ "loss": 0.7951,
2284
+ "step": 325
2285
+ },
2286
+ {
2287
+ "epoch": 0.58,
2288
+ "grad_norm": 2.5996132473445206,
2289
+ "learning_rate": 7.943400969140635e-06,
2290
+ "loss": 0.7474,
2291
+ "step": 326
2292
+ },
2293
+ {
2294
+ "epoch": 0.58,
2295
+ "grad_norm": 3.334122489866669,
2296
+ "learning_rate": 7.887126962836274e-06,
2297
+ "loss": 0.759,
2298
+ "step": 327
2299
+ },
2300
+ {
2301
+ "epoch": 0.58,
2302
+ "grad_norm": 1.9981089012739424,
2303
+ "learning_rate": 7.830922906361827e-06,
2304
+ "loss": 0.7641,
2305
+ "step": 328
2306
+ },
2307
+ {
2308
+ "epoch": 0.58,
2309
+ "grad_norm": 1.3813790955360155,
2310
+ "learning_rate": 7.774790660436857e-06,
2311
+ "loss": 0.7285,
2312
+ "step": 329
2313
+ },
2314
+ {
2315
+ "epoch": 0.59,
2316
+ "grad_norm": 1.2395963850748397,
2317
+ "learning_rate": 7.718732083403531e-06,
2318
+ "loss": 0.796,
2319
+ "step": 330
2320
+ },
2321
+ {
2322
+ "epoch": 0.59,
2323
+ "grad_norm": 1.8038963005397093,
2324
+ "learning_rate": 7.662749031165093e-06,
2325
+ "loss": 0.7354,
2326
+ "step": 331
2327
+ },
2328
+ {
2329
+ "epoch": 0.59,
2330
+ "grad_norm": 1.55966722915584,
2331
+ "learning_rate": 7.606843357124426e-06,
2332
+ "loss": 0.7729,
2333
+ "step": 332
2334
+ },
2335
+ {
2336
+ "epoch": 0.59,
2337
+ "grad_norm": 1.5927922672934738,
2338
+ "learning_rate": 7.551016912122692e-06,
2339
+ "loss": 0.6933,
2340
+ "step": 333
2341
+ },
2342
+ {
2343
+ "epoch": 0.59,
2344
+ "grad_norm": 1.0699588514141283,
2345
+ "learning_rate": 7.4952715443780665e-06,
2346
+ "loss": 0.8096,
2347
+ "step": 334
2348
+ },
2349
+ {
2350
+ "epoch": 0.6,
2351
+ "grad_norm": 1.6246603724667785,
2352
+ "learning_rate": 7.4396090994245295e-06,
2353
+ "loss": 0.7943,
2354
+ "step": 335
2355
+ },
2356
+ {
2357
+ "epoch": 0.6,
2358
+ "grad_norm": 1.1888479591553487,
2359
+ "learning_rate": 7.384031420050779e-06,
2360
+ "loss": 0.7953,
2361
+ "step": 336
2362
+ },
2363
+ {
2364
+ "epoch": 0.6,
2365
+ "grad_norm": 1.552386758593148,
2366
+ "learning_rate": 7.328540346239222e-06,
2367
+ "loss": 0.7619,
2368
+ "step": 337
2369
+ },
2370
+ {
2371
+ "epoch": 0.6,
2372
+ "grad_norm": 1.580381187107915,
2373
+ "learning_rate": 7.273137715105063e-06,
2374
+ "loss": 0.7629,
2375
+ "step": 338
2376
+ },
2377
+ {
2378
+ "epoch": 0.6,
2379
+ "grad_norm": 1.2304680598494862,
2380
+ "learning_rate": 7.217825360835475e-06,
2381
+ "loss": 0.7551,
2382
+ "step": 339
2383
+ },
2384
+ {
2385
+ "epoch": 0.6,
2386
+ "grad_norm": 7.949474583996868,
2387
+ "learning_rate": 7.162605114628879e-06,
2388
+ "loss": 0.7413,
2389
+ "step": 340
2390
+ },
2391
+ {
2392
+ "epoch": 0.61,
2393
+ "grad_norm": 1.7323775275331923,
2394
+ "learning_rate": 7.107478804634324e-06,
2395
+ "loss": 0.7075,
2396
+ "step": 341
2397
+ },
2398
+ {
2399
+ "epoch": 0.61,
2400
+ "grad_norm": 1.2608510194692342,
2401
+ "learning_rate": 7.052448255890958e-06,
2402
+ "loss": 0.7804,
2403
+ "step": 342
2404
+ },
2405
+ {
2406
+ "epoch": 0.61,
2407
+ "grad_norm": 1.347750741978453,
2408
+ "learning_rate": 6.997515290267611e-06,
2409
+ "loss": 0.7368,
2410
+ "step": 343
2411
+ },
2412
+ {
2413
+ "epoch": 0.61,
2414
+ "grad_norm": 1.6326688971820857,
2415
+ "learning_rate": 6.942681726402474e-06,
2416
+ "loss": 0.7809,
2417
+ "step": 344
2418
+ },
2419
+ {
2420
+ "epoch": 0.61,
2421
+ "grad_norm": 2.095587605698155,
2422
+ "learning_rate": 6.887949379642893e-06,
2423
+ "loss": 0.805,
2424
+ "step": 345
2425
+ },
2426
+ {
2427
+ "epoch": 0.61,
2428
+ "grad_norm": 2.3280279836708337,
2429
+ "learning_rate": 6.833320061985278e-06,
2430
+ "loss": 0.7814,
2431
+ "step": 346
2432
+ },
2433
+ {
2434
+ "epoch": 0.62,
2435
+ "grad_norm": 1.4129001593840296,
2436
+ "learning_rate": 6.778795582015096e-06,
2437
+ "loss": 0.7175,
2438
+ "step": 347
2439
+ },
2440
+ {
2441
+ "epoch": 0.62,
2442
+ "grad_norm": 1.8428763282151688,
2443
+ "learning_rate": 6.724377744847013e-06,
2444
+ "loss": 0.8029,
2445
+ "step": 348
2446
+ },
2447
+ {
2448
+ "epoch": 0.62,
2449
+ "grad_norm": 23.919369190129455,
2450
+ "learning_rate": 6.67006835206512e-06,
2451
+ "loss": 0.6863,
2452
+ "step": 349
2453
+ },
2454
+ {
2455
+ "epoch": 0.62,
2456
+ "grad_norm": 2.0252490459198977,
2457
+ "learning_rate": 6.615869201663296e-06,
2458
+ "loss": 0.7234,
2459
+ "step": 350
2460
+ },
2461
+ {
2462
+ "epoch": 0.62,
2463
+ "grad_norm": 1.4586085919502172,
2464
+ "learning_rate": 6.561782087985682e-06,
2465
+ "loss": 0.7848,
2466
+ "step": 351
2467
+ },
2468
+ {
2469
+ "epoch": 0.63,
2470
+ "grad_norm": 1.3615988764007254,
2471
+ "learning_rate": 6.507808801667275e-06,
2472
+ "loss": 0.7288,
2473
+ "step": 352
2474
+ },
2475
+ {
2476
+ "epoch": 0.63,
2477
+ "grad_norm": 1.2707870687019411,
2478
+ "learning_rate": 6.453951129574644e-06,
2479
+ "loss": 0.7994,
2480
+ "step": 353
2481
+ },
2482
+ {
2483
+ "epoch": 0.63,
2484
+ "grad_norm": 1.2789794436108992,
2485
+ "learning_rate": 6.400210854746776e-06,
2486
+ "loss": 0.7892,
2487
+ "step": 354
2488
+ },
2489
+ {
2490
+ "epoch": 0.63,
2491
+ "grad_norm": 173.76063353258326,
2492
+ "learning_rate": 6.34658975633605e-06,
2493
+ "loss": 0.7521,
2494
+ "step": 355
2495
+ },
2496
+ {
2497
+ "epoch": 0.63,
2498
+ "grad_norm": 1.451279782269762,
2499
+ "learning_rate": 6.293089609549325e-06,
2500
+ "loss": 0.6994,
2501
+ "step": 356
2502
+ },
2503
+ {
2504
+ "epoch": 0.63,
2505
+ "grad_norm": 1.353528520599467,
2506
+ "learning_rate": 6.239712185589181e-06,
2507
+ "loss": 0.8124,
2508
+ "step": 357
2509
+ },
2510
+ {
2511
+ "epoch": 0.64,
2512
+ "grad_norm": 1.3427971146726998,
2513
+ "learning_rate": 6.186459251595267e-06,
2514
+ "loss": 0.6997,
2515
+ "step": 358
2516
+ },
2517
+ {
2518
+ "epoch": 0.64,
2519
+ "grad_norm": 1.7436977861938026,
2520
+ "learning_rate": 6.133332570585813e-06,
2521
+ "loss": 0.7466,
2522
+ "step": 359
2523
+ },
2524
+ {
2525
+ "epoch": 0.64,
2526
+ "grad_norm": 1.1504667545933847,
2527
+ "learning_rate": 6.080333901399252e-06,
2528
+ "loss": 0.759,
2529
+ "step": 360
2530
+ },
2531
+ {
2532
+ "epoch": 0.64,
2533
+ "grad_norm": 1.198911606483234,
2534
+ "learning_rate": 6.02746499863599e-06,
2535
+ "loss": 0.7806,
2536
+ "step": 361
2537
+ },
2538
+ {
2539
+ "epoch": 0.64,
2540
+ "grad_norm": 1.6129378703199322,
2541
+ "learning_rate": 5.9747276126003265e-06,
2542
+ "loss": 0.7609,
2543
+ "step": 362
2544
+ },
2545
+ {
2546
+ "epoch": 0.64,
2547
+ "grad_norm": 1.1562370828669843,
2548
+ "learning_rate": 5.922123489242499e-06,
2549
+ "loss": 0.8708,
2550
+ "step": 363
2551
+ },
2552
+ {
2553
+ "epoch": 0.65,
2554
+ "grad_norm": 1.4562484055998943,
2555
+ "learning_rate": 5.869654370100887e-06,
2556
+ "loss": 0.7431,
2557
+ "step": 364
2558
+ },
2559
+ {
2560
+ "epoch": 0.65,
2561
+ "grad_norm": 1.0680361234204387,
2562
+ "learning_rate": 5.8173219922443516e-06,
2563
+ "loss": 0.8032,
2564
+ "step": 365
2565
+ },
2566
+ {
2567
+ "epoch": 0.65,
2568
+ "grad_norm": 0.9284927777737381,
2569
+ "learning_rate": 5.765128088214723e-06,
2570
+ "loss": 0.7889,
2571
+ "step": 366
2572
+ },
2573
+ {
2574
+ "epoch": 0.65,
2575
+ "grad_norm": 1.1936424602098312,
2576
+ "learning_rate": 5.713074385969457e-06,
2577
+ "loss": 0.8115,
2578
+ "step": 367
2579
+ },
2580
+ {
2581
+ "epoch": 0.65,
2582
+ "grad_norm": 0.9730264080342912,
2583
+ "learning_rate": 5.66116260882442e-06,
2584
+ "loss": 0.7615,
2585
+ "step": 368
2586
+ },
2587
+ {
2588
+ "epoch": 0.66,
2589
+ "grad_norm": 1.0168331506692085,
2590
+ "learning_rate": 5.609394475396821e-06,
2591
+ "loss": 0.7566,
2592
+ "step": 369
2593
+ },
2594
+ {
2595
+ "epoch": 0.66,
2596
+ "grad_norm": 1.0193464829148098,
2597
+ "learning_rate": 5.557771699548347e-06,
2598
+ "loss": 0.7821,
2599
+ "step": 370
2600
+ },
2601
+ {
2602
+ "epoch": 0.66,
2603
+ "grad_norm": 1.512465787439959,
2604
+ "learning_rate": 5.5062959903283855e-06,
2605
+ "loss": 0.801,
2606
+ "step": 371
2607
+ },
2608
+ {
2609
+ "epoch": 0.66,
2610
+ "grad_norm": 2.8070018653706734,
2611
+ "learning_rate": 5.454969051917482e-06,
2612
+ "loss": 0.8019,
2613
+ "step": 372
2614
+ },
2615
+ {
2616
+ "epoch": 0.66,
2617
+ "grad_norm": 1.29102477160499,
2618
+ "learning_rate": 5.403792583570884e-06,
2619
+ "loss": 0.717,
2620
+ "step": 373
2621
+ },
2622
+ {
2623
+ "epoch": 0.66,
2624
+ "grad_norm": 1.0476339722470762,
2625
+ "learning_rate": 5.352768279562315e-06,
2626
+ "loss": 0.7767,
2627
+ "step": 374
2628
+ },
2629
+ {
2630
+ "epoch": 0.67,
2631
+ "grad_norm": 1.0218859582674915,
2632
+ "learning_rate": 5.3018978291278635e-06,
2633
+ "loss": 0.7388,
2634
+ "step": 375
2635
+ },
2636
+ {
2637
+ "epoch": 0.67,
2638
+ "grad_norm": 0.8879863478698906,
2639
+ "learning_rate": 5.251182916410061e-06,
2640
+ "loss": 0.7781,
2641
+ "step": 376
2642
+ },
2643
+ {
2644
+ "epoch": 0.67,
2645
+ "grad_norm": 1.118103740784447,
2646
+ "learning_rate": 5.200625220402139e-06,
2647
+ "loss": 0.7485,
2648
+ "step": 377
2649
+ },
2650
+ {
2651
+ "epoch": 0.67,
2652
+ "grad_norm": 0.9151353492890569,
2653
+ "learning_rate": 5.150226414892426e-06,
2654
+ "loss": 0.735,
2655
+ "step": 378
2656
+ },
2657
+ {
2658
+ "epoch": 0.67,
2659
+ "grad_norm": 1.3193616869908815,
2660
+ "learning_rate": 5.099988168408952e-06,
2661
+ "loss": 0.8344,
2662
+ "step": 379
2663
+ },
2664
+ {
2665
+ "epoch": 0.67,
2666
+ "grad_norm": 0.8632307336970306,
2667
+ "learning_rate": 5.049912144164186e-06,
2668
+ "loss": 0.751,
2669
+ "step": 380
2670
+ },
2671
+ {
2672
+ "epoch": 0.68,
2673
+ "grad_norm": 0.9901488846066039,
2674
+ "learning_rate": 5.000000000000003e-06,
2675
+ "loss": 0.7699,
2676
+ "step": 381
2677
+ },
2678
+ {
2679
+ "epoch": 0.68,
2680
+ "grad_norm": 1.101506870811026,
2681
+ "learning_rate": 4.950253388332763e-06,
2682
+ "loss": 0.7011,
2683
+ "step": 382
2684
+ },
2685
+ {
2686
+ "epoch": 0.68,
2687
+ "grad_norm": 1.0746169854564547,
2688
+ "learning_rate": 4.900673956098644e-06,
2689
+ "loss": 0.7929,
2690
+ "step": 383
2691
+ },
2692
+ {
2693
+ "epoch": 0.68,
2694
+ "grad_norm": 0.8732023653035873,
2695
+ "learning_rate": 4.8512633446990805e-06,
2696
+ "loss": 0.8045,
2697
+ "step": 384
2698
+ },
2699
+ {
2700
+ "epoch": 0.68,
2701
+ "grad_norm": 0.6916355479779134,
2702
+ "learning_rate": 4.802023189946454e-06,
2703
+ "loss": 0.7143,
2704
+ "step": 385
2705
+ },
2706
+ {
2707
+ "epoch": 0.69,
2708
+ "grad_norm": 0.779756473268933,
2709
+ "learning_rate": 4.75295512200992e-06,
2710
+ "loss": 0.7683,
2711
+ "step": 386
2712
+ },
2713
+ {
2714
+ "epoch": 0.69,
2715
+ "grad_norm": 0.909706557431742,
2716
+ "learning_rate": 4.7040607653614335e-06,
2717
+ "loss": 0.7467,
2718
+ "step": 387
2719
+ },
2720
+ {
2721
+ "epoch": 0.69,
2722
+ "grad_norm": 0.7722540383691884,
2723
+ "learning_rate": 4.655341738721989e-06,
2724
+ "loss": 0.7815,
2725
+ "step": 388
2726
+ },
2727
+ {
2728
+ "epoch": 0.69,
2729
+ "grad_norm": 0.9684329548399441,
2730
+ "learning_rate": 4.606799655008009e-06,
2731
+ "loss": 0.7497,
2732
+ "step": 389
2733
+ },
2734
+ {
2735
+ "epoch": 0.69,
2736
+ "grad_norm": 1.0483349519846141,
2737
+ "learning_rate": 4.558436121277957e-06,
2738
+ "loss": 0.7319,
2739
+ "step": 390
2740
+ },
2741
+ {
2742
+ "epoch": 0.69,
2743
+ "grad_norm": 0.8099534417037388,
2744
+ "learning_rate": 4.510252738679136e-06,
2745
+ "loss": 0.7647,
2746
+ "step": 391
2747
+ },
2748
+ {
2749
+ "epoch": 0.7,
2750
+ "grad_norm": 1.1081247822447862,
2751
+ "learning_rate": 4.462251102394669e-06,
2752
+ "loss": 0.7461,
2753
+ "step": 392
2754
+ },
2755
+ {
2756
+ "epoch": 0.7,
2757
+ "grad_norm": 0.9893574445652334,
2758
+ "learning_rate": 4.414432801590703e-06,
2759
+ "loss": 0.7783,
2760
+ "step": 393
2761
+ },
2762
+ {
2763
+ "epoch": 0.7,
2764
+ "grad_norm": 1.8652426181110364,
2765
+ "learning_rate": 4.3667994193637794e-06,
2766
+ "loss": 0.7563,
2767
+ "step": 394
2768
+ },
2769
+ {
2770
+ "epoch": 0.7,
2771
+ "grad_norm": 1.4008789517131635,
2772
+ "learning_rate": 4.319352532688444e-06,
2773
+ "loss": 0.7786,
2774
+ "step": 395
2775
+ },
2776
+ {
2777
+ "epoch": 0.7,
2778
+ "grad_norm": 0.9945515863927269,
2779
+ "learning_rate": 4.272093712365016e-06,
2780
+ "loss": 0.7605,
2781
+ "step": 396
2782
+ },
2783
+ {
2784
+ "epoch": 0.71,
2785
+ "grad_norm": 0.7065491597356962,
2786
+ "learning_rate": 4.225024522967602e-06,
2787
+ "loss": 0.8059,
2788
+ "step": 397
2789
+ },
2790
+ {
2791
+ "epoch": 0.71,
2792
+ "grad_norm": 0.8085670100730566,
2793
+ "learning_rate": 4.178146522792296e-06,
2794
+ "loss": 0.7675,
2795
+ "step": 398
2796
+ },
2797
+ {
2798
+ "epoch": 0.71,
2799
+ "grad_norm": 0.7493202614166902,
2800
+ "learning_rate": 4.1314612638055766e-06,
2801
+ "loss": 0.6753,
2802
+ "step": 399
2803
+ },
2804
+ {
2805
+ "epoch": 0.71,
2806
+ "grad_norm": 0.9780288557512398,
2807
+ "learning_rate": 4.084970291592948e-06,
2808
+ "loss": 0.8119,
2809
+ "step": 400
2810
+ },
2811
+ {
2812
+ "epoch": 0.71,
2813
+ "grad_norm": 0.9642423794575019,
2814
+ "learning_rate": 4.038675145307747e-06,
2815
+ "loss": 0.7209,
2816
+ "step": 401
2817
+ },
2818
+ {
2819
+ "epoch": 0.71,
2820
+ "grad_norm": 2.805757303861435,
2821
+ "learning_rate": 3.99257735762021e-06,
2822
+ "loss": 0.7739,
2823
+ "step": 402
2824
+ },
2825
+ {
2826
+ "epoch": 0.72,
2827
+ "grad_norm": 0.7352143355461409,
2828
+ "learning_rate": 3.946678454666719e-06,
2829
+ "loss": 0.7686,
2830
+ "step": 403
2831
+ },
2832
+ {
2833
+ "epoch": 0.72,
2834
+ "grad_norm": 0.9660000138982177,
2835
+ "learning_rate": 3.900979955999271e-06,
2836
+ "loss": 0.7576,
2837
+ "step": 404
2838
+ },
2839
+ {
2840
+ "epoch": 0.72,
2841
+ "grad_norm": 1.0101800258798939,
2842
+ "learning_rate": 3.855483374535191e-06,
2843
+ "loss": 0.7244,
2844
+ "step": 405
2845
+ },
2846
+ {
2847
+ "epoch": 0.72,
2848
+ "grad_norm": 0.6558303005788094,
2849
+ "learning_rate": 3.810190216507017e-06,
2850
+ "loss": 0.814,
2851
+ "step": 406
2852
+ },
2853
+ {
2854
+ "epoch": 0.72,
2855
+ "grad_norm": 0.855723897165516,
2856
+ "learning_rate": 3.7651019814126656e-06,
2857
+ "loss": 0.7209,
2858
+ "step": 407
2859
+ },
2860
+ {
2861
+ "epoch": 0.72,
2862
+ "grad_norm": 0.8337824890986832,
2863
+ "learning_rate": 3.7202201619657575e-06,
2864
+ "loss": 0.7474,
2865
+ "step": 408
2866
+ },
2867
+ {
2868
+ "epoch": 0.73,
2869
+ "grad_norm": 0.8106968198738221,
2870
+ "learning_rate": 3.6755462440462288e-06,
2871
+ "loss": 0.7723,
2872
+ "step": 409
2873
+ },
2874
+ {
2875
+ "epoch": 0.73,
2876
+ "grad_norm": 0.7782544106560358,
2877
+ "learning_rate": 3.6310817066511106e-06,
2878
+ "loss": 0.7685,
2879
+ "step": 410
2880
+ },
2881
+ {
2882
+ "epoch": 0.73,
2883
+ "grad_norm": 0.9143992276666147,
2884
+ "learning_rate": 3.58682802184558e-06,
2885
+ "loss": 0.7259,
2886
+ "step": 411
2887
+ },
2888
+ {
2889
+ "epoch": 0.73,
2890
+ "grad_norm": 0.7313441515558586,
2891
+ "learning_rate": 3.542786654714234e-06,
2892
+ "loss": 0.7734,
2893
+ "step": 412
2894
+ },
2895
+ {
2896
+ "epoch": 0.73,
2897
+ "grad_norm": 0.9886120170991388,
2898
+ "learning_rate": 3.4989590633125583e-06,
2899
+ "loss": 0.7262,
2900
+ "step": 413
2901
+ },
2902
+ {
2903
+ "epoch": 0.74,
2904
+ "grad_norm": 0.9615177391847125,
2905
+ "learning_rate": 3.455346698618689e-06,
2906
+ "loss": 0.7533,
2907
+ "step": 414
2908
+ },
2909
+ {
2910
+ "epoch": 0.74,
2911
+ "grad_norm": 0.7015094641187799,
2912
+ "learning_rate": 3.4119510044853434e-06,
2913
+ "loss": 0.793,
2914
+ "step": 415
2915
+ },
2916
+ {
2917
+ "epoch": 0.74,
2918
+ "grad_norm": 0.7446915794929314,
2919
+ "learning_rate": 3.3687734175920505e-06,
2920
+ "loss": 0.7465,
2921
+ "step": 416
2922
+ },
2923
+ {
2924
+ "epoch": 0.74,
2925
+ "grad_norm": 0.7526032154187763,
2926
+ "learning_rate": 3.325815367397557e-06,
2927
+ "loss": 0.7649,
2928
+ "step": 417
2929
+ },
2930
+ {
2931
+ "epoch": 0.74,
2932
+ "grad_norm": 1.3172737231291454,
2933
+ "learning_rate": 3.2830782760925285e-06,
2934
+ "loss": 0.7545,
2935
+ "step": 418
2936
+ },
2937
+ {
2938
+ "epoch": 0.74,
2939
+ "grad_norm": 1.1499109712233648,
2940
+ "learning_rate": 3.2405635585524566e-06,
2941
+ "loss": 0.7566,
2942
+ "step": 419
2943
+ },
2944
+ {
2945
+ "epoch": 0.75,
2946
+ "grad_norm": 0.9632828455463713,
2947
+ "learning_rate": 3.1982726222908046e-06,
2948
+ "loss": 0.748,
2949
+ "step": 420
2950
+ },
2951
+ {
2952
+ "epoch": 0.75,
2953
+ "grad_norm": 1.0604062010414916,
2954
+ "learning_rate": 3.1562068674124347e-06,
2955
+ "loss": 0.7856,
2956
+ "step": 421
2957
+ },
2958
+ {
2959
+ "epoch": 0.75,
2960
+ "grad_norm": 0.8284502574122435,
2961
+ "learning_rate": 3.114367686567228e-06,
2962
+ "loss": 0.6855,
2963
+ "step": 422
2964
+ },
2965
+ {
2966
+ "epoch": 0.75,
2967
+ "grad_norm": 1.355412483487692,
2968
+ "learning_rate": 3.0727564649040066e-06,
2969
+ "loss": 0.7446,
2970
+ "step": 423
2971
+ },
2972
+ {
2973
+ "epoch": 0.75,
2974
+ "grad_norm": 0.7929060735164787,
2975
+ "learning_rate": 3.0313745800246508e-06,
2976
+ "loss": 0.7914,
2977
+ "step": 424
2978
+ },
2979
+ {
2980
+ "epoch": 0.75,
2981
+ "grad_norm": 0.9112317992163422,
2982
+ "learning_rate": 2.9902234019385056e-06,
2983
+ "loss": 0.7512,
2984
+ "step": 425
2985
+ },
2986
+ {
2987
+ "epoch": 0.76,
2988
+ "grad_norm": 1.5432777353176643,
2989
+ "learning_rate": 2.949304293017029e-06,
2990
+ "loss": 0.7482,
2991
+ "step": 426
2992
+ },
2993
+ {
2994
+ "epoch": 0.76,
2995
+ "grad_norm": 1.010125898550166,
2996
+ "learning_rate": 2.908618607948669e-06,
2997
+ "loss": 0.7362,
2998
+ "step": 427
2999
+ },
3000
+ {
3001
+ "epoch": 0.76,
3002
+ "grad_norm": 0.9406215385352928,
3003
+ "learning_rate": 2.8681676936940397e-06,
3004
+ "loss": 0.7671,
3005
+ "step": 428
3006
+ },
3007
+ {
3008
+ "epoch": 0.76,
3009
+ "grad_norm": 0.9620579229038209,
3010
+ "learning_rate": 2.827952889441302e-06,
3011
+ "loss": 0.7827,
3012
+ "step": 429
3013
+ },
3014
+ {
3015
+ "epoch": 0.76,
3016
+ "grad_norm": 0.875563723116615,
3017
+ "learning_rate": 2.7879755265618558e-06,
3018
+ "loss": 0.6912,
3019
+ "step": 430
3020
+ },
3021
+ {
3022
+ "epoch": 0.77,
3023
+ "grad_norm": 0.8120003143081626,
3024
+ "learning_rate": 2.748236928566238e-06,
3025
+ "loss": 0.7559,
3026
+ "step": 431
3027
+ },
3028
+ {
3029
+ "epoch": 0.77,
3030
+ "grad_norm": 0.820381236475311,
3031
+ "learning_rate": 2.7087384110603156e-06,
3032
+ "loss": 0.755,
3033
+ "step": 432
3034
+ },
3035
+ {
3036
+ "epoch": 0.77,
3037
+ "grad_norm": 1.0748157041278616,
3038
+ "learning_rate": 2.669481281701739e-06,
3039
+ "loss": 0.781,
3040
+ "step": 433
3041
+ },
3042
+ {
3043
+ "epoch": 0.77,
3044
+ "grad_norm": 1.0867626411644806,
3045
+ "learning_rate": 2.6304668401566334e-06,
3046
+ "loss": 0.7433,
3047
+ "step": 434
3048
+ },
3049
+ {
3050
+ "epoch": 0.77,
3051
+ "grad_norm": 1.188744881776241,
3052
+ "learning_rate": 2.5916963780565897e-06,
3053
+ "loss": 0.7639,
3054
+ "step": 435
3055
+ },
3056
+ {
3057
+ "epoch": 0.77,
3058
+ "grad_norm": 1.0238209184489064,
3059
+ "learning_rate": 2.55317117895588e-06,
3060
+ "loss": 0.7549,
3061
+ "step": 436
3062
+ },
3063
+ {
3064
+ "epoch": 0.78,
3065
+ "grad_norm": 0.9935203010274218,
3066
+ "learning_rate": 2.514892518288988e-06,
3067
+ "loss": 0.7363,
3068
+ "step": 437
3069
+ },
3070
+ {
3071
+ "epoch": 0.78,
3072
+ "grad_norm": 0.8010410348003562,
3073
+ "learning_rate": 2.4768616633283747e-06,
3074
+ "loss": 0.7762,
3075
+ "step": 438
3076
+ },
3077
+ {
3078
+ "epoch": 0.78,
3079
+ "grad_norm": 0.8397648419805517,
3080
+ "learning_rate": 2.43907987314251e-06,
3081
+ "loss": 0.6987,
3082
+ "step": 439
3083
+ },
3084
+ {
3085
+ "epoch": 0.78,
3086
+ "grad_norm": 0.9413314360541944,
3087
+ "learning_rate": 2.401548398554213e-06,
3088
+ "loss": 0.7732,
3089
+ "step": 440
3090
+ },
3091
+ {
3092
+ "epoch": 0.78,
3093
+ "grad_norm": 0.9583425145861847,
3094
+ "learning_rate": 2.364268482099218e-06,
3095
+ "loss": 0.7114,
3096
+ "step": 441
3097
+ },
3098
+ {
3099
+ "epoch": 0.79,
3100
+ "grad_norm": 0.8277369009396708,
3101
+ "learning_rate": 2.327241357985063e-06,
3102
+ "loss": 0.8339,
3103
+ "step": 442
3104
+ },
3105
+ {
3106
+ "epoch": 0.79,
3107
+ "grad_norm": 1.2734782043124575,
3108
+ "learning_rate": 2.290468252050204e-06,
3109
+ "loss": 0.7192,
3110
+ "step": 443
3111
+ },
3112
+ {
3113
+ "epoch": 0.79,
3114
+ "grad_norm": 0.7443093962471002,
3115
+ "learning_rate": 2.2539503817234553e-06,
3116
+ "loss": 0.7181,
3117
+ "step": 444
3118
+ },
3119
+ {
3120
+ "epoch": 0.79,
3121
+ "grad_norm": 2.5435419934304613,
3122
+ "learning_rate": 2.2176889559836655e-06,
3123
+ "loss": 0.7381,
3124
+ "step": 445
3125
+ },
3126
+ {
3127
+ "epoch": 0.79,
3128
+ "grad_norm": 0.7478928464914032,
3129
+ "learning_rate": 2.1816851753197023e-06,
3130
+ "loss": 0.7657,
3131
+ "step": 446
3132
+ },
3133
+ {
3134
+ "epoch": 0.79,
3135
+ "grad_norm": 0.9130630498620563,
3136
+ "learning_rate": 2.145940231690713e-06,
3137
+ "loss": 0.8151,
3138
+ "step": 447
3139
+ },
3140
+ {
3141
+ "epoch": 0.8,
3142
+ "grad_norm": 1.208520757596276,
3143
+ "learning_rate": 2.1104553084866476e-06,
3144
+ "loss": 0.7135,
3145
+ "step": 448
3146
+ },
3147
+ {
3148
+ "epoch": 0.8,
3149
+ "grad_norm": 0.9346797974039266,
3150
+ "learning_rate": 2.075231580489098e-06,
3151
+ "loss": 0.7467,
3152
+ "step": 449
3153
+ },
3154
+ {
3155
+ "epoch": 0.8,
3156
+ "grad_norm": 0.9041571142725298,
3157
+ "learning_rate": 2.0402702138323895e-06,
3158
+ "loss": 0.7875,
3159
+ "step": 450
3160
+ },
3161
+ {
3162
+ "epoch": 0.8,
3163
+ "grad_norm": 1.136292512279568,
3164
+ "learning_rate": 2.0055723659649907e-06,
3165
+ "loss": 0.7891,
3166
+ "step": 451
3167
+ },
3168
+ {
3169
+ "epoch": 0.8,
3170
+ "grad_norm": 1.4622534646655785,
3171
+ "learning_rate": 1.971139185611176e-06,
3172
+ "loss": 0.7325,
3173
+ "step": 452
3174
+ },
3175
+ {
3176
+ "epoch": 0.8,
3177
+ "grad_norm": 0.9288453975224165,
3178
+ "learning_rate": 1.936971812733012e-06,
3179
+ "loss": 0.7239,
3180
+ "step": 453
3181
+ },
3182
+ {
3183
+ "epoch": 0.81,
3184
+ "grad_norm": 0.9248099202923302,
3185
+ "learning_rate": 1.9030713784926115e-06,
3186
+ "loss": 0.7539,
3187
+ "step": 454
3188
+ },
3189
+ {
3190
+ "epoch": 0.81,
3191
+ "grad_norm": 1.109980406035709,
3192
+ "learning_rate": 1.8694390052146737e-06,
3193
+ "loss": 0.7161,
3194
+ "step": 455
3195
+ },
3196
+ {
3197
+ "epoch": 0.81,
3198
+ "grad_norm": 1.1303363535074193,
3199
+ "learning_rate": 1.8360758063493511e-06,
3200
+ "loss": 0.7596,
3201
+ "step": 456
3202
+ },
3203
+ {
3204
+ "epoch": 0.81,
3205
+ "grad_norm": 0.9683620967798374,
3206
+ "learning_rate": 1.8029828864353583e-06,
3207
+ "loss": 0.7729,
3208
+ "step": 457
3209
+ },
3210
+ {
3211
+ "epoch": 0.81,
3212
+ "grad_norm": 0.9130376128054942,
3213
+ "learning_rate": 1.7701613410634367e-06,
3214
+ "loss": 0.8044,
3215
+ "step": 458
3216
+ },
3217
+ {
3218
+ "epoch": 0.82,
3219
+ "grad_norm": 1.0497968691825215,
3220
+ "learning_rate": 1.7376122568400533e-06,
3221
+ "loss": 0.7659,
3222
+ "step": 459
3223
+ },
3224
+ {
3225
+ "epoch": 0.82,
3226
+ "grad_norm": 0.9712735742009617,
3227
+ "learning_rate": 1.705336711351443e-06,
3228
+ "loss": 0.7362,
3229
+ "step": 460
3230
+ },
3231
+ {
3232
+ "epoch": 0.82,
3233
+ "grad_norm": 1.2095566979767287,
3234
+ "learning_rate": 1.6733357731279375e-06,
3235
+ "loss": 0.7853,
3236
+ "step": 461
3237
+ },
3238
+ {
3239
+ "epoch": 0.82,
3240
+ "grad_norm": 0.9487731058979595,
3241
+ "learning_rate": 1.641610501608575e-06,
3242
+ "loss": 0.7338,
3243
+ "step": 462
3244
+ },
3245
+ {
3246
+ "epoch": 0.82,
3247
+ "grad_norm": 0.7578020160286263,
3248
+ "learning_rate": 1.6101619471060415e-06,
3249
+ "loss": 0.6903,
3250
+ "step": 463
3251
+ },
3252
+ {
3253
+ "epoch": 0.82,
3254
+ "grad_norm": 0.7690765997202936,
3255
+ "learning_rate": 1.5789911507718824e-06,
3256
+ "loss": 0.7635,
3257
+ "step": 464
3258
+ },
3259
+ {
3260
+ "epoch": 0.83,
3261
+ "grad_norm": 1.002240773181561,
3262
+ "learning_rate": 1.5480991445620541e-06,
3263
+ "loss": 0.7275,
3264
+ "step": 465
3265
+ },
3266
+ {
3267
+ "epoch": 0.83,
3268
+ "grad_norm": 0.6958769525618868,
3269
+ "learning_rate": 1.5174869512027368e-06,
3270
+ "loss": 0.8401,
3271
+ "step": 466
3272
+ },
3273
+ {
3274
+ "epoch": 0.83,
3275
+ "grad_norm": 0.8904677751822176,
3276
+ "learning_rate": 1.4871555841564889e-06,
3277
+ "loss": 0.7106,
3278
+ "step": 467
3279
+ },
3280
+ {
3281
+ "epoch": 0.83,
3282
+ "grad_norm": 0.9090397305558453,
3283
+ "learning_rate": 1.457106047588701e-06,
3284
+ "loss": 0.7718,
3285
+ "step": 468
3286
+ },
3287
+ {
3288
+ "epoch": 0.83,
3289
+ "grad_norm": 0.8803863054747346,
3290
+ "learning_rate": 1.4273393363343324e-06,
3291
+ "loss": 0.7106,
3292
+ "step": 469
3293
+ },
3294
+ {
3295
+ "epoch": 0.83,
3296
+ "grad_norm": 0.8690462193016681,
3297
+ "learning_rate": 1.3978564358649926e-06,
3298
+ "loss": 0.7498,
3299
+ "step": 470
3300
+ },
3301
+ {
3302
+ "epoch": 0.84,
3303
+ "grad_norm": 0.8346189883438835,
3304
+ "learning_rate": 1.368658322256311e-06,
3305
+ "loss": 0.694,
3306
+ "step": 471
3307
+ },
3308
+ {
3309
+ "epoch": 0.84,
3310
+ "grad_norm": 0.8360259755034392,
3311
+ "learning_rate": 1.339745962155613e-06,
3312
+ "loss": 0.7266,
3313
+ "step": 472
3314
+ },
3315
+ {
3316
+ "epoch": 0.84,
3317
+ "grad_norm": 1.3601609064643252,
3318
+ "learning_rate": 1.311120312749935e-06,
3319
+ "loss": 0.7349,
3320
+ "step": 473
3321
+ },
3322
+ {
3323
+ "epoch": 0.84,
3324
+ "grad_norm": 1.4273303270709006,
3325
+ "learning_rate": 1.2827823217343182e-06,
3326
+ "loss": 0.7139,
3327
+ "step": 474
3328
+ },
3329
+ {
3330
+ "epoch": 0.84,
3331
+ "grad_norm": 0.851993104311948,
3332
+ "learning_rate": 1.2547329272804477e-06,
3333
+ "loss": 0.7842,
3334
+ "step": 475
3335
+ },
3336
+ {
3337
+ "epoch": 0.85,
3338
+ "grad_norm": 0.9109512771042799,
3339
+ "learning_rate": 1.2269730580055806e-06,
3340
+ "loss": 0.7818,
3341
+ "step": 476
3342
+ },
3343
+ {
3344
+ "epoch": 0.85,
3345
+ "grad_norm": 0.839921234928505,
3346
+ "learning_rate": 1.1995036329418153e-06,
3347
+ "loss": 0.7696,
3348
+ "step": 477
3349
+ },
3350
+ {
3351
+ "epoch": 0.85,
3352
+ "grad_norm": 0.814661256852612,
3353
+ "learning_rate": 1.172325561505653e-06,
3354
+ "loss": 0.7705,
3355
+ "step": 478
3356
+ },
3357
+ {
3358
+ "epoch": 0.85,
3359
+ "grad_norm": 0.6837807595128806,
3360
+ "learning_rate": 1.1454397434679022e-06,
3361
+ "loss": 0.7494,
3362
+ "step": 479
3363
+ },
3364
+ {
3365
+ "epoch": 0.85,
3366
+ "grad_norm": 0.9985810756968562,
3367
+ "learning_rate": 1.1188470689238794e-06,
3368
+ "loss": 0.7093,
3369
+ "step": 480
3370
+ },
3371
+ {
3372
+ "epoch": 0.85,
3373
+ "grad_norm": 0.9835361439566525,
3374
+ "learning_rate": 1.0925484182639467e-06,
3375
+ "loss": 0.7514,
3376
+ "step": 481
3377
+ },
3378
+ {
3379
+ "epoch": 0.86,
3380
+ "grad_norm": 1.4847672648252264,
3381
+ "learning_rate": 1.066544662144371e-06,
3382
+ "loss": 0.7197,
3383
+ "step": 482
3384
+ },
3385
+ {
3386
+ "epoch": 0.86,
3387
+ "grad_norm": 0.8865210358285674,
3388
+ "learning_rate": 1.040836661458482e-06,
3389
+ "loss": 0.7832,
3390
+ "step": 483
3391
+ },
3392
+ {
3393
+ "epoch": 0.86,
3394
+ "grad_norm": 0.7826635968526742,
3395
+ "learning_rate": 1.0154252673081943e-06,
3396
+ "loss": 0.7706,
3397
+ "step": 484
3398
+ },
3399
+ {
3400
+ "epoch": 0.86,
3401
+ "grad_norm": 1.1823763400819176,
3402
+ "learning_rate": 9.903113209758098e-07,
3403
+ "loss": 0.7805,
3404
+ "step": 485
3405
+ },
3406
+ {
3407
+ "epoch": 0.86,
3408
+ "grad_norm": 0.899288350168961,
3409
+ "learning_rate": 9.65495653896179e-07,
3410
+ "loss": 0.7434,
3411
+ "step": 486
3412
+ },
3413
+ {
3414
+ "epoch": 0.87,
3415
+ "grad_norm": 0.790636862611698,
3416
+ "learning_rate": 9.409790876291658e-07,
3417
+ "loss": 0.7653,
3418
+ "step": 487
3419
+ },
3420
+ {
3421
+ "epoch": 0.87,
3422
+ "grad_norm": 1.5778550765050696,
3423
+ "learning_rate": 9.167624338324599e-07,
3424
+ "loss": 0.6827,
3425
+ "step": 488
3426
+ },
3427
+ {
3428
+ "epoch": 0.87,
3429
+ "grad_norm": 0.762966136049774,
3430
+ "learning_rate": 8.928464942346949e-07,
3431
+ "loss": 0.7544,
3432
+ "step": 489
3433
+ },
3434
+ {
3435
+ "epoch": 0.87,
3436
+ "grad_norm": 0.7152745679330409,
3437
+ "learning_rate": 8.692320606089088e-07,
3438
+ "loss": 0.7117,
3439
+ "step": 490
3440
+ },
3441
+ {
3442
+ "epoch": 0.87,
3443
+ "grad_norm": 0.938749881629017,
3444
+ "learning_rate": 8.459199147463371e-07,
3445
+ "loss": 0.7272,
3446
+ "step": 491
3447
+ },
3448
+ {
3449
+ "epoch": 0.87,
3450
+ "grad_norm": 0.7887243971433457,
3451
+ "learning_rate": 8.229108284305176e-07,
3452
+ "loss": 0.7599,
3453
+ "step": 492
3454
+ },
3455
+ {
3456
+ "epoch": 0.88,
3457
+ "grad_norm": 1.1187390973902265,
3458
+ "learning_rate": 8.002055634117578e-07,
3459
+ "loss": 0.7813,
3460
+ "step": 493
3461
+ },
3462
+ {
3463
+ "epoch": 0.88,
3464
+ "grad_norm": 1.0611976127431488,
3465
+ "learning_rate": 7.778048713818975e-07,
3466
+ "loss": 0.7291,
3467
+ "step": 494
3468
+ },
3469
+ {
3470
+ "epoch": 0.88,
3471
+ "grad_norm": 0.775779064137104,
3472
+ "learning_rate": 7.557094939494325e-07,
3473
+ "loss": 0.7374,
3474
+ "step": 495
3475
+ },
3476
+ {
3477
+ "epoch": 0.88,
3478
+ "grad_norm": 1.1230838323655812,
3479
+ "learning_rate": 7.33920162614965e-07,
3480
+ "loss": 0.8131,
3481
+ "step": 496
3482
+ },
3483
+ {
3484
+ "epoch": 0.88,
3485
+ "grad_norm": 0.8286549343306245,
3486
+ "learning_rate": 7.124375987469767e-07,
3487
+ "loss": 0.6944,
3488
+ "step": 497
3489
+ },
3490
+ {
3491
+ "epoch": 0.88,
3492
+ "grad_norm": 0.8510070990308295,
3493
+ "learning_rate": 6.912625135579587e-07,
3494
+ "loss": 0.7423,
3495
+ "step": 498
3496
+ },
3497
+ {
3498
+ "epoch": 0.89,
3499
+ "grad_norm": 0.7443707131929154,
3500
+ "learning_rate": 6.703956080808515e-07,
3501
+ "loss": 0.726,
3502
+ "step": 499
3503
+ },
3504
+ {
3505
+ "epoch": 0.89,
3506
+ "grad_norm": 1.2002747293068283,
3507
+ "learning_rate": 6.498375731458529e-07,
3508
+ "loss": 0.7308,
3509
+ "step": 500
3510
+ },
3511
+ {
3512
+ "epoch": 0.89,
3513
+ "grad_norm": 1.8988796327176072,
3514
+ "learning_rate": 6.295890893575296e-07,
3515
+ "loss": 0.805,
3516
+ "step": 501
3517
+ },
3518
+ {
3519
+ "epoch": 0.89,
3520
+ "grad_norm": 0.8806297015318687,
3521
+ "learning_rate": 6.096508270723023e-07,
3522
+ "loss": 0.7082,
3523
+ "step": 502
3524
+ },
3525
+ {
3526
+ "epoch": 0.89,
3527
+ "grad_norm": 0.8651385101087814,
3528
+ "learning_rate": 5.900234463762367e-07,
3529
+ "loss": 0.7248,
3530
+ "step": 503
3531
+ },
3532
+ {
3533
+ "epoch": 0.9,
3534
+ "grad_norm": 0.7449934824918327,
3535
+ "learning_rate": 5.707075970631981e-07,
3536
+ "loss": 0.7295,
3537
+ "step": 504
3538
+ },
3539
+ {
3540
+ "epoch": 0.9,
3541
+ "grad_norm": 0.9977941207308976,
3542
+ "learning_rate": 5.517039186133433e-07,
3543
+ "loss": 0.8009,
3544
+ "step": 505
3545
+ },
3546
+ {
3547
+ "epoch": 0.9,
3548
+ "grad_norm": 0.930119838929777,
3549
+ "learning_rate": 5.330130401719413e-07,
3550
+ "loss": 0.7334,
3551
+ "step": 506
3552
+ },
3553
+ {
3554
+ "epoch": 0.9,
3555
+ "grad_norm": 0.8268138801139723,
3556
+ "learning_rate": 5.146355805285452e-07,
3557
+ "loss": 0.7481,
3558
+ "step": 507
3559
+ },
3560
+ {
3561
+ "epoch": 0.9,
3562
+ "grad_norm": 0.8381948856631107,
3563
+ "learning_rate": 4.965721480965136e-07,
3564
+ "loss": 0.7552,
3565
+ "step": 508
3566
+ },
3567
+ {
3568
+ "epoch": 0.9,
3569
+ "grad_norm": 0.717461765264355,
3570
+ "learning_rate": 4.788233408928588e-07,
3571
+ "loss": 0.7909,
3572
+ "step": 509
3573
+ },
3574
+ {
3575
+ "epoch": 0.91,
3576
+ "grad_norm": 1.1030961588444228,
3577
+ "learning_rate": 4.6138974651845914e-07,
3578
+ "loss": 0.7126,
3579
+ "step": 510
3580
+ },
3581
+ {
3582
+ "epoch": 0.91,
3583
+ "grad_norm": 1.5079778253927174,
3584
+ "learning_rate": 4.4427194213859216e-07,
3585
+ "loss": 0.7532,
3586
+ "step": 511
3587
+ },
3588
+ {
3589
+ "epoch": 0.91,
3590
+ "grad_norm": 0.9963116969948781,
3591
+ "learning_rate": 4.27470494463843e-07,
3592
+ "loss": 0.6903,
3593
+ "step": 512
3594
+ },
3595
+ {
3596
+ "epoch": 0.91,
3597
+ "grad_norm": 0.7736026624934934,
3598
+ "learning_rate": 4.109859597313237e-07,
3599
+ "loss": 0.772,
3600
+ "step": 513
3601
+ },
3602
+ {
3603
+ "epoch": 0.91,
3604
+ "grad_norm": 0.7562011399269606,
3605
+ "learning_rate": 3.9481888368627764e-07,
3606
+ "loss": 0.7279,
3607
+ "step": 514
3608
+ },
3609
+ {
3610
+ "epoch": 0.91,
3611
+ "grad_norm": 1.2119074253843334,
3612
+ "learning_rate": 3.7896980156399533e-07,
3613
+ "loss": 0.7628,
3614
+ "step": 515
3615
+ },
3616
+ {
3617
+ "epoch": 0.92,
3618
+ "grad_norm": 0.806901432869074,
3619
+ "learning_rate": 3.6343923807210523e-07,
3620
+ "loss": 0.7608,
3621
+ "step": 516
3622
+ },
3623
+ {
3624
+ "epoch": 0.92,
3625
+ "grad_norm": 0.7981792877376421,
3626
+ "learning_rate": 3.482277073731988e-07,
3627
+ "loss": 0.7552,
3628
+ "step": 517
3629
+ },
3630
+ {
3631
+ "epoch": 0.92,
3632
+ "grad_norm": 0.899137343142627,
3633
+ "learning_rate": 3.33335713067805e-07,
3634
+ "loss": 0.7758,
3635
+ "step": 518
3636
+ },
3637
+ {
3638
+ "epoch": 0.92,
3639
+ "grad_norm": 0.966293413969323,
3640
+ "learning_rate": 3.187637481777284e-07,
3641
+ "loss": 0.7083,
3642
+ "step": 519
3643
+ },
3644
+ {
3645
+ "epoch": 0.92,
3646
+ "grad_norm": 0.7500728280625207,
3647
+ "learning_rate": 3.045122951297119e-07,
3648
+ "loss": 0.7648,
3649
+ "step": 520
3650
+ },
3651
+ {
3652
+ "epoch": 0.93,
3653
+ "grad_norm": 0.8343628114364402,
3654
+ "learning_rate": 2.905818257394799e-07,
3655
+ "loss": 0.6902,
3656
+ "step": 521
3657
+ },
3658
+ {
3659
+ "epoch": 0.93,
3660
+ "grad_norm": 0.9641684433229529,
3661
+ "learning_rate": 2.7697280119610816e-07,
3662
+ "loss": 0.7569,
3663
+ "step": 522
3664
+ },
3665
+ {
3666
+ "epoch": 0.93,
3667
+ "grad_norm": 1.0501897485858462,
3668
+ "learning_rate": 2.636856720467573e-07,
3669
+ "loss": 0.7323,
3670
+ "step": 523
3671
+ },
3672
+ {
3673
+ "epoch": 0.93,
3674
+ "grad_norm": 0.8440715396044582,
3675
+ "learning_rate": 2.507208781817638e-07,
3676
+ "loss": 0.8247,
3677
+ "step": 524
3678
+ },
3679
+ {
3680
+ "epoch": 0.93,
3681
+ "grad_norm": 0.9266257349789722,
3682
+ "learning_rate": 2.3807884882006583e-07,
3683
+ "loss": 0.7063,
3684
+ "step": 525
3685
+ },
3686
+ {
3687
+ "epoch": 0.93,
3688
+ "grad_norm": 0.6988784112931856,
3689
+ "learning_rate": 2.257600024950013e-07,
3690
+ "loss": 0.7425,
3691
+ "step": 526
3692
+ },
3693
+ {
3694
+ "epoch": 0.94,
3695
+ "grad_norm": 0.8446132979847808,
3696
+ "learning_rate": 2.1376474704044693e-07,
3697
+ "loss": 0.7789,
3698
+ "step": 527
3699
+ },
3700
+ {
3701
+ "epoch": 0.94,
3702
+ "grad_norm": 0.8591922340666319,
3703
+ "learning_rate": 2.0209347957732328e-07,
3704
+ "loss": 0.7288,
3705
+ "step": 528
3706
+ },
3707
+ {
3708
+ "epoch": 0.94,
3709
+ "grad_norm": 1.0926686710744615,
3710
+ "learning_rate": 1.9074658650043764e-07,
3711
+ "loss": 0.7114,
3712
+ "step": 529
3713
+ },
3714
+ {
3715
+ "epoch": 0.94,
3716
+ "grad_norm": 0.7624493253931196,
3717
+ "learning_rate": 1.7972444346569752e-07,
3718
+ "loss": 0.7459,
3719
+ "step": 530
3720
+ },
3721
+ {
3722
+ "epoch": 0.94,
3723
+ "grad_norm": 0.7923149172686518,
3724
+ "learning_rate": 1.6902741537767607e-07,
3725
+ "loss": 0.7612,
3726
+ "step": 531
3727
+ },
3728
+ {
3729
+ "epoch": 0.94,
3730
+ "grad_norm": 0.9137607028579776,
3731
+ "learning_rate": 1.5865585637752644e-07,
3732
+ "loss": 0.7652,
3733
+ "step": 532
3734
+ },
3735
+ {
3736
+ "epoch": 0.95,
3737
+ "grad_norm": 1.709281268111564,
3738
+ "learning_rate": 1.4861010983126202e-07,
3739
+ "loss": 0.7674,
3740
+ "step": 533
3741
+ },
3742
+ {
3743
+ "epoch": 0.95,
3744
+ "grad_norm": 0.82294274146925,
3745
+ "learning_rate": 1.3889050831838336e-07,
3746
+ "loss": 0.7802,
3747
+ "step": 534
3748
+ },
3749
+ {
3750
+ "epoch": 0.95,
3751
+ "grad_norm": 0.9209804385310738,
3752
+ "learning_rate": 1.2949737362087156e-07,
3753
+ "loss": 0.7084,
3754
+ "step": 535
3755
+ },
3756
+ {
3757
+ "epoch": 0.95,
3758
+ "grad_norm": 0.7554554097180233,
3759
+ "learning_rate": 1.2043101671253553e-07,
3760
+ "loss": 0.7576,
3761
+ "step": 536
3762
+ },
3763
+ {
3764
+ "epoch": 0.95,
3765
+ "grad_norm": 2.5327776012868326,
3766
+ "learning_rate": 1.1169173774871478e-07,
3767
+ "loss": 0.6961,
3768
+ "step": 537
3769
+ },
3770
+ {
3771
+ "epoch": 0.96,
3772
+ "grad_norm": 1.29647899469185,
3773
+ "learning_rate": 1.0327982605634279e-07,
3774
+ "loss": 0.7273,
3775
+ "step": 538
3776
+ },
3777
+ {
3778
+ "epoch": 0.96,
3779
+ "grad_norm": 0.8544062605377822,
3780
+ "learning_rate": 9.519556012436815e-08,
3781
+ "loss": 0.7458,
3782
+ "step": 539
3783
+ },
3784
+ {
3785
+ "epoch": 0.96,
3786
+ "grad_norm": 1.025833225658084,
3787
+ "learning_rate": 8.743920759453739e-08,
3788
+ "loss": 0.7298,
3789
+ "step": 540
3790
+ },
3791
+ {
3792
+ "epoch": 0.96,
3793
+ "grad_norm": 1.0753264133055775,
3794
+ "learning_rate": 8.00110252525299e-08,
3795
+ "loss": 0.7683,
3796
+ "step": 541
3797
+ },
3798
+ {
3799
+ "epoch": 0.96,
3800
+ "grad_norm": 1.1943324017414,
3801
+ "learning_rate": 7.291125901946027e-08,
3802
+ "loss": 0.7811,
3803
+ "step": 542
3804
+ },
3805
+ {
3806
+ "epoch": 0.96,
3807
+ "grad_norm": 0.7694222713894205,
3808
+ "learning_rate": 6.61401439437348e-08,
3809
+ "loss": 0.7681,
3810
+ "step": 543
3811
+ },
3812
+ {
3813
+ "epoch": 0.97,
3814
+ "grad_norm": 1.2370289673252275,
3815
+ "learning_rate": 5.969790419326993e-08,
3816
+ "loss": 0.674,
3817
+ "step": 544
3818
+ },
3819
+ {
3820
+ "epoch": 0.97,
3821
+ "grad_norm": 0.8002799193353513,
3822
+ "learning_rate": 5.3584753048073756e-08,
3823
+ "loss": 0.8067,
3824
+ "step": 545
3825
+ },
3826
+ {
3827
+ "epoch": 0.97,
3828
+ "grad_norm": 1.5301982389376738,
3829
+ "learning_rate": 4.7800892893178354e-08,
3830
+ "loss": 0.7349,
3831
+ "step": 546
3832
+ },
3833
+ {
3834
+ "epoch": 0.97,
3835
+ "grad_norm": 1.5057671436094202,
3836
+ "learning_rate": 4.234651521194844e-08,
3837
+ "loss": 0.7347,
3838
+ "step": 547
3839
+ },
3840
+ {
3841
+ "epoch": 0.97,
3842
+ "grad_norm": 0.8253550569542444,
3843
+ "learning_rate": 3.7221800579735346e-08,
3844
+ "loss": 0.7457,
3845
+ "step": 548
3846
+ },
3847
+ {
3848
+ "epoch": 0.98,
3849
+ "grad_norm": 0.9341885237844507,
3850
+ "learning_rate": 3.242691865790071e-08,
3851
+ "loss": 0.7243,
3852
+ "step": 549
3853
+ },
3854
+ {
3855
+ "epoch": 0.98,
3856
+ "grad_norm": 0.9554329055220271,
3857
+ "learning_rate": 2.796202818819871e-08,
3858
+ "loss": 0.8415,
3859
+ "step": 550
3860
+ },
3861
+ {
3862
+ "epoch": 0.98,
3863
+ "grad_norm": 0.966722990989304,
3864
+ "learning_rate": 2.3827276987524738e-08,
3865
+ "loss": 0.7286,
3866
+ "step": 551
3867
+ },
3868
+ {
3869
+ "epoch": 0.98,
3870
+ "grad_norm": 0.7901189093094835,
3871
+ "learning_rate": 2.002280194301487e-08,
3872
+ "loss": 0.722,
3873
+ "step": 552
3874
+ },
3875
+ {
3876
+ "epoch": 0.98,
3877
+ "grad_norm": 0.9000774799749912,
3878
+ "learning_rate": 1.654872900752169e-08,
3879
+ "loss": 0.7212,
3880
+ "step": 553
3881
+ },
3882
+ {
3883
+ "epoch": 0.98,
3884
+ "grad_norm": 1.0953002583055267,
3885
+ "learning_rate": 1.340517319543877e-08,
3886
+ "loss": 0.7818,
3887
+ "step": 554
3888
+ },
3889
+ {
3890
+ "epoch": 0.99,
3891
+ "grad_norm": 0.8753114117581223,
3892
+ "learning_rate": 1.0592238578892577e-08,
3893
+ "loss": 0.7321,
3894
+ "step": 555
3895
+ },
3896
+ {
3897
+ "epoch": 0.99,
3898
+ "grad_norm": 1.6427409735808294,
3899
+ "learning_rate": 8.110018284304132e-09,
3900
+ "loss": 0.7249,
3901
+ "step": 556
3902
+ },
3903
+ {
3904
+ "epoch": 0.99,
3905
+ "grad_norm": 0.7993301297504886,
3906
+ "learning_rate": 5.958594489295921e-09,
3907
+ "loss": 0.7669,
3908
+ "step": 557
3909
+ },
3910
+ {
3911
+ "epoch": 0.99,
3912
+ "grad_norm": 1.0213659754539555,
3913
+ "learning_rate": 4.138038419978507e-09,
3914
+ "loss": 0.7661,
3915
+ "step": 558
3916
+ },
3917
+ {
3918
+ "epoch": 0.99,
3919
+ "grad_norm": 0.8677144101553231,
3920
+ "learning_rate": 2.648410348592423e-09,
3921
+ "loss": 0.7804,
3922
+ "step": 559
3923
+ },
3924
+ {
3925
+ "epoch": 0.99,
3926
+ "grad_norm": 0.8598685631934427,
3927
+ "learning_rate": 1.4897595915053242e-09,
3928
+ "loss": 0.7757,
3929
+ "step": 560
3930
+ },
3931
+ {
3932
+ "epoch": 1.0,
3933
+ "grad_norm": 0.749563526002078,
3934
+ "learning_rate": 6.621245075910665e-10,
3935
+ "loss": 0.7367,
3936
+ "step": 561
3937
+ },
3938
+ {
3939
+ "epoch": 1.0,
3940
+ "grad_norm": 1.0165817159651056,
3941
+ "learning_rate": 1.6553249694850616e-10,
3942
+ "loss": 0.7488,
3943
+ "step": 562
3944
+ },
3945
+ {
3946
+ "epoch": 1.0,
3947
+ "grad_norm": 1.012753603929472,
3948
+ "learning_rate": 0.0,
3949
+ "loss": 0.7666,
3950
+ "step": 563
3951
+ },
3952
+ {
3953
+ "epoch": 1.0,
3954
+ "step": 563,
3955
+ "total_flos": 0.0,
3956
+ "train_loss": 0.7891389744531622,
3957
+ "train_runtime": 46961.4176,
3958
+ "train_samples_per_second": 23.135,
3959
+ "train_steps_per_second": 0.012
3960
+ }
3961
+ ],
3962
+ "logging_steps": 1.0,
3963
+ "max_steps": 563,
3964
+ "num_input_tokens_seen": 0,
3965
+ "num_train_epochs": 1,
3966
+ "save_steps": 100,
3967
+ "stateful_callbacks": {
3968
+ "TrainerControl": {
3969
+ "args": {
3970
+ "should_epoch_stop": false,
3971
+ "should_evaluate": false,
3972
+ "should_log": false,
3973
+ "should_save": false,
3974
+ "should_training_stop": false
3975
+ },
3976
+ "attributes": {}
3977
+ }
3978
+ },
3979
+ "total_flos": 0.0,
3980
+ "train_batch_size": 4,
3981
+ "trial_name": null,
3982
+ "trial_params": null
3983
+ }
utils.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 NVIDIA CORPORATION & AFFILIATES
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ # SPDX-License-Identifier: Apache-2.0
16
+ # This file is modified from https://github.com/haotian-liu/LLaVA/
17
+ import os
18
+ import os.path as osp
19
+
20
+ from huggingface_hub import repo_exists, snapshot_download
21
+ from huggingface_hub.utils import HFValidationError, validate_repo_id
22
+ from transformers import AutoConfig, AutoTokenizer, PretrainedConfig
23
+
24
+ from .configuration_vila import VILAConfig
25
+ from .constants import MEDIA_TOKENS
26
+ from .tokenizer_utils import infer_stop_tokens
27
+
28
+
29
+ def load_tokenizer_then_handle_media_tokens_and_chat_template(
30
+ model_name_or_path, config: VILAConfig, model_max_length=None
31
+ ):
32
+ # TODO(ligeng): a lot of copy-paste code, refactor to make a single function
33
+ tokenizer = AutoTokenizer.from_pretrained(
34
+ osp.join(model_name_or_path, "llm"), padding_side="right", use_fast=True, legacy=False
35
+ )
36
+ if model_max_length is not None:
37
+ tokenizer.model_max_length = model_max_length
38
+
39
+ # Load chat template if specified.
40
+ if getattr(config, "chat_template", None) is not None:
41
+ print(f"Using chat template: {config.chat_template}")
42
+ fpath = os.path.join(os.path.dirname(__file__), "chat_templates", f"{config.chat_template}.jinja")
43
+ if not os.path.exists(fpath):
44
+ fpath = os.path.join(model_name_or_path, f"{config.chat_template}.jinja")
45
+ with open(fpath) as fd:
46
+ chat_template = fd.read()
47
+ tokenizer.chat_template = chat_template.replace(" ", "").replace("\n", "")
48
+
49
+ # Set stop tokens for the tokenizer
50
+ tokenizer.stop_tokens = infer_stop_tokens(tokenizer)
51
+ tokenizer.stop_token_ids = tokenizer.convert_tokens_to_ids(tokenizer.stop_tokens)
52
+
53
+ # Add media tokens to the tokenizer
54
+ tokenizer.media_tokens = MEDIA_TOKENS
55
+ tokenizer.media_token_ids = {}
56
+ for name, token in MEDIA_TOKENS.items():
57
+ tokenizer.add_tokens([token], special_tokens=True)
58
+ tokenizer.media_token_ids[name] = tokenizer.convert_tokens_to_ids(token)
59
+
60
+ return tokenizer
61
+
62
+
63
+ def get_model_config(config):
64
+ default_keys = ["llm_cfg", "vision_tower_cfg", "mm_projector_cfg"]
65
+
66
+ if hasattr(config, "_name_or_path") and len(config._name_or_path) >= 2:
67
+ root_path = config._name_or_path
68
+ else:
69
+ root_path = config.resume_path
70
+
71
+ # download from huggingface
72
+ if root_path is not None and not osp.exists(root_path):
73
+ try:
74
+ valid_hf_repo = repo_exists(root_path)
75
+ except HFValidationError as e:
76
+ valid_hf_repo = False
77
+ if valid_hf_repo:
78
+ root_path = snapshot_download(root_path)
79
+
80
+ return_list = []
81
+ for key in default_keys:
82
+ cfg = getattr(config, key, None)
83
+ if isinstance(cfg, dict):
84
+ try:
85
+ return_list.append(os.path.join(root_path, key[:-4]))
86
+ except:
87
+ raise ValueError(f"Cannot find resume path in config for {key}!")
88
+ elif isinstance(cfg, PretrainedConfig):
89
+ return_list.append(os.path.join(root_path, key[:-4]))
90
+ elif isinstance(cfg, str):
91
+ return_list.append(cfg)
92
+
93
+ return return_list
94
+
95
+
96
+ def get_model_config_fp8(config):
97
+ default_keys = ["llm_cfg", "vision_tower_cfg", "mm_projector_cfg"]
98
+
99
+ if hasattr(config, "_name_or_path") and len(config._name_or_path) >= 2:
100
+ root_path = config._name_or_path
101
+ else:
102
+ root_path = config.resume_path
103
+
104
+ # download from huggingface
105
+ if root_path is not None and not osp.exists(root_path):
106
+ try:
107
+ valid_hf_repo = repo_exists(root_path)
108
+ except HFValidationError as e:
109
+ valid_hf_repo = False
110
+ if valid_hf_repo:
111
+ root_path = snapshot_download(root_path)
112
+
113
+ return_list = []
114
+ for key in default_keys:
115
+ cfg = getattr(config, key, None)
116
+ if isinstance(cfg, dict):
117
+ try:
118
+ return_list.append(os.path.join(root_path, key[:-4]))
119
+ except:
120
+ raise ValueError(f"Cannot find resume path in config for {key}!")
121
+ elif isinstance(cfg, PretrainedConfig):
122
+ return_list.append(os.path.join(root_path, key[:-4]))
123
+ elif isinstance(cfg, str):
124
+ return_list.append(cfg)
125
+
126
+ # fp8_llm
127
+ key = "fp8_llm_cfg"
128
+ directory_path = os.path.join(root_path, key[:-4])
129
+ assert os.path.isdir(directory_path) and os.listdir(
130
+ directory_path
131
+ ), "You need to first convert the model weights to FP8 explicitly."
132
+ return_list.append(directory_path)
133
+
134
+ return return_list
135
+
136
+
137
+ def get_model_config_fp8(config):
138
+ default_keys = ["llm_cfg", "vision_tower_cfg", "mm_projector_cfg"]
139
+
140
+ if hasattr(config, "_name_or_path") and len(config._name_or_path) >= 2:
141
+ root_path = config._name_or_path
142
+ else:
143
+ root_path = config.resume_path
144
+
145
+ # download from huggingface
146
+ if root_path is not None and not osp.exists(root_path):
147
+ try:
148
+ valid_hf_repo = repo_exists(root_path)
149
+ except HFValidationError as e:
150
+ valid_hf_repo = False
151
+ if valid_hf_repo:
152
+ root_path = snapshot_download(root_path)
153
+
154
+ return_list = []
155
+ for key in default_keys:
156
+ cfg = getattr(config, key, None)
157
+ if isinstance(cfg, dict):
158
+ try:
159
+ return_list.append(os.path.join(root_path, key[:-4]))
160
+ except:
161
+ raise ValueError(f"Cannot find resume path in config for {key}!")
162
+ elif isinstance(cfg, PretrainedConfig):
163
+ return_list.append(os.path.join(root_path, key[:-4]))
164
+ elif isinstance(cfg, str):
165
+ return_list.append(cfg)
166
+
167
+ # fp8_llm
168
+ key = "fp8_llm_cfg"
169
+ directory_path = os.path.join(root_path, key[:-4])
170
+ assert os.path.isdir(directory_path) and os.listdir(
171
+ directory_path
172
+ ), "You need to first convert the model weights to FP8 explicitly."
173
+ return_list.append(directory_path)
174
+
175
+ return return_list
176
+
177
+
178
+ def is_mm_model(model_path):
179
+ """
180
+ Check if the model at the given path is a visual language model.
181
+
182
+ Args:
183
+ model_path (str): The path to the model.
184
+
185
+ Returns:
186
+ bool: True if the model is an MM model, False otherwise.
187
+ """
188
+ config = AutoConfig.from_pretrained(model_path)
189
+ architectures = config.architectures
190
+ for architecture in architectures:
191
+ if "llava" in architecture.lower():
192
+ return True
193
+ return False
194
+
195
+
196
+ def auto_upgrade(config):
197
+ cfg = AutoConfig.from_pretrained(config)
198
+ if "llava" in config and "llava" not in cfg.model_type:
199
+ assert cfg.model_type == "llama"
200
+ print("You are using newer LLaVA code base, while the checkpoint of v0 is from older code base.")
201
+ print("You must upgrade the checkpoint to the new code base (this can be done automatically).")
202
+ confirm = input("Please confirm that you want to upgrade the checkpoint. [Y/N]")
203
+ if confirm.lower() in ["y", "yes"]:
204
+ print("Upgrading checkpoint...")
205
+ assert len(cfg.architectures) == 1
206
+ setattr(cfg.__class__, "model_type", "llava")
207
+ cfg.architectures[0] = "LlavaLlamaForCausalLM"
208
+ cfg.save_pretrained(config)
209
+ print("Checkpoint upgraded.")
210
+ else:
211
+ print("Checkpoint upgrade aborted.")
212
+ exit(1)