Upload 14 files
Browse files- added_tokens.json +209 -0
- chat_template.json +3 -0
- config.json +78 -0
- configuration_maira2.py +32 -0
- generation_config.json +7 -0
- model.safetensors +3 -0
- modeling_maira2.py +359 -0
- preprocessor_config.json +31 -0
- processing_maira2.py +729 -0
- processor_config.json +14 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +1701 -0
added_tokens.json
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</box>": 32203,
|
| 3 |
+
"</obj>": 32001,
|
| 4 |
+
"<box>": 32202,
|
| 5 |
+
"<image>": 32204,
|
| 6 |
+
"<lat_image>": 32206,
|
| 7 |
+
"<obj>": 32000,
|
| 8 |
+
"<prev_im>": 32205,
|
| 9 |
+
"<x0>": 32002,
|
| 10 |
+
"<x10>": 32012,
|
| 11 |
+
"<x11>": 32013,
|
| 12 |
+
"<x12>": 32014,
|
| 13 |
+
"<x13>": 32015,
|
| 14 |
+
"<x14>": 32016,
|
| 15 |
+
"<x15>": 32017,
|
| 16 |
+
"<x16>": 32018,
|
| 17 |
+
"<x17>": 32019,
|
| 18 |
+
"<x18>": 32020,
|
| 19 |
+
"<x19>": 32021,
|
| 20 |
+
"<x1>": 32003,
|
| 21 |
+
"<x20>": 32022,
|
| 22 |
+
"<x21>": 32023,
|
| 23 |
+
"<x22>": 32024,
|
| 24 |
+
"<x23>": 32025,
|
| 25 |
+
"<x24>": 32026,
|
| 26 |
+
"<x25>": 32027,
|
| 27 |
+
"<x26>": 32028,
|
| 28 |
+
"<x27>": 32029,
|
| 29 |
+
"<x28>": 32030,
|
| 30 |
+
"<x29>": 32031,
|
| 31 |
+
"<x2>": 32004,
|
| 32 |
+
"<x30>": 32032,
|
| 33 |
+
"<x31>": 32033,
|
| 34 |
+
"<x32>": 32034,
|
| 35 |
+
"<x33>": 32035,
|
| 36 |
+
"<x34>": 32036,
|
| 37 |
+
"<x35>": 32037,
|
| 38 |
+
"<x36>": 32038,
|
| 39 |
+
"<x37>": 32039,
|
| 40 |
+
"<x38>": 32040,
|
| 41 |
+
"<x39>": 32041,
|
| 42 |
+
"<x3>": 32005,
|
| 43 |
+
"<x40>": 32042,
|
| 44 |
+
"<x41>": 32043,
|
| 45 |
+
"<x42>": 32044,
|
| 46 |
+
"<x43>": 32045,
|
| 47 |
+
"<x44>": 32046,
|
| 48 |
+
"<x45>": 32047,
|
| 49 |
+
"<x46>": 32048,
|
| 50 |
+
"<x47>": 32049,
|
| 51 |
+
"<x48>": 32050,
|
| 52 |
+
"<x49>": 32051,
|
| 53 |
+
"<x4>": 32006,
|
| 54 |
+
"<x50>": 32052,
|
| 55 |
+
"<x51>": 32053,
|
| 56 |
+
"<x52>": 32054,
|
| 57 |
+
"<x53>": 32055,
|
| 58 |
+
"<x54>": 32056,
|
| 59 |
+
"<x55>": 32057,
|
| 60 |
+
"<x56>": 32058,
|
| 61 |
+
"<x57>": 32059,
|
| 62 |
+
"<x58>": 32060,
|
| 63 |
+
"<x59>": 32061,
|
| 64 |
+
"<x5>": 32007,
|
| 65 |
+
"<x60>": 32062,
|
| 66 |
+
"<x61>": 32063,
|
| 67 |
+
"<x62>": 32064,
|
| 68 |
+
"<x63>": 32065,
|
| 69 |
+
"<x64>": 32066,
|
| 70 |
+
"<x65>": 32067,
|
| 71 |
+
"<x66>": 32068,
|
| 72 |
+
"<x67>": 32069,
|
| 73 |
+
"<x68>": 32070,
|
| 74 |
+
"<x69>": 32071,
|
| 75 |
+
"<x6>": 32008,
|
| 76 |
+
"<x70>": 32072,
|
| 77 |
+
"<x71>": 32073,
|
| 78 |
+
"<x72>": 32074,
|
| 79 |
+
"<x73>": 32075,
|
| 80 |
+
"<x74>": 32076,
|
| 81 |
+
"<x75>": 32077,
|
| 82 |
+
"<x76>": 32078,
|
| 83 |
+
"<x77>": 32079,
|
| 84 |
+
"<x78>": 32080,
|
| 85 |
+
"<x79>": 32081,
|
| 86 |
+
"<x7>": 32009,
|
| 87 |
+
"<x80>": 32082,
|
| 88 |
+
"<x81>": 32083,
|
| 89 |
+
"<x82>": 32084,
|
| 90 |
+
"<x83>": 32085,
|
| 91 |
+
"<x84>": 32086,
|
| 92 |
+
"<x85>": 32087,
|
| 93 |
+
"<x86>": 32088,
|
| 94 |
+
"<x87>": 32089,
|
| 95 |
+
"<x88>": 32090,
|
| 96 |
+
"<x89>": 32091,
|
| 97 |
+
"<x8>": 32010,
|
| 98 |
+
"<x90>": 32092,
|
| 99 |
+
"<x91>": 32093,
|
| 100 |
+
"<x92>": 32094,
|
| 101 |
+
"<x93>": 32095,
|
| 102 |
+
"<x94>": 32096,
|
| 103 |
+
"<x95>": 32097,
|
| 104 |
+
"<x96>": 32098,
|
| 105 |
+
"<x97>": 32099,
|
| 106 |
+
"<x98>": 32100,
|
| 107 |
+
"<x99>": 32101,
|
| 108 |
+
"<x9>": 32011,
|
| 109 |
+
"<y0>": 32102,
|
| 110 |
+
"<y10>": 32112,
|
| 111 |
+
"<y11>": 32113,
|
| 112 |
+
"<y12>": 32114,
|
| 113 |
+
"<y13>": 32115,
|
| 114 |
+
"<y14>": 32116,
|
| 115 |
+
"<y15>": 32117,
|
| 116 |
+
"<y16>": 32118,
|
| 117 |
+
"<y17>": 32119,
|
| 118 |
+
"<y18>": 32120,
|
| 119 |
+
"<y19>": 32121,
|
| 120 |
+
"<y1>": 32103,
|
| 121 |
+
"<y20>": 32122,
|
| 122 |
+
"<y21>": 32123,
|
| 123 |
+
"<y22>": 32124,
|
| 124 |
+
"<y23>": 32125,
|
| 125 |
+
"<y24>": 32126,
|
| 126 |
+
"<y25>": 32127,
|
| 127 |
+
"<y26>": 32128,
|
| 128 |
+
"<y27>": 32129,
|
| 129 |
+
"<y28>": 32130,
|
| 130 |
+
"<y29>": 32131,
|
| 131 |
+
"<y2>": 32104,
|
| 132 |
+
"<y30>": 32132,
|
| 133 |
+
"<y31>": 32133,
|
| 134 |
+
"<y32>": 32134,
|
| 135 |
+
"<y33>": 32135,
|
| 136 |
+
"<y34>": 32136,
|
| 137 |
+
"<y35>": 32137,
|
| 138 |
+
"<y36>": 32138,
|
| 139 |
+
"<y37>": 32139,
|
| 140 |
+
"<y38>": 32140,
|
| 141 |
+
"<y39>": 32141,
|
| 142 |
+
"<y3>": 32105,
|
| 143 |
+
"<y40>": 32142,
|
| 144 |
+
"<y41>": 32143,
|
| 145 |
+
"<y42>": 32144,
|
| 146 |
+
"<y43>": 32145,
|
| 147 |
+
"<y44>": 32146,
|
| 148 |
+
"<y45>": 32147,
|
| 149 |
+
"<y46>": 32148,
|
| 150 |
+
"<y47>": 32149,
|
| 151 |
+
"<y48>": 32150,
|
| 152 |
+
"<y49>": 32151,
|
| 153 |
+
"<y4>": 32106,
|
| 154 |
+
"<y50>": 32152,
|
| 155 |
+
"<y51>": 32153,
|
| 156 |
+
"<y52>": 32154,
|
| 157 |
+
"<y53>": 32155,
|
| 158 |
+
"<y54>": 32156,
|
| 159 |
+
"<y55>": 32157,
|
| 160 |
+
"<y56>": 32158,
|
| 161 |
+
"<y57>": 32159,
|
| 162 |
+
"<y58>": 32160,
|
| 163 |
+
"<y59>": 32161,
|
| 164 |
+
"<y5>": 32107,
|
| 165 |
+
"<y60>": 32162,
|
| 166 |
+
"<y61>": 32163,
|
| 167 |
+
"<y62>": 32164,
|
| 168 |
+
"<y63>": 32165,
|
| 169 |
+
"<y64>": 32166,
|
| 170 |
+
"<y65>": 32167,
|
| 171 |
+
"<y66>": 32168,
|
| 172 |
+
"<y67>": 32169,
|
| 173 |
+
"<y68>": 32170,
|
| 174 |
+
"<y69>": 32171,
|
| 175 |
+
"<y6>": 32108,
|
| 176 |
+
"<y70>": 32172,
|
| 177 |
+
"<y71>": 32173,
|
| 178 |
+
"<y72>": 32174,
|
| 179 |
+
"<y73>": 32175,
|
| 180 |
+
"<y74>": 32176,
|
| 181 |
+
"<y75>": 32177,
|
| 182 |
+
"<y76>": 32178,
|
| 183 |
+
"<y77>": 32179,
|
| 184 |
+
"<y78>": 32180,
|
| 185 |
+
"<y79>": 32181,
|
| 186 |
+
"<y7>": 32109,
|
| 187 |
+
"<y80>": 32182,
|
| 188 |
+
"<y81>": 32183,
|
| 189 |
+
"<y82>": 32184,
|
| 190 |
+
"<y83>": 32185,
|
| 191 |
+
"<y84>": 32186,
|
| 192 |
+
"<y85>": 32187,
|
| 193 |
+
"<y86>": 32188,
|
| 194 |
+
"<y87>": 32189,
|
| 195 |
+
"<y88>": 32190,
|
| 196 |
+
"<y89>": 32191,
|
| 197 |
+
"<y8>": 32110,
|
| 198 |
+
"<y90>": 32192,
|
| 199 |
+
"<y91>": 32193,
|
| 200 |
+
"<y92>": 32194,
|
| 201 |
+
"<y93>": 32195,
|
| 202 |
+
"<y94>": 32196,
|
| 203 |
+
"<y95>": 32197,
|
| 204 |
+
"<y96>": 32198,
|
| 205 |
+
"<y97>": 32199,
|
| 206 |
+
"<y98>": 32200,
|
| 207 |
+
"<y99>": 32201,
|
| 208 |
+
"<y9>": 32111
|
| 209 |
+
}
|
chat_template.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}You are an expert radiology assistant tasked with interpreting a chest X-ray study. {% for message in messages %}{% if message[\"role\"] == \"user\" %}USER: {% else %}ASSISTANT: {% endif %}{% for item in message[\"content\"] %}{% if item[\"type\"] == \"text\" %}{{ item[\"text\"] }}{% elif item[\"type\"] == \"image\" %}<image>{% endif %}{% endfor %}{% if message[\"role\"] == \"user\" %} {% else %}{{eos_token}}{% endif %}{% endfor %}{% if add_generation_prompt %}ASSISTANT: {% endif %}"
|
| 3 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "/home/ea/work/my_optimum_intel/optimum-intel/maira2",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"Maira2ForConditionalGeneration"
|
| 5 |
+
],
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoConfig": "configuration_maira2.Maira2Config",
|
| 8 |
+
"AutoModelForCausalLM": "modeling_maira2.Maira2ForConditionalGeneration",
|
| 9 |
+
"AutoModelForVision2Seq": "modeling_maira2.Maira2ForConditionalGeneration"
|
| 10 |
+
},
|
| 11 |
+
"hidden_size": 16,
|
| 12 |
+
"ignore_index": -100,
|
| 13 |
+
"image_seq_length": 4,
|
| 14 |
+
"image_token_index": 32204,
|
| 15 |
+
"model_type": "maira2",
|
| 16 |
+
"multimodal_projector_bias": true,
|
| 17 |
+
"pad_token_id": 0,
|
| 18 |
+
"projector_hidden_act": "gelu",
|
| 19 |
+
"projector_n_layers": 4,
|
| 20 |
+
"text_config": {
|
| 21 |
+
"_name_or_path": "HuggingFaceM4/tiny-random-LlamaForCausalLM",
|
| 22 |
+
"architectures": [
|
| 23 |
+
"LlamaForCausalLM"
|
| 24 |
+
],
|
| 25 |
+
"bos_token_id": 0,
|
| 26 |
+
"eos_token_id": 1,
|
| 27 |
+
"head_dim": 4,
|
| 28 |
+
"hidden_size": 16,
|
| 29 |
+
"intermediate_size": 64,
|
| 30 |
+
"model_type": "llama",
|
| 31 |
+
"num_attention_heads": 4,
|
| 32 |
+
"num_hidden_layers": 2,
|
| 33 |
+
"num_key_value_heads": 4,
|
| 34 |
+
"pad_token_id": 2,
|
| 35 |
+
"torch_dtype": "bfloat16",
|
| 36 |
+
"vocab_size": 32207
|
| 37 |
+
},
|
| 38 |
+
"torch_dtype": "float32",
|
| 39 |
+
"transformers_version": "4.48.3",
|
| 40 |
+
"vision_config": {
|
| 41 |
+
"apply_layernorm": true,
|
| 42 |
+
"architectures": [
|
| 43 |
+
"Dinov2Model"
|
| 44 |
+
],
|
| 45 |
+
"attention_probs_dropout_prob": 0.0,
|
| 46 |
+
"drop_path_rate": 0.0,
|
| 47 |
+
"hidden_act": "gelu",
|
| 48 |
+
"hidden_dropout_prob": 0.0,
|
| 49 |
+
"hidden_size": 16,
|
| 50 |
+
"image_size": 30,
|
| 51 |
+
"layer_norm_eps": 1e-06,
|
| 52 |
+
"layerscale_value": 1.0,
|
| 53 |
+
"mlp_ratio": 4,
|
| 54 |
+
"model_type": "dinov2",
|
| 55 |
+
"num_attention_heads": 4,
|
| 56 |
+
"num_hidden_layers": 4,
|
| 57 |
+
"out_features": [
|
| 58 |
+
"stage4"
|
| 59 |
+
],
|
| 60 |
+
"out_indices": [
|
| 61 |
+
4
|
| 62 |
+
],
|
| 63 |
+
"patch_size": 2,
|
| 64 |
+
"qkv_bias": true,
|
| 65 |
+
"reshape_hidden_states": false,
|
| 66 |
+
"stage_names": [
|
| 67 |
+
"stem",
|
| 68 |
+
"stage1",
|
| 69 |
+
"stage2",
|
| 70 |
+
"stage3",
|
| 71 |
+
"stage4"
|
| 72 |
+
],
|
| 73 |
+
"torch_dtype": "float32",
|
| 74 |
+
"use_swiglu_ffn": false
|
| 75 |
+
},
|
| 76 |
+
"vision_feature_layer": -1,
|
| 77 |
+
"vision_feature_select_strategy": "default"
|
| 78 |
+
}
|
configuration_maira2.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 Microsoft. All rights reserved.
|
| 2 |
+
# Licensed under the MSRLA License. See LICENSE in the repo root for license information.
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
from typing import Any
|
| 6 |
+
|
| 7 |
+
from transformers import LlavaConfig
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class Maira2Config(LlavaConfig):
|
| 11 |
+
"""
|
| 12 |
+
This is the configuration class to store the configuration of a `Maira2ForConditionalGeneration` model. It is
|
| 13 |
+
used to instantiate a MAIRA-2 model according to the specified arguments, defining the model architecture.
|
| 14 |
+
|
| 15 |
+
It inherits from `LlavaConfig`. In addition to the inherited attributes, it adds the
|
| 16 |
+
ability to customize the multimodal projector through following attributes:
|
| 17 |
+
|
| 18 |
+
Args:
|
| 19 |
+
projector_n_layers (`int`, *optional*, defaults to 4):
|
| 20 |
+
Number of layers in the multimodal projector.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
model_type = "maira2"
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
projector_n_layers: int = 4,
|
| 28 |
+
**kwargs: Any,
|
| 29 |
+
) -> None:
|
| 30 |
+
super().__init__(**kwargs)
|
| 31 |
+
self.hidden_size = self.text_config.hidden_size
|
| 32 |
+
self.projector_n_layers = projector_n_layers
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.48.3"
|
| 7 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3bfb1d6f0ec0f0949cd84df187a2bfb571242c4ca9bdd519c4af512716ae23a
|
| 3 |
+
size 4240896
|
modeling_maira2.py
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 Microsoft. All rights reserved.
|
| 2 |
+
# Licensed under the MSRLA License. See LICENSE in the repo root for license information.
|
| 3 |
+
|
| 4 |
+
from typing import Optional, List, Tuple, Union
|
| 5 |
+
import torch
|
| 6 |
+
from torch.nn import Linear, Module, Sequential
|
| 7 |
+
from transformers import AutoBackbone, AutoModelForCausalLM, LlavaForConditionalGeneration, LlavaPreTrainedModel
|
| 8 |
+
from transformers.models.llava.modeling_llava import LlavaCausalLMOutputWithPast
|
| 9 |
+
from transformers.activations import ACT2FN
|
| 10 |
+
from transformers.utils import check_min_version
|
| 11 |
+
|
| 12 |
+
from .configuration_maira2 import Maira2Config
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
class Maira2MultiModalProjector(Module):
|
| 16 |
+
"""
|
| 17 |
+
This class implements the multimodal projector for MAIRA-2 model. It projects the image features to the text
|
| 18 |
+
hidden size via a series of linear layers (4 layers in MAIRA-2).
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
def __init__(self, config: Maira2Config):
|
| 22 |
+
super().__init__()
|
| 23 |
+
|
| 24 |
+
n_layers = config.projector_n_layers
|
| 25 |
+
if n_layers < 1:
|
| 26 |
+
raise ValueError(f"Number of layers should be at least 1, got {n_layers=}")
|
| 27 |
+
text_hidden_size = config.text_config.hidden_size
|
| 28 |
+
vision_hidden_size = config.vision_config.hidden_size
|
| 29 |
+
_layers = [Linear(vision_hidden_size, text_hidden_size, bias=True)]
|
| 30 |
+
for _ in range(n_layers - 1):
|
| 31 |
+
_layers.append(ACT2FN[config.projector_hidden_act])
|
| 32 |
+
_layers.append(Linear(text_hidden_size, text_hidden_size, bias=True))
|
| 33 |
+
|
| 34 |
+
self.layers = Sequential(*_layers)
|
| 35 |
+
|
| 36 |
+
def forward(self, image_features: torch.Tensor) -> torch.FloatTensor:
|
| 37 |
+
hidden_states = self.layers(image_features)
|
| 38 |
+
return hidden_states # type: ignore[no-any-return]
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class Maira2ForConditionalGeneration(LlavaForConditionalGeneration):
|
| 42 |
+
"""
|
| 43 |
+
This model implements the multimodal model MAIRA-2. It consists of a vision backbone, a multimodal projector, and a
|
| 44 |
+
language model. The model can be used for grounded and ungrounded report generation tasks as well as phrase grounding.
|
| 45 |
+
This class inherits from `LlavaForConditionalGeneration`, defining a custom multimodal projector and changing image
|
| 46 |
+
feature selection.
|
| 47 |
+
"""
|
| 48 |
+
|
| 49 |
+
config_class = Maira2Config
|
| 50 |
+
|
| 51 |
+
def __init__(self, config: Maira2Config) -> None:
|
| 52 |
+
|
| 53 |
+
# Check transformers version is at least 4.46.0.dev0 otherwise the model fails
|
| 54 |
+
# silently since get_image_features is not called in the forward pass
|
| 55 |
+
check_min_version("4.46.0.dev0")
|
| 56 |
+
|
| 57 |
+
super(LlavaPreTrainedModel, self).__init__(config)
|
| 58 |
+
self.vision_tower = AutoBackbone.from_config(config.vision_config)
|
| 59 |
+
|
| 60 |
+
self.multi_modal_projector = Maira2MultiModalProjector(config)
|
| 61 |
+
self.vocab_size = config.text_config.vocab_size
|
| 62 |
+
self.language_model = AutoModelForCausalLM.from_config(
|
| 63 |
+
config.text_config,
|
| 64 |
+
attn_implementation=config._attn_implementation,
|
| 65 |
+
)
|
| 66 |
+
self.pad_token_id = self.config.pad_token_id if self.config.pad_token_id is not None else -1
|
| 67 |
+
self.post_init()
|
| 68 |
+
|
| 69 |
+
def get_image_features(
|
| 70 |
+
self, pixel_values: torch.FloatTensor, vision_feature_layer: int, vision_feature_select_strategy: str
|
| 71 |
+
) -> torch.Tensor:
|
| 72 |
+
"""
|
| 73 |
+
This method extracts the image features from the vision backbone using the specified feature layer and
|
| 74 |
+
selection strategy. This is custom to MAIRA-2 model since we want to use the `feature_maps` from the Dinov2Backbone
|
| 75 |
+
class instead of the `hidden_states` which are used in the default implementation of `get_image_features` in LlavaForConditionalGeneration.
|
| 76 |
+
The feature_maps returned by Dinov2Backbone are the hideen_states with a layernorm applied to them.
|
| 77 |
+
"""
|
| 78 |
+
image_outputs = self.vision_tower(pixel_values, output_hidden_states=True)
|
| 79 |
+
selected_image_feature = image_outputs.feature_maps[vision_feature_layer]
|
| 80 |
+
|
| 81 |
+
if vision_feature_select_strategy == "default":
|
| 82 |
+
selected_image_feature = selected_image_feature[:, 1:]
|
| 83 |
+
elif vision_feature_select_strategy == "full":
|
| 84 |
+
selected_image_feature = selected_image_feature
|
| 85 |
+
else:
|
| 86 |
+
raise ValueError(f"Unexpected select feature strategy: {self.config.vision_feature_select_strategy}")
|
| 87 |
+
|
| 88 |
+
image_features = self.multi_modal_projector(selected_image_feature)
|
| 89 |
+
return image_features # type: ignore[no-any-return]
|
| 90 |
+
|
| 91 |
+
# modification from original, added forward from transformers 4.46 to prevent new preprocessing
|
| 92 |
+
def forward(
|
| 93 |
+
self,
|
| 94 |
+
input_ids: torch.LongTensor = None,
|
| 95 |
+
pixel_values: torch.FloatTensor = None,
|
| 96 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 97 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 98 |
+
past_key_values: Optional[List[torch.FloatTensor]] = None,
|
| 99 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 100 |
+
vision_feature_layer: Optional[int] = None,
|
| 101 |
+
vision_feature_select_strategy: Optional[str] = None,
|
| 102 |
+
labels: Optional[torch.LongTensor] = None,
|
| 103 |
+
use_cache: Optional[bool] = None,
|
| 104 |
+
output_attentions: Optional[bool] = None,
|
| 105 |
+
output_hidden_states: Optional[bool] = None,
|
| 106 |
+
return_dict: Optional[bool] = None,
|
| 107 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 108 |
+
num_logits_to_keep: int = 0,
|
| 109 |
+
) -> Union[Tuple, LlavaCausalLMOutputWithPast]:
|
| 110 |
+
r"""
|
| 111 |
+
Args:
|
| 112 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 113 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 114 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 115 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 116 |
+
|
| 117 |
+
num_logits_to_keep (`int`, *optional*):
|
| 118 |
+
Calculate logits for the last `num_logits_to_keep` tokens. If `0`, calculate logits for all
|
| 119 |
+
`input_ids` (special case). Only last token logits are needed for generation, and calculating them only for that
|
| 120 |
+
token can save memory, which becomes pretty significant for long sequences or large vocabulary size.
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
Returns:
|
| 124 |
+
|
| 125 |
+
Example:
|
| 126 |
+
|
| 127 |
+
```python
|
| 128 |
+
>>> from PIL import Image
|
| 129 |
+
>>> import requests
|
| 130 |
+
>>> from transformers import AutoProcessor, LlavaForConditionalGeneration
|
| 131 |
+
|
| 132 |
+
>>> model = LlavaForConditionalGeneration.from_pretrained("llava-hf/llava-1.5-7b-hf")
|
| 133 |
+
>>> processor = AutoProcessor.from_pretrained("llava-hf/llava-1.5-7b-hf")
|
| 134 |
+
|
| 135 |
+
>>> prompt = "USER: <image>\nWhat's the content of the image? ASSISTANT:"
|
| 136 |
+
>>> url = "https://www.ilankelman.org/stopsigns/australia.jpg"
|
| 137 |
+
>>> image = Image.open(requests.get(url, stream=True).raw)
|
| 138 |
+
|
| 139 |
+
>>> inputs = processor(images=image, text=prompt, return_tensors="pt")
|
| 140 |
+
|
| 141 |
+
>>> # Generate
|
| 142 |
+
>>> generate_ids = model.generate(**inputs, max_new_tokens=15)
|
| 143 |
+
>>> processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 144 |
+
"USER: \nWhat's the content of the image? ASSISTANT: The image features a busy city street with a stop sign prominently displayed"
|
| 145 |
+
```"""
|
| 146 |
+
|
| 147 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 148 |
+
output_hidden_states = (
|
| 149 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 150 |
+
)
|
| 151 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 152 |
+
vision_feature_layer = (
|
| 153 |
+
vision_feature_layer if vision_feature_layer is not None else self.config.vision_feature_layer
|
| 154 |
+
)
|
| 155 |
+
vision_feature_select_strategy = (
|
| 156 |
+
vision_feature_select_strategy
|
| 157 |
+
if vision_feature_select_strategy is not None
|
| 158 |
+
else self.config.vision_feature_select_strategy
|
| 159 |
+
)
|
| 160 |
+
|
| 161 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 162 |
+
raise ValueError(
|
| 163 |
+
"You cannot specify both input_ids and inputs_embeds at the same time, and must specify either one"
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
if pixel_values is not None and inputs_embeds is not None:
|
| 167 |
+
raise ValueError(
|
| 168 |
+
"You cannot specify both pixel_values and inputs_embeds at the same time, and must specify either one"
|
| 169 |
+
)
|
| 170 |
+
|
| 171 |
+
legacy_processing = False
|
| 172 |
+
if inputs_embeds is None:
|
| 173 |
+
inputs_embeds = self.get_input_embeddings()(input_ids)
|
| 174 |
+
|
| 175 |
+
# if the number of image tokens is more than image embeddings seq length, then prob we expanded it in processing
|
| 176 |
+
# not very reliable, but we don't expect one to actually pass 500+ images for one prompt
|
| 177 |
+
# In case we're in decoding stage, legacy behavior is checked by presence of pixel values even if use_cache=True
|
| 178 |
+
legacy_processing = (
|
| 179 |
+
(input_ids == self.config.image_token_index).sum(1).max() < self.config.image_seq_length
|
| 180 |
+
) or (input_ids.shape[-1] == 1 and pixel_values is not None)
|
| 181 |
+
|
| 182 |
+
if pixel_values is not None:
|
| 183 |
+
image_features = self.get_image_features(
|
| 184 |
+
pixel_values=pixel_values,
|
| 185 |
+
vision_feature_layer=vision_feature_layer,
|
| 186 |
+
vision_feature_select_strategy=vision_feature_select_strategy,
|
| 187 |
+
)
|
| 188 |
+
print(image_features.shape)
|
| 189 |
+
|
| 190 |
+
if legacy_processing:
|
| 191 |
+
# prefill stage vs decoding stage (legacy behavior copied)
|
| 192 |
+
if input_ids.shape[1] != 1:
|
| 193 |
+
inputs_embeds, attention_mask, labels, position_ids = self._merge_input_ids_with_image_features(
|
| 194 |
+
image_features, inputs_embeds, input_ids, attention_mask, labels
|
| 195 |
+
)
|
| 196 |
+
cache_position = torch.arange(attention_mask.shape[1], device=attention_mask.device)
|
| 197 |
+
else:
|
| 198 |
+
# Retrieve the first layer to inspect the logits and mask out the hidden states
|
| 199 |
+
# that are set to 0
|
| 200 |
+
first_layer_past_key_value = past_key_values[0][0][:, :, :, 0]
|
| 201 |
+
|
| 202 |
+
# Sum all dimensions of head_dim (-2) to avoid random errors such as: https://github.com/huggingface/transformers/pull/28032#issuecomment-1863691941
|
| 203 |
+
batch_index, non_attended_tokens = torch.where(first_layer_past_key_value.float().sum(-2) == 0)
|
| 204 |
+
|
| 205 |
+
# Get the target length
|
| 206 |
+
target_length = input_ids.shape[1]
|
| 207 |
+
past_length = first_layer_past_key_value.shape[-1]
|
| 208 |
+
|
| 209 |
+
extended_attention_mask = torch.ones(
|
| 210 |
+
(attention_mask.shape[0], past_length),
|
| 211 |
+
dtype=attention_mask.dtype,
|
| 212 |
+
device=attention_mask.device,
|
| 213 |
+
)
|
| 214 |
+
|
| 215 |
+
# Filter out only the tokens that can be un-attended, this can happen
|
| 216 |
+
# if one uses Llava + Fused modules where the cache on the
|
| 217 |
+
# first iteration is already big enough, or if one passes custom cache
|
| 218 |
+
valid_indices = non_attended_tokens < extended_attention_mask.size(-1)
|
| 219 |
+
new_batch_index = batch_index[valid_indices]
|
| 220 |
+
new_non_attended_tokens = non_attended_tokens[valid_indices]
|
| 221 |
+
|
| 222 |
+
# Zero-out the places where we don't need to attend
|
| 223 |
+
extended_attention_mask[new_batch_index, new_non_attended_tokens] = 0
|
| 224 |
+
|
| 225 |
+
attention_mask = torch.cat((extended_attention_mask, attention_mask[:, -target_length:]), dim=1)
|
| 226 |
+
position_ids = torch.sum(attention_mask, dim=1).unsqueeze(-1) - 1
|
| 227 |
+
cache_position = torch.arange(attention_mask.shape[1], device=attention_mask.device)[
|
| 228 |
+
-target_length:
|
| 229 |
+
]
|
| 230 |
+
|
| 231 |
+
# TODO: @raushan retain only the new behavior after v4.47
|
| 232 |
+
else:
|
| 233 |
+
special_image_mask = (
|
| 234 |
+
(input_ids == self.config.image_token_index).unsqueeze(-1).expand_as(inputs_embeds)
|
| 235 |
+
)
|
| 236 |
+
image_features = image_features.to(inputs_embeds.device, inputs_embeds.dtype)
|
| 237 |
+
inputs_embeds = inputs_embeds.masked_scatter(special_image_mask, image_features)
|
| 238 |
+
|
| 239 |
+
outputs = self.language_model(
|
| 240 |
+
attention_mask=attention_mask,
|
| 241 |
+
position_ids=position_ids,
|
| 242 |
+
past_key_values=past_key_values,
|
| 243 |
+
inputs_embeds=inputs_embeds,
|
| 244 |
+
use_cache=use_cache,
|
| 245 |
+
output_attentions=output_attentions,
|
| 246 |
+
output_hidden_states=output_hidden_states,
|
| 247 |
+
return_dict=return_dict,
|
| 248 |
+
cache_position=cache_position,
|
| 249 |
+
num_logits_to_keep=num_logits_to_keep,
|
| 250 |
+
)
|
| 251 |
+
|
| 252 |
+
logits = outputs[0]
|
| 253 |
+
|
| 254 |
+
loss = None
|
| 255 |
+
if labels is not None:
|
| 256 |
+
# Shift so that tokens < n predict n
|
| 257 |
+
if attention_mask is not None:
|
| 258 |
+
shift_attention_mask = attention_mask[..., 1:]
|
| 259 |
+
shift_logits = logits[..., :-1, :][shift_attention_mask.to(logits.device) != 0].contiguous()
|
| 260 |
+
shift_labels = labels[..., 1:][shift_attention_mask.to(labels.device) != 0].contiguous()
|
| 261 |
+
else:
|
| 262 |
+
shift_logits = logits[..., :-1, :].contiguous()
|
| 263 |
+
shift_labels = labels[..., 1:].contiguous()
|
| 264 |
+
# Flatten the tokens
|
| 265 |
+
loss_fct = torch.nn.CrossEntropyLoss()
|
| 266 |
+
loss = loss_fct(
|
| 267 |
+
shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1).to(shift_logits.device)
|
| 268 |
+
)
|
| 269 |
+
|
| 270 |
+
if not return_dict:
|
| 271 |
+
output = (logits,) + outputs[1:]
|
| 272 |
+
return (loss,) + output if loss is not None else output
|
| 273 |
+
|
| 274 |
+
return LlavaCausalLMOutputWithPast(
|
| 275 |
+
loss=loss,
|
| 276 |
+
logits=logits,
|
| 277 |
+
past_key_values=outputs.past_key_values,
|
| 278 |
+
hidden_states=outputs.hidden_states,
|
| 279 |
+
attentions=outputs.attentions,
|
| 280 |
+
image_hidden_states=image_features if pixel_values is not None else None,
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
def _merge_input_ids_with_image_features(self, image_features, inputs_embeds, input_ids, attention_mask, labels):
|
| 284 |
+
num_images, num_image_patches, embed_dim = image_features.shape
|
| 285 |
+
batch_size, sequence_length = input_ids.shape
|
| 286 |
+
left_padding = not torch.sum(input_ids[:, -1] == torch.tensor(self.pad_token_id))
|
| 287 |
+
# 1. Create a mask to know where special image tokens are
|
| 288 |
+
special_image_token_mask = input_ids == self.config.image_token_index
|
| 289 |
+
num_special_image_tokens = torch.sum(special_image_token_mask, dim=-1)
|
| 290 |
+
# Compute the maximum embed dimension
|
| 291 |
+
max_embed_dim = (num_special_image_tokens.max() * (num_image_patches - 1)) + sequence_length
|
| 292 |
+
batch_indices, non_image_indices = torch.where(input_ids != self.config.image_token_index)
|
| 293 |
+
|
| 294 |
+
# 2. Compute the positions where text should be written
|
| 295 |
+
# Calculate new positions for text tokens in merged image-text sequence.
|
| 296 |
+
# `special_image_token_mask` identifies image tokens. Each image token will be replaced by `nb_text_tokens_per_images - 1` text tokens.
|
| 297 |
+
# `torch.cumsum` computes how each image token shifts subsequent text token positions.
|
| 298 |
+
# - 1 to adjust for zero-based indexing, as `cumsum` inherently increases indices by one.
|
| 299 |
+
new_token_positions = torch.cumsum((special_image_token_mask * (num_image_patches - 1) + 1), -1) - 1
|
| 300 |
+
nb_image_pad = max_embed_dim - 1 - new_token_positions[:, -1]
|
| 301 |
+
if left_padding:
|
| 302 |
+
new_token_positions += nb_image_pad[:, None] # offset for left padding
|
| 303 |
+
text_to_overwrite = new_token_positions[batch_indices, non_image_indices]
|
| 304 |
+
|
| 305 |
+
# 3. Create the full embedding, already padded to the maximum position
|
| 306 |
+
final_embedding = torch.zeros(
|
| 307 |
+
batch_size, max_embed_dim, embed_dim, dtype=inputs_embeds.dtype, device=inputs_embeds.device
|
| 308 |
+
)
|
| 309 |
+
final_attention_mask = torch.zeros(
|
| 310 |
+
batch_size, max_embed_dim, dtype=attention_mask.dtype, device=inputs_embeds.device
|
| 311 |
+
)
|
| 312 |
+
if labels is not None:
|
| 313 |
+
final_labels = torch.full(
|
| 314 |
+
(batch_size, max_embed_dim), self.config.ignore_index, dtype=input_ids.dtype, device=input_ids.device
|
| 315 |
+
)
|
| 316 |
+
# In case the Vision model or the Language model has been offloaded to CPU, we need to manually
|
| 317 |
+
# set the corresponding tensors into their correct target device.
|
| 318 |
+
target_device = inputs_embeds.device
|
| 319 |
+
batch_indices, non_image_indices, text_to_overwrite = (
|
| 320 |
+
batch_indices.to(target_device),
|
| 321 |
+
non_image_indices.to(target_device),
|
| 322 |
+
text_to_overwrite.to(target_device),
|
| 323 |
+
)
|
| 324 |
+
attention_mask = attention_mask.to(target_device)
|
| 325 |
+
|
| 326 |
+
# 4. Fill the embeddings based on the mask. If we have ["hey" "<image>", "how", "are"]
|
| 327 |
+
# we need to index copy on [0, 577, 578, 579] for the text and [1:576] for the image features
|
| 328 |
+
final_embedding[batch_indices, text_to_overwrite] = inputs_embeds[batch_indices, non_image_indices]
|
| 329 |
+
final_attention_mask[batch_indices, text_to_overwrite] = attention_mask[batch_indices, non_image_indices]
|
| 330 |
+
if labels is not None:
|
| 331 |
+
final_labels[batch_indices, text_to_overwrite] = labels[batch_indices, non_image_indices]
|
| 332 |
+
|
| 333 |
+
# 5. Fill the embeddings corresponding to the images. Anything that is not `text_positions` needs filling (#29835)
|
| 334 |
+
image_to_overwrite = torch.full(
|
| 335 |
+
(batch_size, max_embed_dim), True, dtype=torch.bool, device=inputs_embeds.device
|
| 336 |
+
)
|
| 337 |
+
image_to_overwrite[batch_indices, text_to_overwrite] = False
|
| 338 |
+
image_to_overwrite &= image_to_overwrite.cumsum(-1) - 1 >= nb_image_pad[:, None].to(target_device)
|
| 339 |
+
|
| 340 |
+
if image_to_overwrite.sum() != image_features.shape[:-1].numel():
|
| 341 |
+
raise ValueError(
|
| 342 |
+
f"The input provided to the model are wrong. The number of image tokens is {torch.sum(special_image_token_mask)} while"
|
| 343 |
+
f" the number of image given to the model is {num_images}. This prevents correct indexing and breaks batch generation."
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
final_embedding[image_to_overwrite] = image_features.contiguous().reshape(-1, embed_dim).to(target_device)
|
| 347 |
+
final_attention_mask |= image_to_overwrite
|
| 348 |
+
position_ids = (final_attention_mask.cumsum(-1) - 1).masked_fill_((final_attention_mask == 0), 1)
|
| 349 |
+
|
| 350 |
+
# 6. Mask out the embedding at padding positions, as we later use the past_key_value value to determine the non-attended tokens.
|
| 351 |
+
batch_indices, pad_indices = torch.where(input_ids == self.pad_token_id)
|
| 352 |
+
indices_to_mask = new_token_positions[batch_indices, pad_indices]
|
| 353 |
+
|
| 354 |
+
final_embedding[batch_indices, indices_to_mask] = 0
|
| 355 |
+
|
| 356 |
+
if labels is None:
|
| 357 |
+
final_labels = None
|
| 358 |
+
|
| 359 |
+
return final_embedding, final_attention_mask, final_labels, position_ids
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_maira2.Maira2Processor"
|
| 4 |
+
},
|
| 5 |
+
"crop_size": {
|
| 6 |
+
"height": 30,
|
| 7 |
+
"width": 30
|
| 8 |
+
},
|
| 9 |
+
"do_center_crop": true,
|
| 10 |
+
"do_convert_rgb": true,
|
| 11 |
+
"do_normalize": true,
|
| 12 |
+
"do_rescale": true,
|
| 13 |
+
"do_resize": true,
|
| 14 |
+
"image_mean": [
|
| 15 |
+
0.5307,
|
| 16 |
+
0.5307,
|
| 17 |
+
0.5307
|
| 18 |
+
],
|
| 19 |
+
"image_processor_type": "BitImageProcessor",
|
| 20 |
+
"image_std": [
|
| 21 |
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2024 Microsoft. All rights reserved.
|
| 2 |
+
# Licensed under the MSRLA License. See LICENSE in the repo root for license information.
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
import re
|
| 6 |
+
from typing import Any, TypeAlias, Union, List
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
from PIL import Image
|
| 10 |
+
from transformers import BaseImageProcessor, LlavaProcessor, PreTrainedTokenizer
|
| 11 |
+
from transformers.models.llava.processing_llava import LlavaProcessorKwargs
|
| 12 |
+
from transformers.feature_extraction_utils import BatchFeature
|
| 13 |
+
from transformers.image_utils import ImageInput, get_image_size, to_numpy_array
|
| 14 |
+
from transformers.processing_utils import ProcessingKwargs, ProcessorMixin, Unpack, _validate_images_text_input_order
|
| 15 |
+
from transformers.tokenization_utils_base import PreTokenizedInput, TextInput
|
| 16 |
+
|
| 17 |
+
SingleChatMessageType: TypeAlias = dict[str, str | int | None]
|
| 18 |
+
ChatMessageListType: TypeAlias = list[dict[str, str | list[SingleChatMessageType]]]
|
| 19 |
+
BoxType: TypeAlias = tuple[float, float, float, float]
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class Maira2Processor(LlavaProcessor):
|
| 23 |
+
"""
|
| 24 |
+
Constructs a Maira2 processor similar to LlavaProcessor but with additional arguments and functions to support
|
| 25 |
+
multi-image grounded and non-grounded radiology report generation.
|
| 26 |
+
|
| 27 |
+
In addition to the arguments of LlavaProcessor, Maira2Processor has the following extra arguments:
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
phrase_start_token (`str`, *optional*, defaults to `"<obj>"`):
|
| 31 |
+
Special token used to denote the start of a grounded phrase (with or without box).
|
| 32 |
+
phrase_end_token (`str`, *optional*, defaults to `"</obj>"`):
|
| 33 |
+
Special token used to denote the end of a grounded phrase.
|
| 34 |
+
box_start_token (`str`, *optional*, defaults to `"<box>"`):
|
| 35 |
+
Special token used to denote the start of a bounding box.
|
| 36 |
+
box_end_token (`str`, *optional*, defaults to `"</box>"`):
|
| 37 |
+
Special token used to denote the end of a bounding box.
|
| 38 |
+
num_box_coord_bins (`int`, *optional*, defaults to `100`):
|
| 39 |
+
Number of bins used to represent the bounding box coordinates.
|
| 40 |
+
"""
|
| 41 |
+
|
| 42 |
+
valid_kwargs = [
|
| 43 |
+
"chat_template",
|
| 44 |
+
"patch_size",
|
| 45 |
+
"vision_feature_select_strategy",
|
| 46 |
+
"image_token",
|
| 47 |
+
"phrase_start_token",
|
| 48 |
+
"phrase_end_token",
|
| 49 |
+
"box_start_token",
|
| 50 |
+
"box_end_token",
|
| 51 |
+
"num_box_coord_bins",
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
def __init__(
|
| 55 |
+
self,
|
| 56 |
+
image_processor: BaseImageProcessor = None,
|
| 57 |
+
tokenizer: PreTrainedTokenizer = None,
|
| 58 |
+
patch_size: int | None = None,
|
| 59 |
+
vision_feature_select_strategy: str | None = None,
|
| 60 |
+
chat_template: str | None = None,
|
| 61 |
+
image_token: str = "<image>",
|
| 62 |
+
phrase_start_token: str = "<obj>",
|
| 63 |
+
phrase_end_token: str = "</obj>",
|
| 64 |
+
box_start_token: str = "<box>",
|
| 65 |
+
box_end_token: str = "</box>",
|
| 66 |
+
num_box_coord_bins: int = 100,
|
| 67 |
+
**kwargs: Any,
|
| 68 |
+
) -> None:
|
| 69 |
+
super().__init__(
|
| 70 |
+
image_processor=image_processor,
|
| 71 |
+
tokenizer=tokenizer,
|
| 72 |
+
patch_size=patch_size,
|
| 73 |
+
vision_feature_select_strategy=vision_feature_select_strategy,
|
| 74 |
+
chat_template=chat_template,
|
| 75 |
+
image_token=image_token,
|
| 76 |
+
**kwargs,
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
self.phrase_start_token = phrase_start_token
|
| 80 |
+
self.phrase_end_token = phrase_end_token
|
| 81 |
+
self.box_start_token = box_start_token
|
| 82 |
+
self.box_end_token = box_end_token
|
| 83 |
+
self.num_box_coord_bins = num_box_coord_bins
|
| 84 |
+
|
| 85 |
+
@staticmethod
|
| 86 |
+
def _normalize_image(image: Image.Image) -> Image.Image:
|
| 87 |
+
"""
|
| 88 |
+
This function normalizes the input image to have pixel values in the range [0, 255].
|
| 89 |
+
|
| 90 |
+
Args:
|
| 91 |
+
image (Image.Image | np.ndarray):
|
| 92 |
+
The input image to be normalized.
|
| 93 |
+
|
| 94 |
+
Returns:
|
| 95 |
+
Image.Image: The normalized image in grayscale.
|
| 96 |
+
"""
|
| 97 |
+
image_np = np.array(image.convert("L"))
|
| 98 |
+
image_np = image_np.astype(float)
|
| 99 |
+
image_np -= image_np.min()
|
| 100 |
+
image_np /= image_np.max()
|
| 101 |
+
image_np *= 255
|
| 102 |
+
image_np = image_np.astype(np.uint8)
|
| 103 |
+
|
| 104 |
+
return Image.fromarray(image_np).convert("L")
|
| 105 |
+
|
| 106 |
+
def _normalize_and_stack_images(
|
| 107 |
+
self,
|
| 108 |
+
current_frontal: Image.Image,
|
| 109 |
+
current_lateral: Image.Image | None,
|
| 110 |
+
prior_frontal: Image.Image | None,
|
| 111 |
+
) -> list[Image.Image]:
|
| 112 |
+
"""
|
| 113 |
+
This function normalizes the input images and stacks them together. The images are stacked in the order of
|
| 114 |
+
current_frontal, current_lateral, and prior_frontal. The order of images is important, since it must match the
|
| 115 |
+
order of the images in the prompt, which is frontal, then lateral then prior.
|
| 116 |
+
|
| 117 |
+
Args:
|
| 118 |
+
current_frontal (Image.Image):
|
| 119 |
+
The current frontal image.
|
| 120 |
+
current_lateral (Image.Image | None):
|
| 121 |
+
The current lateral image.
|
| 122 |
+
prior_frontal (Image.Image | None):
|
| 123 |
+
The prior frontal image.
|
| 124 |
+
|
| 125 |
+
Returns:
|
| 126 |
+
list[Image.Image]: The normalized images stacked together.
|
| 127 |
+
"""
|
| 128 |
+
images = [self._normalize_image(current_frontal)]
|
| 129 |
+
if current_lateral is not None:
|
| 130 |
+
images.append(self._normalize_image(current_lateral))
|
| 131 |
+
if prior_frontal is not None:
|
| 132 |
+
images.append(self._normalize_image(prior_frontal))
|
| 133 |
+
return images
|
| 134 |
+
|
| 135 |
+
@staticmethod
|
| 136 |
+
def _get_section_text_or_missing_text(section: str | None) -> str:
|
| 137 |
+
"""
|
| 138 |
+
This function returns the input section text if it is not None and not empty, otherwise it returns a missing
|
| 139 |
+
section text "N/A".
|
| 140 |
+
|
| 141 |
+
Args:
|
| 142 |
+
section (str | None):
|
| 143 |
+
The input section text.
|
| 144 |
+
|
| 145 |
+
Returns:
|
| 146 |
+
str: The section text if it is not None and not empty, otherwise "N/A".
|
| 147 |
+
"""
|
| 148 |
+
missing_section_text = "N/A"
|
| 149 |
+
if not isinstance(section, str) or len(section) == 0:
|
| 150 |
+
return missing_section_text
|
| 151 |
+
return section
|
| 152 |
+
|
| 153 |
+
@staticmethod
|
| 154 |
+
def _construct_image_chat_messages_for_reporting(has_prior: bool, has_lateral: bool) -> list[SingleChatMessageType]:
|
| 155 |
+
"""
|
| 156 |
+
This function constructs user chat messages based on the presence of the prior and lateral images.
|
| 157 |
+
|
| 158 |
+
Args:
|
| 159 |
+
has_prior (bool):
|
| 160 |
+
A boolean indicating whether the prior image is present.
|
| 161 |
+
has_lateral (bool):
|
| 162 |
+
A boolean indicating whether the lateral image is present.
|
| 163 |
+
|
| 164 |
+
Returns:
|
| 165 |
+
list[SingleChatMessageType]: The image prompt messages in the form of a list of dictionaries.
|
| 166 |
+
|
| 167 |
+
Example:
|
| 168 |
+
|
| 169 |
+
```python
|
| 170 |
+
>>> _construct_image_chat_messages_for_reporting(has_prior=True, has_lateral=True)
|
| 171 |
+
>>> # [
|
| 172 |
+
>>> # {"index": None, "text": "Given the current frontal image", "type": "text"},
|
| 173 |
+
>>> # {"index": 0, "text": None, "type": "image"},
|
| 174 |
+
>>> # {"index": None, "text": " the current lateral image", "type": "text"},
|
| 175 |
+
>>> # {"index": 1, "text": None, "type": "image"},
|
| 176 |
+
>>> # {"index": None, "text": " and the prior frontal image", "type": "text"},
|
| 177 |
+
>>> # {"index": 2, "text": None, "type": "image"},
|
| 178 |
+
>>> # ]
|
| 179 |
+
```
|
| 180 |
+
"""
|
| 181 |
+
|
| 182 |
+
def _add_single_image_to_chat_messages(prompt_text: str, image_index: int) -> None:
|
| 183 |
+
image_prompt.extend(
|
| 184 |
+
[
|
| 185 |
+
{"index": None, "text": prompt_text, "type": "text"},
|
| 186 |
+
{"index": image_index, "text": None, "type": "image"},
|
| 187 |
+
]
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
image_prompt: list[SingleChatMessageType] = []
|
| 191 |
+
image_index = 0
|
| 192 |
+
if not has_prior and not has_lateral:
|
| 193 |
+
_add_single_image_to_chat_messages("Given the current frontal image only", image_index)
|
| 194 |
+
else:
|
| 195 |
+
_add_single_image_to_chat_messages("Given the current frontal image", image_index)
|
| 196 |
+
image_index += 1
|
| 197 |
+
if has_prior:
|
| 198 |
+
if has_lateral:
|
| 199 |
+
_add_single_image_to_chat_messages(" the current lateral image", image_index)
|
| 200 |
+
image_index += 1
|
| 201 |
+
_add_single_image_to_chat_messages(" and the prior frontal image", image_index)
|
| 202 |
+
else:
|
| 203 |
+
if has_lateral:
|
| 204 |
+
_add_single_image_to_chat_messages(" and the current lateral image", image_index)
|
| 205 |
+
return image_prompt
|
| 206 |
+
|
| 207 |
+
def _construct_chat_messages_reporting(
|
| 208 |
+
self,
|
| 209 |
+
has_prior: bool,
|
| 210 |
+
has_lateral: bool,
|
| 211 |
+
indication: str | None,
|
| 212 |
+
technique: str | None,
|
| 213 |
+
comparison: str | None,
|
| 214 |
+
prior_report: str | None,
|
| 215 |
+
get_grounding: bool = False,
|
| 216 |
+
assistant_text: str | None = None,
|
| 217 |
+
) -> ChatMessageListType:
|
| 218 |
+
"""
|
| 219 |
+
This function constructs the chat messages for reporting used in the grounded and non-grounded reporting tasks.
|
| 220 |
+
|
| 221 |
+
Args:
|
| 222 |
+
has_prior (bool):
|
| 223 |
+
A boolean indicating whether the prior image is present.
|
| 224 |
+
has_lateral (bool):
|
| 225 |
+
A boolean indicating whether the lateral image is present.
|
| 226 |
+
indication (str | None):
|
| 227 |
+
The indication section text.
|
| 228 |
+
technique (str | None):
|
| 229 |
+
The technique section text.
|
| 230 |
+
comparison (str | None):
|
| 231 |
+
The comparison section text.
|
| 232 |
+
prior_report (str | None):
|
| 233 |
+
The prior report section text.
|
| 234 |
+
get_grounding (bool):
|
| 235 |
+
A boolean indicating whether to get the grounding information.
|
| 236 |
+
assistant_text (str | None):
|
| 237 |
+
The assistant text (can be set to None for ordinary inference).
|
| 238 |
+
|
| 239 |
+
Returns:
|
| 240 |
+
ChatMessageListType: The chat messages for reporting in the form of a list of dictionaries.
|
| 241 |
+
|
| 242 |
+
Example:
|
| 243 |
+
|
| 244 |
+
```python
|
| 245 |
+
>>> _construct_chat_messages_reporting(
|
| 246 |
+
>>> has_prior=True,
|
| 247 |
+
>>> has_lateral=True,
|
| 248 |
+
>>> indication="indication text from report goes here",
|
| 249 |
+
>>> technique="technique text from report goes here",
|
| 250 |
+
>>> comparison="comparison text from report goes here",
|
| 251 |
+
>>> prior_report="prior reporting text goes here",
|
| 252 |
+
>>> get_grounding=False,
|
| 253 |
+
>>> assistant_text=None,
|
| 254 |
+
>>> )
|
| 255 |
+
>>> # [
|
| 256 |
+
>>> # {"index": None, "text": "Given the current frontal image", "type": "text"},
|
| 257 |
+
>>> # {"index": 0, "text": None, "type": "image"},
|
| 258 |
+
>>> # {"index": None, "text": " the current lateral image", "type": "text"},
|
| 259 |
+
>>> # {"index": 1, "text": None, "type": "image"},
|
| 260 |
+
>>> # {"index": None, "text": " and the prior frontal image", "type": "text"},
|
| 261 |
+
>>> # {"index": 2, "text": None, "type": "image"},
|
| 262 |
+
>>> # {"index": None, "text": " PRIOR_REPORT: prior reporting text goes here", "type": "text"},
|
| 263 |
+
>>> # {"index": None, "text": " Provide a description of the findings in the radiology study in comparison to the "
|
| 264 |
+
>>> # "prior frontal image. INDICATION: indication text from report goes here TECHNIQUE: technique text from report "
|
| 265 |
+
>>> # "goes here COMPARISON: comparison text from report goes here", "type": "text"},
|
| 266 |
+
>>> # ]
|
| 267 |
+
```
|
| 268 |
+
"""
|
| 269 |
+
indication = self._get_section_text_or_missing_text(indication)
|
| 270 |
+
technique = self._get_section_text_or_missing_text(technique)
|
| 271 |
+
comparison = self._get_section_text_or_missing_text(comparison)
|
| 272 |
+
prior_report = self._get_section_text_or_missing_text(prior_report)
|
| 273 |
+
|
| 274 |
+
prompt = self._construct_image_chat_messages_for_reporting(has_prior=has_prior, has_lateral=has_lateral)
|
| 275 |
+
|
| 276 |
+
if has_prior:
|
| 277 |
+
prompt.append({"index": None, "text": f" PRIOR_REPORT: {prior_report}", "type": "text"})
|
| 278 |
+
|
| 279 |
+
if get_grounding:
|
| 280 |
+
prompt.append(
|
| 281 |
+
{
|
| 282 |
+
"index": None,
|
| 283 |
+
"text": " Provide a description of the findings in the radiology study in comparison to the "
|
| 284 |
+
"prior frontal image. Each finding should be described as a self-contained plain-text sentence."
|
| 285 |
+
" If the finding is groundable, locate the finding in the current frontal chest X-ray image, "
|
| 286 |
+
"with bounding boxes indicating all locations where it can be seen in the current frontal "
|
| 287 |
+
"image. Otherwise, generate just the ungrounded finding without bounding boxes. INDICATION: "
|
| 288 |
+
f"{indication} TECHNIQUE: {technique} COMPARISON: {comparison}",
|
| 289 |
+
"type": "text",
|
| 290 |
+
}
|
| 291 |
+
)
|
| 292 |
+
else:
|
| 293 |
+
prompt.append(
|
| 294 |
+
{
|
| 295 |
+
"index": None,
|
| 296 |
+
"text": " Provide a description of the findings in the radiology study in comparison to the "
|
| 297 |
+
f"prior frontal image. INDICATION: {indication} TECHNIQUE: {technique} COMPARISON: "
|
| 298 |
+
f"{comparison}",
|
| 299 |
+
"type": "text",
|
| 300 |
+
}
|
| 301 |
+
)
|
| 302 |
+
messages: ChatMessageListType = [{"content": prompt, "role": "user"}]
|
| 303 |
+
if assistant_text is not None:
|
| 304 |
+
messages.append({"content": [{"index": None, "text": assistant_text, "type": "text"}], "role": "assistant"})
|
| 305 |
+
return messages
|
| 306 |
+
|
| 307 |
+
def _construct_chat_messages_phrase_grounding(
|
| 308 |
+
self, phrase: str, assistant_text: str | None = None
|
| 309 |
+
) -> ChatMessageListType:
|
| 310 |
+
"""
|
| 311 |
+
This function constructs the chat messages for phrase grounding used in the phrase grounding task.
|
| 312 |
+
|
| 313 |
+
Args:
|
| 314 |
+
phrase (str):
|
| 315 |
+
The phrase to be grounded.
|
| 316 |
+
assistant_text (str | None):
|
| 317 |
+
The assistant text (can be set to None for ordinary inference).
|
| 318 |
+
|
| 319 |
+
Returns:
|
| 320 |
+
ChatMessageListType: The chat messages for phrase grounding in the form of a list of dictionaries.
|
| 321 |
+
"""
|
| 322 |
+
prompt: list[SingleChatMessageType] = [
|
| 323 |
+
{"index": None, "text": "Given the current frontal image", "type": "text"},
|
| 324 |
+
{"index": 0, "text": None, "type": "image"},
|
| 325 |
+
{
|
| 326 |
+
"index": None,
|
| 327 |
+
"text": f" Repeat the following finding as a grounded phrase with bounding boxes indicating all "
|
| 328 |
+
f"locations where it can be seen in the given chest X-ray image. Finding: {phrase}",
|
| 329 |
+
"type": "text",
|
| 330 |
+
},
|
| 331 |
+
]
|
| 332 |
+
messages: ChatMessageListType = [{"content": prompt, "role": "user"}]
|
| 333 |
+
if assistant_text is not None:
|
| 334 |
+
messages.append({"content": [{"index": None, "text": assistant_text, "type": "text"}], "role": "assistant"})
|
| 335 |
+
return messages
|
| 336 |
+
|
| 337 |
+
def format_reporting_input(
|
| 338 |
+
self,
|
| 339 |
+
current_frontal: Image.Image,
|
| 340 |
+
current_lateral: Image.Image | None,
|
| 341 |
+
prior_frontal: Image.Image | None,
|
| 342 |
+
indication: str | None,
|
| 343 |
+
technique: str | None,
|
| 344 |
+
comparison: str | None,
|
| 345 |
+
prior_report: str | None,
|
| 346 |
+
get_grounding: bool = False,
|
| 347 |
+
assistant_text: str | None = None,
|
| 348 |
+
) -> tuple[str, list[Image.Image]]:
|
| 349 |
+
"""
|
| 350 |
+
This function formats the reporting prompt for the grounded and non-grounded reporting tasks from the given
|
| 351 |
+
input images and text sections. The images are normalized and stacked together in the right order.
|
| 352 |
+
|
| 353 |
+
Args:
|
| 354 |
+
current_frontal (Image.Image):
|
| 355 |
+
The current frontal image.
|
| 356 |
+
current_lateral (Image.Image | None):
|
| 357 |
+
The current lateral image.
|
| 358 |
+
prior_frontal (Image.Image | None):
|
| 359 |
+
The prior frontal image.
|
| 360 |
+
indication (str | None):
|
| 361 |
+
The indication section text.
|
| 362 |
+
technique (str | None):
|
| 363 |
+
The technique section text.
|
| 364 |
+
comparison (str | None):
|
| 365 |
+
The comparison section text.
|
| 366 |
+
prior_report (str | None):
|
| 367 |
+
The prior report section text.
|
| 368 |
+
get_grounding (bool):
|
| 369 |
+
A boolean indicating whether to construct the prompt for grounded or non-grounded reporting.
|
| 370 |
+
assistant_text (str | None): The assistant text (can be set to None for ordinary inference).
|
| 371 |
+
|
| 372 |
+
Returns:
|
| 373 |
+
tuple[str, list[Image.Image]]: The formatted prompt text and the normalized images stacked in the right order.
|
| 374 |
+
"""
|
| 375 |
+
images = self._normalize_and_stack_images(
|
| 376 |
+
current_frontal=current_frontal,
|
| 377 |
+
current_lateral=current_lateral,
|
| 378 |
+
prior_frontal=prior_frontal,
|
| 379 |
+
)
|
| 380 |
+
messages = self._construct_chat_messages_reporting(
|
| 381 |
+
has_prior=prior_frontal is not None,
|
| 382 |
+
has_lateral=current_lateral is not None,
|
| 383 |
+
indication=indication,
|
| 384 |
+
technique=technique,
|
| 385 |
+
comparison=comparison,
|
| 386 |
+
prior_report=prior_report,
|
| 387 |
+
get_grounding=get_grounding,
|
| 388 |
+
assistant_text=assistant_text,
|
| 389 |
+
)
|
| 390 |
+
add_generation_prompt = assistant_text is None
|
| 391 |
+
text = self.tokenizer.apply_chat_template(messages, add_generation_prompt=add_generation_prompt, tokenize=False)
|
| 392 |
+
return text, images
|
| 393 |
+
|
| 394 |
+
def format_phrase_grounding_input(
|
| 395 |
+
self,
|
| 396 |
+
frontal_image: Image.Image,
|
| 397 |
+
phrase: str,
|
| 398 |
+
assistant_text: str | None = None,
|
| 399 |
+
) -> tuple[str, list[Image.Image]]:
|
| 400 |
+
"""
|
| 401 |
+
This function formats the phrase grounding prompt for the phrase grounding task from the given input
|
| 402 |
+
image and phrase.
|
| 403 |
+
|
| 404 |
+
Args:
|
| 405 |
+
frontal_image (Image.Image):
|
| 406 |
+
The frontal image.
|
| 407 |
+
phrase (str):
|
| 408 |
+
The phrase to be grounded.
|
| 409 |
+
assistant_text (str | None):
|
| 410 |
+
The assistant text (can be set to None for ordinary inference).
|
| 411 |
+
|
| 412 |
+
Returns:
|
| 413 |
+
tuple[str, list[Image.Image]]: The formatted phrase grounding prompt text and the normalized image.
|
| 414 |
+
"""
|
| 415 |
+
images = self._normalize_and_stack_images(
|
| 416 |
+
current_frontal=frontal_image,
|
| 417 |
+
current_lateral=None,
|
| 418 |
+
prior_frontal=None,
|
| 419 |
+
)
|
| 420 |
+
messages = self._construct_chat_messages_phrase_grounding(phrase)
|
| 421 |
+
add_generation_prompt = assistant_text is None
|
| 422 |
+
text = self.tokenizer.apply_chat_template(messages, add_generation_prompt=add_generation_prompt, tokenize=False)
|
| 423 |
+
return text, images
|
| 424 |
+
|
| 425 |
+
def format_and_preprocess_reporting_input(
|
| 426 |
+
self,
|
| 427 |
+
current_frontal: Image.Image,
|
| 428 |
+
current_lateral: Image.Image | None,
|
| 429 |
+
prior_frontal: Image.Image | None,
|
| 430 |
+
indication: str | None,
|
| 431 |
+
technique: str | None,
|
| 432 |
+
comparison: str | None,
|
| 433 |
+
prior_report: str | None,
|
| 434 |
+
get_grounding: bool = False,
|
| 435 |
+
assistant_text: str | None = None,
|
| 436 |
+
**kwargs: Any,
|
| 437 |
+
) -> BatchFeature:
|
| 438 |
+
"""
|
| 439 |
+
This function formats and then preprocesses the input for the grounded and non-grounded reporting tasks from
|
| 440 |
+
the given input images and text sections and returns the batch feature for the model. It calls format_reporting_input
|
| 441 |
+
internally to format the input prompt and stack the images together in the right order.
|
| 442 |
+
|
| 443 |
+
Args:
|
| 444 |
+
current_frontal (Image.Image):
|
| 445 |
+
The current frontal image.
|
| 446 |
+
current_lateral (Image.Image | None):
|
| 447 |
+
The current lateral image.
|
| 448 |
+
prior_frontal (Image.Image | None):
|
| 449 |
+
The prior frontal image.
|
| 450 |
+
indication (str | None):
|
| 451 |
+
The indication section text.
|
| 452 |
+
technique (str | None):
|
| 453 |
+
The technique section text.
|
| 454 |
+
comparison (str | None):
|
| 455 |
+
The comparison section text.
|
| 456 |
+
prior_report (str | None):
|
| 457 |
+
The prior report section text.
|
| 458 |
+
get_grounding (bool):
|
| 459 |
+
A boolean indicating whether to preprocess the input for grounded or non-grounded reporting.
|
| 460 |
+
assistant_text (str | None):
|
| 461 |
+
The assistant text (can be set to None for ordinary inference).
|
| 462 |
+
|
| 463 |
+
Returns:
|
| 464 |
+
BatchFeature: The batch feature for the model, ready to be passed to the model.
|
| 465 |
+
|
| 466 |
+
"""
|
| 467 |
+
text, images = self.format_reporting_input(
|
| 468 |
+
current_frontal=current_frontal,
|
| 469 |
+
current_lateral=current_lateral,
|
| 470 |
+
prior_frontal=prior_frontal,
|
| 471 |
+
indication=indication,
|
| 472 |
+
technique=technique,
|
| 473 |
+
comparison=comparison,
|
| 474 |
+
prior_report=prior_report,
|
| 475 |
+
get_grounding=get_grounding,
|
| 476 |
+
assistant_text=assistant_text,
|
| 477 |
+
)
|
| 478 |
+
return self(text=text, images=images, **kwargs)
|
| 479 |
+
|
| 480 |
+
def format_and_preprocess_phrase_grounding_input(
|
| 481 |
+
self,
|
| 482 |
+
frontal_image: Image.Image,
|
| 483 |
+
phrase: str,
|
| 484 |
+
assistant_text: str | None = None,
|
| 485 |
+
**kwargs: Any,
|
| 486 |
+
) -> BatchFeature:
|
| 487 |
+
"""
|
| 488 |
+
This function formats and then processes the input for the phrase grounding task from the given input image and
|
| 489 |
+
phrase and returns the batch feature for the model. It calls format_phrase_grounding_input internally to format
|
| 490 |
+
the input prompt and normalize the image.
|
| 491 |
+
|
| 492 |
+
Args:
|
| 493 |
+
frontal_image (Image.Image):
|
| 494 |
+
The frontal image.
|
| 495 |
+
phrase (str):
|
| 496 |
+
The phrase to be grounded.
|
| 497 |
+
assistant_text (str | None):
|
| 498 |
+
The assistant text (can be set to None for ordinary inference).
|
| 499 |
+
|
| 500 |
+
Returns:
|
| 501 |
+
BatchFeature: The batch feature for the model, ready to be passed to the model.
|
| 502 |
+
"""
|
| 503 |
+
text, images = self.format_phrase_grounding_input(
|
| 504 |
+
frontal_image=frontal_image,
|
| 505 |
+
phrase=phrase,
|
| 506 |
+
assistant_text=assistant_text,
|
| 507 |
+
)
|
| 508 |
+
return self(text=text, images=images, **kwargs)
|
| 509 |
+
|
| 510 |
+
def _get_text_between_delimiters(self, text: str, begin_token: str, end_token: str) -> list[str]:
|
| 511 |
+
"""
|
| 512 |
+
This function splits the input text into a list of substrings beased on the given begin and end tokens.
|
| 513 |
+
|
| 514 |
+
Args:
|
| 515 |
+
text (str):
|
| 516 |
+
The input text to be split.
|
| 517 |
+
begin_token (str):
|
| 518 |
+
The begin token.
|
| 519 |
+
end_token (str):
|
| 520 |
+
The end token.
|
| 521 |
+
|
| 522 |
+
Returns:
|
| 523 |
+
list[str]: The list of substrings between the given begin and end tokens.
|
| 524 |
+
|
| 525 |
+
Example:
|
| 526 |
+
|
| 527 |
+
```python
|
| 528 |
+
>>> _get_text_between_delimiters("<obj>This is a grounded phrase</obj>. <obj>This is another grounded phrase</obj>.", "<obj>", "</obj>")
|
| 529 |
+
>>> # ["grounded phrase", "This is another grounded phrase"]
|
| 530 |
+
|
| 531 |
+
>>> _get_text_between_delimiters("<box><x10><y20><x30><y40></box><box><x50><y60><x70><y80></box>", "<box>", "</box>")
|
| 532 |
+
>>> # ["<x10><y20><x30><y40>", "<x50><y60><x70><y80>"]
|
| 533 |
+
```
|
| 534 |
+
"""
|
| 535 |
+
split_text = []
|
| 536 |
+
while begin_token in text:
|
| 537 |
+
assert text.startswith(begin_token)
|
| 538 |
+
end_index = text.find(end_token)
|
| 539 |
+
assert end_index != -1
|
| 540 |
+
split_text.append(text[len(begin_token) : end_index])
|
| 541 |
+
text = text[end_index + len(end_token) :]
|
| 542 |
+
assert len(text) == 0
|
| 543 |
+
return split_text
|
| 544 |
+
|
| 545 |
+
def convert_output_to_plaintext_or_grounded_sequence(
|
| 546 |
+
self, text: str
|
| 547 |
+
) -> str | list[tuple[str, list[BoxType] | None]]:
|
| 548 |
+
"""
|
| 549 |
+
This function converts the input text to a grounded sequence by extracting the grounded phrases and bounding
|
| 550 |
+
boxes from the text. If the text is plaintext without any grounded phrases, it returns the text as is.
|
| 551 |
+
|
| 552 |
+
Args:
|
| 553 |
+
text (str):
|
| 554 |
+
The input text to be converted.
|
| 555 |
+
|
| 556 |
+
Returns:
|
| 557 |
+
str | list[tuple[str, list[BoxType] | None]]: The grounded sequence.
|
| 558 |
+
|
| 559 |
+
Example:
|
| 560 |
+
|
| 561 |
+
```python
|
| 562 |
+
>>> convert_output_to_plaintext_or_grounded_sequence("<obj>grounded phrase <box><x55><y45><x70><y56></box></obj><obj>ungrounded phrase</obj>")
|
| 563 |
+
>>> # [
|
| 564 |
+
>>> # ("grounded phrase", [(0.55, 0.45, 0.70, 0.56)]),
|
| 565 |
+
>>> # ("ungrounded phrase", None),
|
| 566 |
+
>>> # ]
|
| 567 |
+
|
| 568 |
+
>>> convert_output_to_plaintext_or_grounded_sequence("plain text")
|
| 569 |
+
>>> # "plain text"
|
| 570 |
+
```
|
| 571 |
+
"""
|
| 572 |
+
text = text.strip()
|
| 573 |
+
|
| 574 |
+
# Plain text
|
| 575 |
+
if not any(
|
| 576 |
+
[
|
| 577 |
+
self.phrase_start_token in text,
|
| 578 |
+
self.phrase_end_token in text,
|
| 579 |
+
self.box_start_token in text,
|
| 580 |
+
self.box_end_token in text,
|
| 581 |
+
]
|
| 582 |
+
):
|
| 583 |
+
return text
|
| 584 |
+
|
| 585 |
+
# One or more grounded phrases
|
| 586 |
+
grounded_phrase_texts = self._get_text_between_delimiters(text, self.phrase_start_token, self.phrase_end_token)
|
| 587 |
+
grounded_phrases: list[tuple[str, list[BoxType] | None]] = []
|
| 588 |
+
for grounded_phrase_text in grounded_phrase_texts:
|
| 589 |
+
if self.box_start_token in grounded_phrase_text or self.box_end_token in grounded_phrase_text:
|
| 590 |
+
first_box_start_index = grounded_phrase_text.find(self.box_start_token)
|
| 591 |
+
phrase_text = grounded_phrase_text[:first_box_start_index].strip()
|
| 592 |
+
boxes_text = grounded_phrase_text[first_box_start_index:]
|
| 593 |
+
boxes_text_list = self._get_text_between_delimiters(
|
| 594 |
+
boxes_text, self.box_start_token, self.box_end_token
|
| 595 |
+
)
|
| 596 |
+
boxes: list[BoxType] = []
|
| 597 |
+
for box_text in boxes_text_list:
|
| 598 |
+
# extract from <x_><y_><x_><y_>
|
| 599 |
+
regex = r"<x(\d+?)><y(\d+?)><x(\d+?)><y(\d+?)>"
|
| 600 |
+
match = re.search(regex, box_text)
|
| 601 |
+
if match:
|
| 602 |
+
x_min, y_min, x_max, y_max = match.groups()
|
| 603 |
+
box: BoxType = tuple( # type: ignore[assignment]
|
| 604 |
+
(int(coord) + 0.5) / self.num_box_coord_bins for coord in (x_min, y_min, x_max, y_max)
|
| 605 |
+
)
|
| 606 |
+
assert all(0 <= coord <= 1 for coord in box), f"Invalid box coordinates: {box}"
|
| 607 |
+
boxes.append(box)
|
| 608 |
+
else:
|
| 609 |
+
raise ValueError(f"Invalid box coordinates: {box_text} not matching regex {regex}")
|
| 610 |
+
grounded_phrases.append((phrase_text, boxes))
|
| 611 |
+
else:
|
| 612 |
+
grounded_phrases.append((grounded_phrase_text.lstrip(), None))
|
| 613 |
+
return grounded_phrases
|
| 614 |
+
|
| 615 |
+
@staticmethod
|
| 616 |
+
def adjust_box_for_original_image_size(box: BoxType, width: int, height: int) -> BoxType:
|
| 617 |
+
"""
|
| 618 |
+
This function adjusts the bounding boxes from the MAIRA-2 model output to account for the image processor
|
| 619 |
+
cropping the image to be square prior to the model forward pass. The box coordinates are adjusted to be
|
| 620 |
+
relative to the original shape of the image assuming the image processor cropped the image based on the length
|
| 621 |
+
of the shortest side.
|
| 622 |
+
|
| 623 |
+
Args:
|
| 624 |
+
box (BoxType):
|
| 625 |
+
The box to be adjusted, normalised to (0, 1).
|
| 626 |
+
width (int):
|
| 627 |
+
Original width of the image, in pixels.
|
| 628 |
+
height (int):
|
| 629 |
+
Original height of the image, in pixels.
|
| 630 |
+
|
| 631 |
+
Returns:
|
| 632 |
+
BoxType: The box normalised relative to the original size of the image.
|
| 633 |
+
"""
|
| 634 |
+
crop_width = crop_height = min(width, height)
|
| 635 |
+
x_offset = (width - crop_width) // 2
|
| 636 |
+
y_offset = (height - crop_height) // 2
|
| 637 |
+
|
| 638 |
+
norm_x_min, norm_y_min, norm_x_max, norm_y_max = box
|
| 639 |
+
|
| 640 |
+
abs_x_min = int(norm_x_min * crop_width + x_offset)
|
| 641 |
+
abs_x_max = int(norm_x_max * crop_width + x_offset)
|
| 642 |
+
abs_y_min = int(norm_y_min * crop_height + y_offset)
|
| 643 |
+
abs_y_max = int(norm_y_max * crop_height + y_offset)
|
| 644 |
+
|
| 645 |
+
adjusted_norm_x_min = abs_x_min / width
|
| 646 |
+
adjusted_norm_x_max = abs_x_max / width
|
| 647 |
+
adjusted_norm_y_min = abs_y_min / height
|
| 648 |
+
adjusted_norm_y_max = abs_y_max / height
|
| 649 |
+
|
| 650 |
+
return (adjusted_norm_x_min, adjusted_norm_y_min, adjusted_norm_x_max, adjusted_norm_y_max)
|
| 651 |
+
|
| 652 |
+
def __call__(
|
| 653 |
+
self,
|
| 654 |
+
images: ImageInput = None,
|
| 655 |
+
text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None,
|
| 656 |
+
audio=None,
|
| 657 |
+
videos=None,
|
| 658 |
+
**kwargs: Unpack[LlavaProcessorKwargs],
|
| 659 |
+
) -> BatchFeature:
|
| 660 |
+
"""
|
| 661 |
+
Main method to prepare for the model one or several sequences(s) and image(s). This method forwards the `text`
|
| 662 |
+
and `kwargs` arguments to LlamaTokenizerFast's [`~LlamaTokenizerFast.__call__`] if `text` is not `None` to encode
|
| 663 |
+
the text. To prepare the image(s), this method forwards the `images` and `kwrags` arguments to
|
| 664 |
+
CLIPImageProcessor's [`~CLIPImageProcessor.__call__`] if `images` is not `None`. Please refer to the doctsring
|
| 665 |
+
of the above two methods for more information.
|
| 666 |
+
|
| 667 |
+
Args:
|
| 668 |
+
images (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, `List[PIL.Image.Image]`, `List[np.ndarray]`, `List[torch.Tensor]`):
|
| 669 |
+
The image or batch of images to be prepared. Each image can be a PIL image, NumPy array or PyTorch
|
| 670 |
+
tensor. Both channels-first and channels-last formats are supported.
|
| 671 |
+
text (`str`, `List[str]`, `List[List[str]]`):
|
| 672 |
+
The sequence or batch of sequences to be encoded. Each sequence can be a string or a list of strings
|
| 673 |
+
(pretokenized string). If the sequences are provided as list of strings (pretokenized), you must set
|
| 674 |
+
`is_split_into_words=True` (to lift the ambiguity with a batch of sequences).
|
| 675 |
+
return_tensors (`str` or [`~utils.TensorType`], *optional*):
|
| 676 |
+
If set, will return tensors of a particular framework. Acceptable values are:
|
| 677 |
+
- `'tf'`: Return TensorFlow `tf.constant` objects.
|
| 678 |
+
- `'pt'`: Return PyTorch `torch.Tensor` objects.
|
| 679 |
+
- `'np'`: Return NumPy `np.ndarray` objects.
|
| 680 |
+
- `'jax'`: Return JAX `jnp.ndarray` objects.
|
| 681 |
+
|
| 682 |
+
Returns:
|
| 683 |
+
[`BatchFeature`]: A [`BatchFeature`] with the following fields:
|
| 684 |
+
|
| 685 |
+
- **input_ids** -- List of token ids to be fed to a model. Returned when `text` is not `None`.
|
| 686 |
+
- **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
|
| 687 |
+
`return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
|
| 688 |
+
`None`).
|
| 689 |
+
- **pixel_values** -- Pixel values to be fed to a model. Returned when `images` is not `None`.
|
| 690 |
+
"""
|
| 691 |
+
if images is None and text is None:
|
| 692 |
+
raise ValueError("You have to specify at least one of `images` or `text`.")
|
| 693 |
+
|
| 694 |
+
# check if images and text inputs are reversed for BC
|
| 695 |
+
images, text = _validate_images_text_input_order(images, text)
|
| 696 |
+
|
| 697 |
+
output_kwargs = self._merge_kwargs(
|
| 698 |
+
LlavaProcessorKwargs,
|
| 699 |
+
tokenizer_init_kwargs=self.tokenizer.init_kwargs,
|
| 700 |
+
**kwargs,
|
| 701 |
+
)
|
| 702 |
+
if images is not None:
|
| 703 |
+
image_inputs = self.image_processor(images, **output_kwargs["images_kwargs"])
|
| 704 |
+
else:
|
| 705 |
+
image_inputs = {}
|
| 706 |
+
|
| 707 |
+
if isinstance(text, str):
|
| 708 |
+
text = [text]
|
| 709 |
+
elif not isinstance(text, list) and not isinstance(text[0], str):
|
| 710 |
+
raise ValueError("Invalid input text. Please provide a string, or a list of strings")
|
| 711 |
+
|
| 712 |
+
# try to expand inputs in processing if we have the necessary parts
|
| 713 |
+
prompt_strings = text
|
| 714 |
+
if image_inputs.get("pixel_values") is not None:
|
| 715 |
+
if self.patch_size is not None and self.vision_feature_select_strategy is not None:
|
| 716 |
+
# Replace the image token with the expanded image token sequence
|
| 717 |
+
pixel_values = image_inputs["pixel_values"]
|
| 718 |
+
height, width = get_image_size(to_numpy_array(pixel_values[0]))
|
| 719 |
+
num_image_tokens = (height // self.patch_size) * (width // self.patch_size) + 1
|
| 720 |
+
if self.vision_feature_select_strategy == "default":
|
| 721 |
+
num_image_tokens -= 1
|
| 722 |
+
|
| 723 |
+
prompt_strings = []
|
| 724 |
+
for sample in text:
|
| 725 |
+
sample = sample.replace(self.image_token, self.image_token * num_image_tokens)
|
| 726 |
+
prompt_strings.append(sample)
|
| 727 |
+
|
| 728 |
+
text_inputs = self.tokenizer(prompt_strings, **output_kwargs["text_kwargs"])
|
| 729 |
+
return BatchFeature(data={**text_inputs, **image_inputs})
|
processor_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"box_end_token": "</box>",
|
| 3 |
+
"box_start_token": "<box>",
|
| 4 |
+
"image_token": "<image>",
|
| 5 |
+
"num_box_coord_bins": 100,
|
| 6 |
+
"patch_size": 2,
|
| 7 |
+
"phrase_end_token": "</obj>",
|
| 8 |
+
"phrase_start_token": "<obj>",
|
| 9 |
+
"processor_class": "Maira2Processor",
|
| 10 |
+
"vision_feature_select_strategy": "default",
|
| 11 |
+
"auto_map": {
|
| 12 |
+
"AutoProcessor": "processing_maira2.Maira2Processor"
|
| 13 |
+
}
|
| 14 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<unk>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347
|
| 3 |
+
size 499723
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,1701 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"1": {
|
| 15 |
+
"content": "<s>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"2": {
|
| 23 |
+
"content": "</s>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
},
|
| 30 |
+
"32000": {
|
| 31 |
+
"content": "<obj>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": true,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false,
|
| 36 |
+
"special": false
|
| 37 |
+
},
|
| 38 |
+
"32001": {
|
| 39 |
+
"content": "</obj>",
|
| 40 |
+
"lstrip": false,
|
| 41 |
+
"normalized": true,
|
| 42 |
+
"rstrip": false,
|
| 43 |
+
"single_word": false,
|
| 44 |
+
"special": false
|
| 45 |
+
},
|
| 46 |
+
"32002": {
|
| 47 |
+
"content": "<x0>",
|
| 48 |
+
"lstrip": false,
|
| 49 |
+
"normalized": true,
|
| 50 |
+
"rstrip": false,
|
| 51 |
+
"single_word": false,
|
| 52 |
+
"special": false
|
| 53 |
+
},
|
| 54 |
+
"32003": {
|
| 55 |
+
"content": "<x1>",
|
| 56 |
+
"lstrip": false,
|
| 57 |
+
"normalized": true,
|
| 58 |
+
"rstrip": false,
|
| 59 |
+
"single_word": false,
|
| 60 |
+
"special": false
|
| 61 |
+
},
|
| 62 |
+
"32004": {
|
| 63 |
+
"content": "<x2>",
|
| 64 |
+
"lstrip": false,
|
| 65 |
+
"normalized": true,
|
| 66 |
+
"rstrip": false,
|
| 67 |
+
"single_word": false,
|
| 68 |
+
"special": false
|
| 69 |
+
},
|
| 70 |
+
"32005": {
|
| 71 |
+
"content": "<x3>",
|
| 72 |
+
"lstrip": false,
|
| 73 |
+
"normalized": true,
|
| 74 |
+
"rstrip": false,
|
| 75 |
+
"single_word": false,
|
| 76 |
+
"special": false
|
| 77 |
+
},
|
| 78 |
+
"32006": {
|
| 79 |
+
"content": "<x4>",
|
| 80 |
+
"lstrip": false,
|
| 81 |
+
"normalized": true,
|
| 82 |
+
"rstrip": false,
|
| 83 |
+
"single_word": false,
|
| 84 |
+
"special": false
|
| 85 |
+
},
|
| 86 |
+
"32007": {
|
| 87 |
+
"content": "<x5>",
|
| 88 |
+
"lstrip": false,
|
| 89 |
+
"normalized": true,
|
| 90 |
+
"rstrip": false,
|
| 91 |
+
"single_word": false,
|
| 92 |
+
"special": false
|
| 93 |
+
},
|
| 94 |
+
"32008": {
|
| 95 |
+
"content": "<x6>",
|
| 96 |
+
"lstrip": false,
|
| 97 |
+
"normalized": true,
|
| 98 |
+
"rstrip": false,
|
| 99 |
+
"single_word": false,
|
| 100 |
+
"special": false
|
| 101 |
+
},
|
| 102 |
+
"32009": {
|
| 103 |
+
"content": "<x7>",
|
| 104 |
+
"lstrip": false,
|
| 105 |
+
"normalized": true,
|
| 106 |
+
"rstrip": false,
|
| 107 |
+
"single_word": false,
|
| 108 |
+
"special": false
|
| 109 |
+
},
|
| 110 |
+
"32010": {
|
| 111 |
+
"content": "<x8>",
|
| 112 |
+
"lstrip": false,
|
| 113 |
+
"normalized": true,
|
| 114 |
+
"rstrip": false,
|
| 115 |
+
"single_word": false,
|
| 116 |
+
"special": false
|
| 117 |
+
},
|
| 118 |
+
"32011": {
|
| 119 |
+
"content": "<x9>",
|
| 120 |
+
"lstrip": false,
|
| 121 |
+
"normalized": true,
|
| 122 |
+
"rstrip": false,
|
| 123 |
+
"single_word": false,
|
| 124 |
+
"special": false
|
| 125 |
+
},
|
| 126 |
+
"32012": {
|
| 127 |
+
"content": "<x10>",
|
| 128 |
+
"lstrip": false,
|
| 129 |
+
"normalized": true,
|
| 130 |
+
"rstrip": false,
|
| 131 |
+
"single_word": false,
|
| 132 |
+
"special": false
|
| 133 |
+
},
|
| 134 |
+
"32013": {
|
| 135 |
+
"content": "<x11>",
|
| 136 |
+
"lstrip": false,
|
| 137 |
+
"normalized": true,
|
| 138 |
+
"rstrip": false,
|
| 139 |
+
"single_word": false,
|
| 140 |
+
"special": false
|
| 141 |
+
},
|
| 142 |
+
"32014": {
|
| 143 |
+
"content": "<x12>",
|
| 144 |
+
"lstrip": false,
|
| 145 |
+
"normalized": true,
|
| 146 |
+
"rstrip": false,
|
| 147 |
+
"single_word": false,
|
| 148 |
+
"special": false
|
| 149 |
+
},
|
| 150 |
+
"32015": {
|
| 151 |
+
"content": "<x13>",
|
| 152 |
+
"lstrip": false,
|
| 153 |
+
"normalized": true,
|
| 154 |
+
"rstrip": false,
|
| 155 |
+
"single_word": false,
|
| 156 |
+
"special": false
|
| 157 |
+
},
|
| 158 |
+
"32016": {
|
| 159 |
+
"content": "<x14>",
|
| 160 |
+
"lstrip": false,
|
| 161 |
+
"normalized": true,
|
| 162 |
+
"rstrip": false,
|
| 163 |
+
"single_word": false,
|
| 164 |
+
"special": false
|
| 165 |
+
},
|
| 166 |
+
"32017": {
|
| 167 |
+
"content": "<x15>",
|
| 168 |
+
"lstrip": false,
|
| 169 |
+
"normalized": true,
|
| 170 |
+
"rstrip": false,
|
| 171 |
+
"single_word": false,
|
| 172 |
+
"special": false
|
| 173 |
+
},
|
| 174 |
+
"32018": {
|
| 175 |
+
"content": "<x16>",
|
| 176 |
+
"lstrip": false,
|
| 177 |
+
"normalized": true,
|
| 178 |
+
"rstrip": false,
|
| 179 |
+
"single_word": false,
|
| 180 |
+
"special": false
|
| 181 |
+
},
|
| 182 |
+
"32019": {
|
| 183 |
+
"content": "<x17>",
|
| 184 |
+
"lstrip": false,
|
| 185 |
+
"normalized": true,
|
| 186 |
+
"rstrip": false,
|
| 187 |
+
"single_word": false,
|
| 188 |
+
"special": false
|
| 189 |
+
},
|
| 190 |
+
"32020": {
|
| 191 |
+
"content": "<x18>",
|
| 192 |
+
"lstrip": false,
|
| 193 |
+
"normalized": true,
|
| 194 |
+
"rstrip": false,
|
| 195 |
+
"single_word": false,
|
| 196 |
+
"special": false
|
| 197 |
+
},
|
| 198 |
+
"32021": {
|
| 199 |
+
"content": "<x19>",
|
| 200 |
+
"lstrip": false,
|
| 201 |
+
"normalized": true,
|
| 202 |
+
"rstrip": false,
|
| 203 |
+
"single_word": false,
|
| 204 |
+
"special": false
|
| 205 |
+
},
|
| 206 |
+
"32022": {
|
| 207 |
+
"content": "<x20>",
|
| 208 |
+
"lstrip": false,
|
| 209 |
+
"normalized": true,
|
| 210 |
+
"rstrip": false,
|
| 211 |
+
"single_word": false,
|
| 212 |
+
"special": false
|
| 213 |
+
},
|
| 214 |
+
"32023": {
|
| 215 |
+
"content": "<x21>",
|
| 216 |
+
"lstrip": false,
|
| 217 |
+
"normalized": true,
|
| 218 |
+
"rstrip": false,
|
| 219 |
+
"single_word": false,
|
| 220 |
+
"special": false
|
| 221 |
+
},
|
| 222 |
+
"32024": {
|
| 223 |
+
"content": "<x22>",
|
| 224 |
+
"lstrip": false,
|
| 225 |
+
"normalized": true,
|
| 226 |
+
"rstrip": false,
|
| 227 |
+
"single_word": false,
|
| 228 |
+
"special": false
|
| 229 |
+
},
|
| 230 |
+
"32025": {
|
| 231 |
+
"content": "<x23>",
|
| 232 |
+
"lstrip": false,
|
| 233 |
+
"normalized": true,
|
| 234 |
+
"rstrip": false,
|
| 235 |
+
"single_word": false,
|
| 236 |
+
"special": false
|
| 237 |
+
},
|
| 238 |
+
"32026": {
|
| 239 |
+
"content": "<x24>",
|
| 240 |
+
"lstrip": false,
|
| 241 |
+
"normalized": true,
|
| 242 |
+
"rstrip": false,
|
| 243 |
+
"single_word": false,
|
| 244 |
+
"special": false
|
| 245 |
+
},
|
| 246 |
+
"32027": {
|
| 247 |
+
"content": "<x25>",
|
| 248 |
+
"lstrip": false,
|
| 249 |
+
"normalized": true,
|
| 250 |
+
"rstrip": false,
|
| 251 |
+
"single_word": false,
|
| 252 |
+
"special": false
|
| 253 |
+
},
|
| 254 |
+
"32028": {
|
| 255 |
+
"content": "<x26>",
|
| 256 |
+
"lstrip": false,
|
| 257 |
+
"normalized": true,
|
| 258 |
+
"rstrip": false,
|
| 259 |
+
"single_word": false,
|
| 260 |
+
"special": false
|
| 261 |
+
},
|
| 262 |
+
"32029": {
|
| 263 |
+
"content": "<x27>",
|
| 264 |
+
"lstrip": false,
|
| 265 |
+
"normalized": true,
|
| 266 |
+
"rstrip": false,
|
| 267 |
+
"single_word": false,
|
| 268 |
+
"special": false
|
| 269 |
+
},
|
| 270 |
+
"32030": {
|
| 271 |
+
"content": "<x28>",
|
| 272 |
+
"lstrip": false,
|
| 273 |
+
"normalized": true,
|
| 274 |
+
"rstrip": false,
|
| 275 |
+
"single_word": false,
|
| 276 |
+
"special": false
|
| 277 |
+
},
|
| 278 |
+
"32031": {
|
| 279 |
+
"content": "<x29>",
|
| 280 |
+
"lstrip": false,
|
| 281 |
+
"normalized": true,
|
| 282 |
+
"rstrip": false,
|
| 283 |
+
"single_word": false,
|
| 284 |
+
"special": false
|
| 285 |
+
},
|
| 286 |
+
"32032": {
|
| 287 |
+
"content": "<x30>",
|
| 288 |
+
"lstrip": false,
|
| 289 |
+
"normalized": true,
|
| 290 |
+
"rstrip": false,
|
| 291 |
+
"single_word": false,
|
| 292 |
+
"special": false
|
| 293 |
+
},
|
| 294 |
+
"32033": {
|
| 295 |
+
"content": "<x31>",
|
| 296 |
+
"lstrip": false,
|
| 297 |
+
"normalized": true,
|
| 298 |
+
"rstrip": false,
|
| 299 |
+
"single_word": false,
|
| 300 |
+
"special": false
|
| 301 |
+
},
|
| 302 |
+
"32034": {
|
| 303 |
+
"content": "<x32>",
|
| 304 |
+
"lstrip": false,
|
| 305 |
+
"normalized": true,
|
| 306 |
+
"rstrip": false,
|
| 307 |
+
"single_word": false,
|
| 308 |
+
"special": false
|
| 309 |
+
},
|
| 310 |
+
"32035": {
|
| 311 |
+
"content": "<x33>",
|
| 312 |
+
"lstrip": false,
|
| 313 |
+
"normalized": true,
|
| 314 |
+
"rstrip": false,
|
| 315 |
+
"single_word": false,
|
| 316 |
+
"special": false
|
| 317 |
+
},
|
| 318 |
+
"32036": {
|
| 319 |
+
"content": "<x34>",
|
| 320 |
+
"lstrip": false,
|
| 321 |
+
"normalized": true,
|
| 322 |
+
"rstrip": false,
|
| 323 |
+
"single_word": false,
|
| 324 |
+
"special": false
|
| 325 |
+
},
|
| 326 |
+
"32037": {
|
| 327 |
+
"content": "<x35>",
|
| 328 |
+
"lstrip": false,
|
| 329 |
+
"normalized": true,
|
| 330 |
+
"rstrip": false,
|
| 331 |
+
"single_word": false,
|
| 332 |
+
"special": false
|
| 333 |
+
},
|
| 334 |
+
"32038": {
|
| 335 |
+
"content": "<x36>",
|
| 336 |
+
"lstrip": false,
|
| 337 |
+
"normalized": true,
|
| 338 |
+
"rstrip": false,
|
| 339 |
+
"single_word": false,
|
| 340 |
+
"special": false
|
| 341 |
+
},
|
| 342 |
+
"32039": {
|
| 343 |
+
"content": "<x37>",
|
| 344 |
+
"lstrip": false,
|
| 345 |
+
"normalized": true,
|
| 346 |
+
"rstrip": false,
|
| 347 |
+
"single_word": false,
|
| 348 |
+
"special": false
|
| 349 |
+
},
|
| 350 |
+
"32040": {
|
| 351 |
+
"content": "<x38>",
|
| 352 |
+
"lstrip": false,
|
| 353 |
+
"normalized": true,
|
| 354 |
+
"rstrip": false,
|
| 355 |
+
"single_word": false,
|
| 356 |
+
"special": false
|
| 357 |
+
},
|
| 358 |
+
"32041": {
|
| 359 |
+
"content": "<x39>",
|
| 360 |
+
"lstrip": false,
|
| 361 |
+
"normalized": true,
|
| 362 |
+
"rstrip": false,
|
| 363 |
+
"single_word": false,
|
| 364 |
+
"special": false
|
| 365 |
+
},
|
| 366 |
+
"32042": {
|
| 367 |
+
"content": "<x40>",
|
| 368 |
+
"lstrip": false,
|
| 369 |
+
"normalized": true,
|
| 370 |
+
"rstrip": false,
|
| 371 |
+
"single_word": false,
|
| 372 |
+
"special": false
|
| 373 |
+
},
|
| 374 |
+
"32043": {
|
| 375 |
+
"content": "<x41>",
|
| 376 |
+
"lstrip": false,
|
| 377 |
+
"normalized": true,
|
| 378 |
+
"rstrip": false,
|
| 379 |
+
"single_word": false,
|
| 380 |
+
"special": false
|
| 381 |
+
},
|
| 382 |
+
"32044": {
|
| 383 |
+
"content": "<x42>",
|
| 384 |
+
"lstrip": false,
|
| 385 |
+
"normalized": true,
|
| 386 |
+
"rstrip": false,
|
| 387 |
+
"single_word": false,
|
| 388 |
+
"special": false
|
| 389 |
+
},
|
| 390 |
+
"32045": {
|
| 391 |
+
"content": "<x43>",
|
| 392 |
+
"lstrip": false,
|
| 393 |
+
"normalized": true,
|
| 394 |
+
"rstrip": false,
|
| 395 |
+
"single_word": false,
|
| 396 |
+
"special": false
|
| 397 |
+
},
|
| 398 |
+
"32046": {
|
| 399 |
+
"content": "<x44>",
|
| 400 |
+
"lstrip": false,
|
| 401 |
+
"normalized": true,
|
| 402 |
+
"rstrip": false,
|
| 403 |
+
"single_word": false,
|
| 404 |
+
"special": false
|
| 405 |
+
},
|
| 406 |
+
"32047": {
|
| 407 |
+
"content": "<x45>",
|
| 408 |
+
"lstrip": false,
|
| 409 |
+
"normalized": true,
|
| 410 |
+
"rstrip": false,
|
| 411 |
+
"single_word": false,
|
| 412 |
+
"special": false
|
| 413 |
+
},
|
| 414 |
+
"32048": {
|
| 415 |
+
"content": "<x46>",
|
| 416 |
+
"lstrip": false,
|
| 417 |
+
"normalized": true,
|
| 418 |
+
"rstrip": false,
|
| 419 |
+
"single_word": false,
|
| 420 |
+
"special": false
|
| 421 |
+
},
|
| 422 |
+
"32049": {
|
| 423 |
+
"content": "<x47>",
|
| 424 |
+
"lstrip": false,
|
| 425 |
+
"normalized": true,
|
| 426 |
+
"rstrip": false,
|
| 427 |
+
"single_word": false,
|
| 428 |
+
"special": false
|
| 429 |
+
},
|
| 430 |
+
"32050": {
|
| 431 |
+
"content": "<x48>",
|
| 432 |
+
"lstrip": false,
|
| 433 |
+
"normalized": true,
|
| 434 |
+
"rstrip": false,
|
| 435 |
+
"single_word": false,
|
| 436 |
+
"special": false
|
| 437 |
+
},
|
| 438 |
+
"32051": {
|
| 439 |
+
"content": "<x49>",
|
| 440 |
+
"lstrip": false,
|
| 441 |
+
"normalized": true,
|
| 442 |
+
"rstrip": false,
|
| 443 |
+
"single_word": false,
|
| 444 |
+
"special": false
|
| 445 |
+
},
|
| 446 |
+
"32052": {
|
| 447 |
+
"content": "<x50>",
|
| 448 |
+
"lstrip": false,
|
| 449 |
+
"normalized": true,
|
| 450 |
+
"rstrip": false,
|
| 451 |
+
"single_word": false,
|
| 452 |
+
"special": false
|
| 453 |
+
},
|
| 454 |
+
"32053": {
|
| 455 |
+
"content": "<x51>",
|
| 456 |
+
"lstrip": false,
|
| 457 |
+
"normalized": true,
|
| 458 |
+
"rstrip": false,
|
| 459 |
+
"single_word": false,
|
| 460 |
+
"special": false
|
| 461 |
+
},
|
| 462 |
+
"32054": {
|
| 463 |
+
"content": "<x52>",
|
| 464 |
+
"lstrip": false,
|
| 465 |
+
"normalized": true,
|
| 466 |
+
"rstrip": false,
|
| 467 |
+
"single_word": false,
|
| 468 |
+
"special": false
|
| 469 |
+
},
|
| 470 |
+
"32055": {
|
| 471 |
+
"content": "<x53>",
|
| 472 |
+
"lstrip": false,
|
| 473 |
+
"normalized": true,
|
| 474 |
+
"rstrip": false,
|
| 475 |
+
"single_word": false,
|
| 476 |
+
"special": false
|
| 477 |
+
},
|
| 478 |
+
"32056": {
|
| 479 |
+
"content": "<x54>",
|
| 480 |
+
"lstrip": false,
|
| 481 |
+
"normalized": true,
|
| 482 |
+
"rstrip": false,
|
| 483 |
+
"single_word": false,
|
| 484 |
+
"special": false
|
| 485 |
+
},
|
| 486 |
+
"32057": {
|
| 487 |
+
"content": "<x55>",
|
| 488 |
+
"lstrip": false,
|
| 489 |
+
"normalized": true,
|
| 490 |
+
"rstrip": false,
|
| 491 |
+
"single_word": false,
|
| 492 |
+
"special": false
|
| 493 |
+
},
|
| 494 |
+
"32058": {
|
| 495 |
+
"content": "<x56>",
|
| 496 |
+
"lstrip": false,
|
| 497 |
+
"normalized": true,
|
| 498 |
+
"rstrip": false,
|
| 499 |
+
"single_word": false,
|
| 500 |
+
"special": false
|
| 501 |
+
},
|
| 502 |
+
"32059": {
|
| 503 |
+
"content": "<x57>",
|
| 504 |
+
"lstrip": false,
|
| 505 |
+
"normalized": true,
|
| 506 |
+
"rstrip": false,
|
| 507 |
+
"single_word": false,
|
| 508 |
+
"special": false
|
| 509 |
+
},
|
| 510 |
+
"32060": {
|
| 511 |
+
"content": "<x58>",
|
| 512 |
+
"lstrip": false,
|
| 513 |
+
"normalized": true,
|
| 514 |
+
"rstrip": false,
|
| 515 |
+
"single_word": false,
|
| 516 |
+
"special": false
|
| 517 |
+
},
|
| 518 |
+
"32061": {
|
| 519 |
+
"content": "<x59>",
|
| 520 |
+
"lstrip": false,
|
| 521 |
+
"normalized": true,
|
| 522 |
+
"rstrip": false,
|
| 523 |
+
"single_word": false,
|
| 524 |
+
"special": false
|
| 525 |
+
},
|
| 526 |
+
"32062": {
|
| 527 |
+
"content": "<x60>",
|
| 528 |
+
"lstrip": false,
|
| 529 |
+
"normalized": true,
|
| 530 |
+
"rstrip": false,
|
| 531 |
+
"single_word": false,
|
| 532 |
+
"special": false
|
| 533 |
+
},
|
| 534 |
+
"32063": {
|
| 535 |
+
"content": "<x61>",
|
| 536 |
+
"lstrip": false,
|
| 537 |
+
"normalized": true,
|
| 538 |
+
"rstrip": false,
|
| 539 |
+
"single_word": false,
|
| 540 |
+
"special": false
|
| 541 |
+
},
|
| 542 |
+
"32064": {
|
| 543 |
+
"content": "<x62>",
|
| 544 |
+
"lstrip": false,
|
| 545 |
+
"normalized": true,
|
| 546 |
+
"rstrip": false,
|
| 547 |
+
"single_word": false,
|
| 548 |
+
"special": false
|
| 549 |
+
},
|
| 550 |
+
"32065": {
|
| 551 |
+
"content": "<x63>",
|
| 552 |
+
"lstrip": false,
|
| 553 |
+
"normalized": true,
|
| 554 |
+
"rstrip": false,
|
| 555 |
+
"single_word": false,
|
| 556 |
+
"special": false
|
| 557 |
+
},
|
| 558 |
+
"32066": {
|
| 559 |
+
"content": "<x64>",
|
| 560 |
+
"lstrip": false,
|
| 561 |
+
"normalized": true,
|
| 562 |
+
"rstrip": false,
|
| 563 |
+
"single_word": false,
|
| 564 |
+
"special": false
|
| 565 |
+
},
|
| 566 |
+
"32067": {
|
| 567 |
+
"content": "<x65>",
|
| 568 |
+
"lstrip": false,
|
| 569 |
+
"normalized": true,
|
| 570 |
+
"rstrip": false,
|
| 571 |
+
"single_word": false,
|
| 572 |
+
"special": false
|
| 573 |
+
},
|
| 574 |
+
"32068": {
|
| 575 |
+
"content": "<x66>",
|
| 576 |
+
"lstrip": false,
|
| 577 |
+
"normalized": true,
|
| 578 |
+
"rstrip": false,
|
| 579 |
+
"single_word": false,
|
| 580 |
+
"special": false
|
| 581 |
+
},
|
| 582 |
+
"32069": {
|
| 583 |
+
"content": "<x67>",
|
| 584 |
+
"lstrip": false,
|
| 585 |
+
"normalized": true,
|
| 586 |
+
"rstrip": false,
|
| 587 |
+
"single_word": false,
|
| 588 |
+
"special": false
|
| 589 |
+
},
|
| 590 |
+
"32070": {
|
| 591 |
+
"content": "<x68>",
|
| 592 |
+
"lstrip": false,
|
| 593 |
+
"normalized": true,
|
| 594 |
+
"rstrip": false,
|
| 595 |
+
"single_word": false,
|
| 596 |
+
"special": false
|
| 597 |
+
},
|
| 598 |
+
"32071": {
|
| 599 |
+
"content": "<x69>",
|
| 600 |
+
"lstrip": false,
|
| 601 |
+
"normalized": true,
|
| 602 |
+
"rstrip": false,
|
| 603 |
+
"single_word": false,
|
| 604 |
+
"special": false
|
| 605 |
+
},
|
| 606 |
+
"32072": {
|
| 607 |
+
"content": "<x70>",
|
| 608 |
+
"lstrip": false,
|
| 609 |
+
"normalized": true,
|
| 610 |
+
"rstrip": false,
|
| 611 |
+
"single_word": false,
|
| 612 |
+
"special": false
|
| 613 |
+
},
|
| 614 |
+
"32073": {
|
| 615 |
+
"content": "<x71>",
|
| 616 |
+
"lstrip": false,
|
| 617 |
+
"normalized": true,
|
| 618 |
+
"rstrip": false,
|
| 619 |
+
"single_word": false,
|
| 620 |
+
"special": false
|
| 621 |
+
},
|
| 622 |
+
"32074": {
|
| 623 |
+
"content": "<x72>",
|
| 624 |
+
"lstrip": false,
|
| 625 |
+
"normalized": true,
|
| 626 |
+
"rstrip": false,
|
| 627 |
+
"single_word": false,
|
| 628 |
+
"special": false
|
| 629 |
+
},
|
| 630 |
+
"32075": {
|
| 631 |
+
"content": "<x73>",
|
| 632 |
+
"lstrip": false,
|
| 633 |
+
"normalized": true,
|
| 634 |
+
"rstrip": false,
|
| 635 |
+
"single_word": false,
|
| 636 |
+
"special": false
|
| 637 |
+
},
|
| 638 |
+
"32076": {
|
| 639 |
+
"content": "<x74>",
|
| 640 |
+
"lstrip": false,
|
| 641 |
+
"normalized": true,
|
| 642 |
+
"rstrip": false,
|
| 643 |
+
"single_word": false,
|
| 644 |
+
"special": false
|
| 645 |
+
},
|
| 646 |
+
"32077": {
|
| 647 |
+
"content": "<x75>",
|
| 648 |
+
"lstrip": false,
|
| 649 |
+
"normalized": true,
|
| 650 |
+
"rstrip": false,
|
| 651 |
+
"single_word": false,
|
| 652 |
+
"special": false
|
| 653 |
+
},
|
| 654 |
+
"32078": {
|
| 655 |
+
"content": "<x76>",
|
| 656 |
+
"lstrip": false,
|
| 657 |
+
"normalized": true,
|
| 658 |
+
"rstrip": false,
|
| 659 |
+
"single_word": false,
|
| 660 |
+
"special": false
|
| 661 |
+
},
|
| 662 |
+
"32079": {
|
| 663 |
+
"content": "<x77>",
|
| 664 |
+
"lstrip": false,
|
| 665 |
+
"normalized": true,
|
| 666 |
+
"rstrip": false,
|
| 667 |
+
"single_word": false,
|
| 668 |
+
"special": false
|
| 669 |
+
},
|
| 670 |
+
"32080": {
|
| 671 |
+
"content": "<x78>",
|
| 672 |
+
"lstrip": false,
|
| 673 |
+
"normalized": true,
|
| 674 |
+
"rstrip": false,
|
| 675 |
+
"single_word": false,
|
| 676 |
+
"special": false
|
| 677 |
+
},
|
| 678 |
+
"32081": {
|
| 679 |
+
"content": "<x79>",
|
| 680 |
+
"lstrip": false,
|
| 681 |
+
"normalized": true,
|
| 682 |
+
"rstrip": false,
|
| 683 |
+
"single_word": false,
|
| 684 |
+
"special": false
|
| 685 |
+
},
|
| 686 |
+
"32082": {
|
| 687 |
+
"content": "<x80>",
|
| 688 |
+
"lstrip": false,
|
| 689 |
+
"normalized": true,
|
| 690 |
+
"rstrip": false,
|
| 691 |
+
"single_word": false,
|
| 692 |
+
"special": false
|
| 693 |
+
},
|
| 694 |
+
"32083": {
|
| 695 |
+
"content": "<x81>",
|
| 696 |
+
"lstrip": false,
|
| 697 |
+
"normalized": true,
|
| 698 |
+
"rstrip": false,
|
| 699 |
+
"single_word": false,
|
| 700 |
+
"special": false
|
| 701 |
+
},
|
| 702 |
+
"32084": {
|
| 703 |
+
"content": "<x82>",
|
| 704 |
+
"lstrip": false,
|
| 705 |
+
"normalized": true,
|
| 706 |
+
"rstrip": false,
|
| 707 |
+
"single_word": false,
|
| 708 |
+
"special": false
|
| 709 |
+
},
|
| 710 |
+
"32085": {
|
| 711 |
+
"content": "<x83>",
|
| 712 |
+
"lstrip": false,
|
| 713 |
+
"normalized": true,
|
| 714 |
+
"rstrip": false,
|
| 715 |
+
"single_word": false,
|
| 716 |
+
"special": false
|
| 717 |
+
},
|
| 718 |
+
"32086": {
|
| 719 |
+
"content": "<x84>",
|
| 720 |
+
"lstrip": false,
|
| 721 |
+
"normalized": true,
|
| 722 |
+
"rstrip": false,
|
| 723 |
+
"single_word": false,
|
| 724 |
+
"special": false
|
| 725 |
+
},
|
| 726 |
+
"32087": {
|
| 727 |
+
"content": "<x85>",
|
| 728 |
+
"lstrip": false,
|
| 729 |
+
"normalized": true,
|
| 730 |
+
"rstrip": false,
|
| 731 |
+
"single_word": false,
|
| 732 |
+
"special": false
|
| 733 |
+
},
|
| 734 |
+
"32088": {
|
| 735 |
+
"content": "<x86>",
|
| 736 |
+
"lstrip": false,
|
| 737 |
+
"normalized": true,
|
| 738 |
+
"rstrip": false,
|
| 739 |
+
"single_word": false,
|
| 740 |
+
"special": false
|
| 741 |
+
},
|
| 742 |
+
"32089": {
|
| 743 |
+
"content": "<x87>",
|
| 744 |
+
"lstrip": false,
|
| 745 |
+
"normalized": true,
|
| 746 |
+
"rstrip": false,
|
| 747 |
+
"single_word": false,
|
| 748 |
+
"special": false
|
| 749 |
+
},
|
| 750 |
+
"32090": {
|
| 751 |
+
"content": "<x88>",
|
| 752 |
+
"lstrip": false,
|
| 753 |
+
"normalized": true,
|
| 754 |
+
"rstrip": false,
|
| 755 |
+
"single_word": false,
|
| 756 |
+
"special": false
|
| 757 |
+
},
|
| 758 |
+
"32091": {
|
| 759 |
+
"content": "<x89>",
|
| 760 |
+
"lstrip": false,
|
| 761 |
+
"normalized": true,
|
| 762 |
+
"rstrip": false,
|
| 763 |
+
"single_word": false,
|
| 764 |
+
"special": false
|
| 765 |
+
},
|
| 766 |
+
"32092": {
|
| 767 |
+
"content": "<x90>",
|
| 768 |
+
"lstrip": false,
|
| 769 |
+
"normalized": true,
|
| 770 |
+
"rstrip": false,
|
| 771 |
+
"single_word": false,
|
| 772 |
+
"special": false
|
| 773 |
+
},
|
| 774 |
+
"32093": {
|
| 775 |
+
"content": "<x91>",
|
| 776 |
+
"lstrip": false,
|
| 777 |
+
"normalized": true,
|
| 778 |
+
"rstrip": false,
|
| 779 |
+
"single_word": false,
|
| 780 |
+
"special": false
|
| 781 |
+
},
|
| 782 |
+
"32094": {
|
| 783 |
+
"content": "<x92>",
|
| 784 |
+
"lstrip": false,
|
| 785 |
+
"normalized": true,
|
| 786 |
+
"rstrip": false,
|
| 787 |
+
"single_word": false,
|
| 788 |
+
"special": false
|
| 789 |
+
},
|
| 790 |
+
"32095": {
|
| 791 |
+
"content": "<x93>",
|
| 792 |
+
"lstrip": false,
|
| 793 |
+
"normalized": true,
|
| 794 |
+
"rstrip": false,
|
| 795 |
+
"single_word": false,
|
| 796 |
+
"special": false
|
| 797 |
+
},
|
| 798 |
+
"32096": {
|
| 799 |
+
"content": "<x94>",
|
| 800 |
+
"lstrip": false,
|
| 801 |
+
"normalized": true,
|
| 802 |
+
"rstrip": false,
|
| 803 |
+
"single_word": false,
|
| 804 |
+
"special": false
|
| 805 |
+
},
|
| 806 |
+
"32097": {
|
| 807 |
+
"content": "<x95>",
|
| 808 |
+
"lstrip": false,
|
| 809 |
+
"normalized": true,
|
| 810 |
+
"rstrip": false,
|
| 811 |
+
"single_word": false,
|
| 812 |
+
"special": false
|
| 813 |
+
},
|
| 814 |
+
"32098": {
|
| 815 |
+
"content": "<x96>",
|
| 816 |
+
"lstrip": false,
|
| 817 |
+
"normalized": true,
|
| 818 |
+
"rstrip": false,
|
| 819 |
+
"single_word": false,
|
| 820 |
+
"special": false
|
| 821 |
+
},
|
| 822 |
+
"32099": {
|
| 823 |
+
"content": "<x97>",
|
| 824 |
+
"lstrip": false,
|
| 825 |
+
"normalized": true,
|
| 826 |
+
"rstrip": false,
|
| 827 |
+
"single_word": false,
|
| 828 |
+
"special": false
|
| 829 |
+
},
|
| 830 |
+
"32100": {
|
| 831 |
+
"content": "<x98>",
|
| 832 |
+
"lstrip": false,
|
| 833 |
+
"normalized": true,
|
| 834 |
+
"rstrip": false,
|
| 835 |
+
"single_word": false,
|
| 836 |
+
"special": false
|
| 837 |
+
},
|
| 838 |
+
"32101": {
|
| 839 |
+
"content": "<x99>",
|
| 840 |
+
"lstrip": false,
|
| 841 |
+
"normalized": true,
|
| 842 |
+
"rstrip": false,
|
| 843 |
+
"single_word": false,
|
| 844 |
+
"special": false
|
| 845 |
+
},
|
| 846 |
+
"32102": {
|
| 847 |
+
"content": "<y0>",
|
| 848 |
+
"lstrip": false,
|
| 849 |
+
"normalized": true,
|
| 850 |
+
"rstrip": false,
|
| 851 |
+
"single_word": false,
|
| 852 |
+
"special": false
|
| 853 |
+
},
|
| 854 |
+
"32103": {
|
| 855 |
+
"content": "<y1>",
|
| 856 |
+
"lstrip": false,
|
| 857 |
+
"normalized": true,
|
| 858 |
+
"rstrip": false,
|
| 859 |
+
"single_word": false,
|
| 860 |
+
"special": false
|
| 861 |
+
},
|
| 862 |
+
"32104": {
|
| 863 |
+
"content": "<y2>",
|
| 864 |
+
"lstrip": false,
|
| 865 |
+
"normalized": true,
|
| 866 |
+
"rstrip": false,
|
| 867 |
+
"single_word": false,
|
| 868 |
+
"special": false
|
| 869 |
+
},
|
| 870 |
+
"32105": {
|
| 871 |
+
"content": "<y3>",
|
| 872 |
+
"lstrip": false,
|
| 873 |
+
"normalized": true,
|
| 874 |
+
"rstrip": false,
|
| 875 |
+
"single_word": false,
|
| 876 |
+
"special": false
|
| 877 |
+
},
|
| 878 |
+
"32106": {
|
| 879 |
+
"content": "<y4>",
|
| 880 |
+
"lstrip": false,
|
| 881 |
+
"normalized": true,
|
| 882 |
+
"rstrip": false,
|
| 883 |
+
"single_word": false,
|
| 884 |
+
"special": false
|
| 885 |
+
},
|
| 886 |
+
"32107": {
|
| 887 |
+
"content": "<y5>",
|
| 888 |
+
"lstrip": false,
|
| 889 |
+
"normalized": true,
|
| 890 |
+
"rstrip": false,
|
| 891 |
+
"single_word": false,
|
| 892 |
+
"special": false
|
| 893 |
+
},
|
| 894 |
+
"32108": {
|
| 895 |
+
"content": "<y6>",
|
| 896 |
+
"lstrip": false,
|
| 897 |
+
"normalized": true,
|
| 898 |
+
"rstrip": false,
|
| 899 |
+
"single_word": false,
|
| 900 |
+
"special": false
|
| 901 |
+
},
|
| 902 |
+
"32109": {
|
| 903 |
+
"content": "<y7>",
|
| 904 |
+
"lstrip": false,
|
| 905 |
+
"normalized": true,
|
| 906 |
+
"rstrip": false,
|
| 907 |
+
"single_word": false,
|
| 908 |
+
"special": false
|
| 909 |
+
},
|
| 910 |
+
"32110": {
|
| 911 |
+
"content": "<y8>",
|
| 912 |
+
"lstrip": false,
|
| 913 |
+
"normalized": true,
|
| 914 |
+
"rstrip": false,
|
| 915 |
+
"single_word": false,
|
| 916 |
+
"special": false
|
| 917 |
+
},
|
| 918 |
+
"32111": {
|
| 919 |
+
"content": "<y9>",
|
| 920 |
+
"lstrip": false,
|
| 921 |
+
"normalized": true,
|
| 922 |
+
"rstrip": false,
|
| 923 |
+
"single_word": false,
|
| 924 |
+
"special": false
|
| 925 |
+
},
|
| 926 |
+
"32112": {
|
| 927 |
+
"content": "<y10>",
|
| 928 |
+
"lstrip": false,
|
| 929 |
+
"normalized": true,
|
| 930 |
+
"rstrip": false,
|
| 931 |
+
"single_word": false,
|
| 932 |
+
"special": false
|
| 933 |
+
},
|
| 934 |
+
"32113": {
|
| 935 |
+
"content": "<y11>",
|
| 936 |
+
"lstrip": false,
|
| 937 |
+
"normalized": true,
|
| 938 |
+
"rstrip": false,
|
| 939 |
+
"single_word": false,
|
| 940 |
+
"special": false
|
| 941 |
+
},
|
| 942 |
+
"32114": {
|
| 943 |
+
"content": "<y12>",
|
| 944 |
+
"lstrip": false,
|
| 945 |
+
"normalized": true,
|
| 946 |
+
"rstrip": false,
|
| 947 |
+
"single_word": false,
|
| 948 |
+
"special": false
|
| 949 |
+
},
|
| 950 |
+
"32115": {
|
| 951 |
+
"content": "<y13>",
|
| 952 |
+
"lstrip": false,
|
| 953 |
+
"normalized": true,
|
| 954 |
+
"rstrip": false,
|
| 955 |
+
"single_word": false,
|
| 956 |
+
"special": false
|
| 957 |
+
},
|
| 958 |
+
"32116": {
|
| 959 |
+
"content": "<y14>",
|
| 960 |
+
"lstrip": false,
|
| 961 |
+
"normalized": true,
|
| 962 |
+
"rstrip": false,
|
| 963 |
+
"single_word": false,
|
| 964 |
+
"special": false
|
| 965 |
+
},
|
| 966 |
+
"32117": {
|
| 967 |
+
"content": "<y15>",
|
| 968 |
+
"lstrip": false,
|
| 969 |
+
"normalized": true,
|
| 970 |
+
"rstrip": false,
|
| 971 |
+
"single_word": false,
|
| 972 |
+
"special": false
|
| 973 |
+
},
|
| 974 |
+
"32118": {
|
| 975 |
+
"content": "<y16>",
|
| 976 |
+
"lstrip": false,
|
| 977 |
+
"normalized": true,
|
| 978 |
+
"rstrip": false,
|
| 979 |
+
"single_word": false,
|
| 980 |
+
"special": false
|
| 981 |
+
},
|
| 982 |
+
"32119": {
|
| 983 |
+
"content": "<y17>",
|
| 984 |
+
"lstrip": false,
|
| 985 |
+
"normalized": true,
|
| 986 |
+
"rstrip": false,
|
| 987 |
+
"single_word": false,
|
| 988 |
+
"special": false
|
| 989 |
+
},
|
| 990 |
+
"32120": {
|
| 991 |
+
"content": "<y18>",
|
| 992 |
+
"lstrip": false,
|
| 993 |
+
"normalized": true,
|
| 994 |
+
"rstrip": false,
|
| 995 |
+
"single_word": false,
|
| 996 |
+
"special": false
|
| 997 |
+
},
|
| 998 |
+
"32121": {
|
| 999 |
+
"content": "<y19>",
|
| 1000 |
+
"lstrip": false,
|
| 1001 |
+
"normalized": true,
|
| 1002 |
+
"rstrip": false,
|
| 1003 |
+
"single_word": false,
|
| 1004 |
+
"special": false
|
| 1005 |
+
},
|
| 1006 |
+
"32122": {
|
| 1007 |
+
"content": "<y20>",
|
| 1008 |
+
"lstrip": false,
|
| 1009 |
+
"normalized": true,
|
| 1010 |
+
"rstrip": false,
|
| 1011 |
+
"single_word": false,
|
| 1012 |
+
"special": false
|
| 1013 |
+
},
|
| 1014 |
+
"32123": {
|
| 1015 |
+
"content": "<y21>",
|
| 1016 |
+
"lstrip": false,
|
| 1017 |
+
"normalized": true,
|
| 1018 |
+
"rstrip": false,
|
| 1019 |
+
"single_word": false,
|
| 1020 |
+
"special": false
|
| 1021 |
+
},
|
| 1022 |
+
"32124": {
|
| 1023 |
+
"content": "<y22>",
|
| 1024 |
+
"lstrip": false,
|
| 1025 |
+
"normalized": true,
|
| 1026 |
+
"rstrip": false,
|
| 1027 |
+
"single_word": false,
|
| 1028 |
+
"special": false
|
| 1029 |
+
},
|
| 1030 |
+
"32125": {
|
| 1031 |
+
"content": "<y23>",
|
| 1032 |
+
"lstrip": false,
|
| 1033 |
+
"normalized": true,
|
| 1034 |
+
"rstrip": false,
|
| 1035 |
+
"single_word": false,
|
| 1036 |
+
"special": false
|
| 1037 |
+
},
|
| 1038 |
+
"32126": {
|
| 1039 |
+
"content": "<y24>",
|
| 1040 |
+
"lstrip": false,
|
| 1041 |
+
"normalized": true,
|
| 1042 |
+
"rstrip": false,
|
| 1043 |
+
"single_word": false,
|
| 1044 |
+
"special": false
|
| 1045 |
+
},
|
| 1046 |
+
"32127": {
|
| 1047 |
+
"content": "<y25>",
|
| 1048 |
+
"lstrip": false,
|
| 1049 |
+
"normalized": true,
|
| 1050 |
+
"rstrip": false,
|
| 1051 |
+
"single_word": false,
|
| 1052 |
+
"special": false
|
| 1053 |
+
},
|
| 1054 |
+
"32128": {
|
| 1055 |
+
"content": "<y26>",
|
| 1056 |
+
"lstrip": false,
|
| 1057 |
+
"normalized": true,
|
| 1058 |
+
"rstrip": false,
|
| 1059 |
+
"single_word": false,
|
| 1060 |
+
"special": false
|
| 1061 |
+
},
|
| 1062 |
+
"32129": {
|
| 1063 |
+
"content": "<y27>",
|
| 1064 |
+
"lstrip": false,
|
| 1065 |
+
"normalized": true,
|
| 1066 |
+
"rstrip": false,
|
| 1067 |
+
"single_word": false,
|
| 1068 |
+
"special": false
|
| 1069 |
+
},
|
| 1070 |
+
"32130": {
|
| 1071 |
+
"content": "<y28>",
|
| 1072 |
+
"lstrip": false,
|
| 1073 |
+
"normalized": true,
|
| 1074 |
+
"rstrip": false,
|
| 1075 |
+
"single_word": false,
|
| 1076 |
+
"special": false
|
| 1077 |
+
},
|
| 1078 |
+
"32131": {
|
| 1079 |
+
"content": "<y29>",
|
| 1080 |
+
"lstrip": false,
|
| 1081 |
+
"normalized": true,
|
| 1082 |
+
"rstrip": false,
|
| 1083 |
+
"single_word": false,
|
| 1084 |
+
"special": false
|
| 1085 |
+
},
|
| 1086 |
+
"32132": {
|
| 1087 |
+
"content": "<y30>",
|
| 1088 |
+
"lstrip": false,
|
| 1089 |
+
"normalized": true,
|
| 1090 |
+
"rstrip": false,
|
| 1091 |
+
"single_word": false,
|
| 1092 |
+
"special": false
|
| 1093 |
+
},
|
| 1094 |
+
"32133": {
|
| 1095 |
+
"content": "<y31>",
|
| 1096 |
+
"lstrip": false,
|
| 1097 |
+
"normalized": true,
|
| 1098 |
+
"rstrip": false,
|
| 1099 |
+
"single_word": false,
|
| 1100 |
+
"special": false
|
| 1101 |
+
},
|
| 1102 |
+
"32134": {
|
| 1103 |
+
"content": "<y32>",
|
| 1104 |
+
"lstrip": false,
|
| 1105 |
+
"normalized": true,
|
| 1106 |
+
"rstrip": false,
|
| 1107 |
+
"single_word": false,
|
| 1108 |
+
"special": false
|
| 1109 |
+
},
|
| 1110 |
+
"32135": {
|
| 1111 |
+
"content": "<y33>",
|
| 1112 |
+
"lstrip": false,
|
| 1113 |
+
"normalized": true,
|
| 1114 |
+
"rstrip": false,
|
| 1115 |
+
"single_word": false,
|
| 1116 |
+
"special": false
|
| 1117 |
+
},
|
| 1118 |
+
"32136": {
|
| 1119 |
+
"content": "<y34>",
|
| 1120 |
+
"lstrip": false,
|
| 1121 |
+
"normalized": true,
|
| 1122 |
+
"rstrip": false,
|
| 1123 |
+
"single_word": false,
|
| 1124 |
+
"special": false
|
| 1125 |
+
},
|
| 1126 |
+
"32137": {
|
| 1127 |
+
"content": "<y35>",
|
| 1128 |
+
"lstrip": false,
|
| 1129 |
+
"normalized": true,
|
| 1130 |
+
"rstrip": false,
|
| 1131 |
+
"single_word": false,
|
| 1132 |
+
"special": false
|
| 1133 |
+
},
|
| 1134 |
+
"32138": {
|
| 1135 |
+
"content": "<y36>",
|
| 1136 |
+
"lstrip": false,
|
| 1137 |
+
"normalized": true,
|
| 1138 |
+
"rstrip": false,
|
| 1139 |
+
"single_word": false,
|
| 1140 |
+
"special": false
|
| 1141 |
+
},
|
| 1142 |
+
"32139": {
|
| 1143 |
+
"content": "<y37>",
|
| 1144 |
+
"lstrip": false,
|
| 1145 |
+
"normalized": true,
|
| 1146 |
+
"rstrip": false,
|
| 1147 |
+
"single_word": false,
|
| 1148 |
+
"special": false
|
| 1149 |
+
},
|
| 1150 |
+
"32140": {
|
| 1151 |
+
"content": "<y38>",
|
| 1152 |
+
"lstrip": false,
|
| 1153 |
+
"normalized": true,
|
| 1154 |
+
"rstrip": false,
|
| 1155 |
+
"single_word": false,
|
| 1156 |
+
"special": false
|
| 1157 |
+
},
|
| 1158 |
+
"32141": {
|
| 1159 |
+
"content": "<y39>",
|
| 1160 |
+
"lstrip": false,
|
| 1161 |
+
"normalized": true,
|
| 1162 |
+
"rstrip": false,
|
| 1163 |
+
"single_word": false,
|
| 1164 |
+
"special": false
|
| 1165 |
+
},
|
| 1166 |
+
"32142": {
|
| 1167 |
+
"content": "<y40>",
|
| 1168 |
+
"lstrip": false,
|
| 1169 |
+
"normalized": true,
|
| 1170 |
+
"rstrip": false,
|
| 1171 |
+
"single_word": false,
|
| 1172 |
+
"special": false
|
| 1173 |
+
},
|
| 1174 |
+
"32143": {
|
| 1175 |
+
"content": "<y41>",
|
| 1176 |
+
"lstrip": false,
|
| 1177 |
+
"normalized": true,
|
| 1178 |
+
"rstrip": false,
|
| 1179 |
+
"single_word": false,
|
| 1180 |
+
"special": false
|
| 1181 |
+
},
|
| 1182 |
+
"32144": {
|
| 1183 |
+
"content": "<y42>",
|
| 1184 |
+
"lstrip": false,
|
| 1185 |
+
"normalized": true,
|
| 1186 |
+
"rstrip": false,
|
| 1187 |
+
"single_word": false,
|
| 1188 |
+
"special": false
|
| 1189 |
+
},
|
| 1190 |
+
"32145": {
|
| 1191 |
+
"content": "<y43>",
|
| 1192 |
+
"lstrip": false,
|
| 1193 |
+
"normalized": true,
|
| 1194 |
+
"rstrip": false,
|
| 1195 |
+
"single_word": false,
|
| 1196 |
+
"special": false
|
| 1197 |
+
},
|
| 1198 |
+
"32146": {
|
| 1199 |
+
"content": "<y44>",
|
| 1200 |
+
"lstrip": false,
|
| 1201 |
+
"normalized": true,
|
| 1202 |
+
"rstrip": false,
|
| 1203 |
+
"single_word": false,
|
| 1204 |
+
"special": false
|
| 1205 |
+
},
|
| 1206 |
+
"32147": {
|
| 1207 |
+
"content": "<y45>",
|
| 1208 |
+
"lstrip": false,
|
| 1209 |
+
"normalized": true,
|
| 1210 |
+
"rstrip": false,
|
| 1211 |
+
"single_word": false,
|
| 1212 |
+
"special": false
|
| 1213 |
+
},
|
| 1214 |
+
"32148": {
|
| 1215 |
+
"content": "<y46>",
|
| 1216 |
+
"lstrip": false,
|
| 1217 |
+
"normalized": true,
|
| 1218 |
+
"rstrip": false,
|
| 1219 |
+
"single_word": false,
|
| 1220 |
+
"special": false
|
| 1221 |
+
},
|
| 1222 |
+
"32149": {
|
| 1223 |
+
"content": "<y47>",
|
| 1224 |
+
"lstrip": false,
|
| 1225 |
+
"normalized": true,
|
| 1226 |
+
"rstrip": false,
|
| 1227 |
+
"single_word": false,
|
| 1228 |
+
"special": false
|
| 1229 |
+
},
|
| 1230 |
+
"32150": {
|
| 1231 |
+
"content": "<y48>",
|
| 1232 |
+
"lstrip": false,
|
| 1233 |
+
"normalized": true,
|
| 1234 |
+
"rstrip": false,
|
| 1235 |
+
"single_word": false,
|
| 1236 |
+
"special": false
|
| 1237 |
+
},
|
| 1238 |
+
"32151": {
|
| 1239 |
+
"content": "<y49>",
|
| 1240 |
+
"lstrip": false,
|
| 1241 |
+
"normalized": true,
|
| 1242 |
+
"rstrip": false,
|
| 1243 |
+
"single_word": false,
|
| 1244 |
+
"special": false
|
| 1245 |
+
},
|
| 1246 |
+
"32152": {
|
| 1247 |
+
"content": "<y50>",
|
| 1248 |
+
"lstrip": false,
|
| 1249 |
+
"normalized": true,
|
| 1250 |
+
"rstrip": false,
|
| 1251 |
+
"single_word": false,
|
| 1252 |
+
"special": false
|
| 1253 |
+
},
|
| 1254 |
+
"32153": {
|
| 1255 |
+
"content": "<y51>",
|
| 1256 |
+
"lstrip": false,
|
| 1257 |
+
"normalized": true,
|
| 1258 |
+
"rstrip": false,
|
| 1259 |
+
"single_word": false,
|
| 1260 |
+
"special": false
|
| 1261 |
+
},
|
| 1262 |
+
"32154": {
|
| 1263 |
+
"content": "<y52>",
|
| 1264 |
+
"lstrip": false,
|
| 1265 |
+
"normalized": true,
|
| 1266 |
+
"rstrip": false,
|
| 1267 |
+
"single_word": false,
|
| 1268 |
+
"special": false
|
| 1269 |
+
},
|
| 1270 |
+
"32155": {
|
| 1271 |
+
"content": "<y53>",
|
| 1272 |
+
"lstrip": false,
|
| 1273 |
+
"normalized": true,
|
| 1274 |
+
"rstrip": false,
|
| 1275 |
+
"single_word": false,
|
| 1276 |
+
"special": false
|
| 1277 |
+
},
|
| 1278 |
+
"32156": {
|
| 1279 |
+
"content": "<y54>",
|
| 1280 |
+
"lstrip": false,
|
| 1281 |
+
"normalized": true,
|
| 1282 |
+
"rstrip": false,
|
| 1283 |
+
"single_word": false,
|
| 1284 |
+
"special": false
|
| 1285 |
+
},
|
| 1286 |
+
"32157": {
|
| 1287 |
+
"content": "<y55>",
|
| 1288 |
+
"lstrip": false,
|
| 1289 |
+
"normalized": true,
|
| 1290 |
+
"rstrip": false,
|
| 1291 |
+
"single_word": false,
|
| 1292 |
+
"special": false
|
| 1293 |
+
},
|
| 1294 |
+
"32158": {
|
| 1295 |
+
"content": "<y56>",
|
| 1296 |
+
"lstrip": false,
|
| 1297 |
+
"normalized": true,
|
| 1298 |
+
"rstrip": false,
|
| 1299 |
+
"single_word": false,
|
| 1300 |
+
"special": false
|
| 1301 |
+
},
|
| 1302 |
+
"32159": {
|
| 1303 |
+
"content": "<y57>",
|
| 1304 |
+
"lstrip": false,
|
| 1305 |
+
"normalized": true,
|
| 1306 |
+
"rstrip": false,
|
| 1307 |
+
"single_word": false,
|
| 1308 |
+
"special": false
|
| 1309 |
+
},
|
| 1310 |
+
"32160": {
|
| 1311 |
+
"content": "<y58>",
|
| 1312 |
+
"lstrip": false,
|
| 1313 |
+
"normalized": true,
|
| 1314 |
+
"rstrip": false,
|
| 1315 |
+
"single_word": false,
|
| 1316 |
+
"special": false
|
| 1317 |
+
},
|
| 1318 |
+
"32161": {
|
| 1319 |
+
"content": "<y59>",
|
| 1320 |
+
"lstrip": false,
|
| 1321 |
+
"normalized": true,
|
| 1322 |
+
"rstrip": false,
|
| 1323 |
+
"single_word": false,
|
| 1324 |
+
"special": false
|
| 1325 |
+
},
|
| 1326 |
+
"32162": {
|
| 1327 |
+
"content": "<y60>",
|
| 1328 |
+
"lstrip": false,
|
| 1329 |
+
"normalized": true,
|
| 1330 |
+
"rstrip": false,
|
| 1331 |
+
"single_word": false,
|
| 1332 |
+
"special": false
|
| 1333 |
+
},
|
| 1334 |
+
"32163": {
|
| 1335 |
+
"content": "<y61>",
|
| 1336 |
+
"lstrip": false,
|
| 1337 |
+
"normalized": true,
|
| 1338 |
+
"rstrip": false,
|
| 1339 |
+
"single_word": false,
|
| 1340 |
+
"special": false
|
| 1341 |
+
},
|
| 1342 |
+
"32164": {
|
| 1343 |
+
"content": "<y62>",
|
| 1344 |
+
"lstrip": false,
|
| 1345 |
+
"normalized": true,
|
| 1346 |
+
"rstrip": false,
|
| 1347 |
+
"single_word": false,
|
| 1348 |
+
"special": false
|
| 1349 |
+
},
|
| 1350 |
+
"32165": {
|
| 1351 |
+
"content": "<y63>",
|
| 1352 |
+
"lstrip": false,
|
| 1353 |
+
"normalized": true,
|
| 1354 |
+
"rstrip": false,
|
| 1355 |
+
"single_word": false,
|
| 1356 |
+
"special": false
|
| 1357 |
+
},
|
| 1358 |
+
"32166": {
|
| 1359 |
+
"content": "<y64>",
|
| 1360 |
+
"lstrip": false,
|
| 1361 |
+
"normalized": true,
|
| 1362 |
+
"rstrip": false,
|
| 1363 |
+
"single_word": false,
|
| 1364 |
+
"special": false
|
| 1365 |
+
},
|
| 1366 |
+
"32167": {
|
| 1367 |
+
"content": "<y65>",
|
| 1368 |
+
"lstrip": false,
|
| 1369 |
+
"normalized": true,
|
| 1370 |
+
"rstrip": false,
|
| 1371 |
+
"single_word": false,
|
| 1372 |
+
"special": false
|
| 1373 |
+
},
|
| 1374 |
+
"32168": {
|
| 1375 |
+
"content": "<y66>",
|
| 1376 |
+
"lstrip": false,
|
| 1377 |
+
"normalized": true,
|
| 1378 |
+
"rstrip": false,
|
| 1379 |
+
"single_word": false,
|
| 1380 |
+
"special": false
|
| 1381 |
+
},
|
| 1382 |
+
"32169": {
|
| 1383 |
+
"content": "<y67>",
|
| 1384 |
+
"lstrip": false,
|
| 1385 |
+
"normalized": true,
|
| 1386 |
+
"rstrip": false,
|
| 1387 |
+
"single_word": false,
|
| 1388 |
+
"special": false
|
| 1389 |
+
},
|
| 1390 |
+
"32170": {
|
| 1391 |
+
"content": "<y68>",
|
| 1392 |
+
"lstrip": false,
|
| 1393 |
+
"normalized": true,
|
| 1394 |
+
"rstrip": false,
|
| 1395 |
+
"single_word": false,
|
| 1396 |
+
"special": false
|
| 1397 |
+
},
|
| 1398 |
+
"32171": {
|
| 1399 |
+
"content": "<y69>",
|
| 1400 |
+
"lstrip": false,
|
| 1401 |
+
"normalized": true,
|
| 1402 |
+
"rstrip": false,
|
| 1403 |
+
"single_word": false,
|
| 1404 |
+
"special": false
|
| 1405 |
+
},
|
| 1406 |
+
"32172": {
|
| 1407 |
+
"content": "<y70>",
|
| 1408 |
+
"lstrip": false,
|
| 1409 |
+
"normalized": true,
|
| 1410 |
+
"rstrip": false,
|
| 1411 |
+
"single_word": false,
|
| 1412 |
+
"special": false
|
| 1413 |
+
},
|
| 1414 |
+
"32173": {
|
| 1415 |
+
"content": "<y71>",
|
| 1416 |
+
"lstrip": false,
|
| 1417 |
+
"normalized": true,
|
| 1418 |
+
"rstrip": false,
|
| 1419 |
+
"single_word": false,
|
| 1420 |
+
"special": false
|
| 1421 |
+
},
|
| 1422 |
+
"32174": {
|
| 1423 |
+
"content": "<y72>",
|
| 1424 |
+
"lstrip": false,
|
| 1425 |
+
"normalized": true,
|
| 1426 |
+
"rstrip": false,
|
| 1427 |
+
"single_word": false,
|
| 1428 |
+
"special": false
|
| 1429 |
+
},
|
| 1430 |
+
"32175": {
|
| 1431 |
+
"content": "<y73>",
|
| 1432 |
+
"lstrip": false,
|
| 1433 |
+
"normalized": true,
|
| 1434 |
+
"rstrip": false,
|
| 1435 |
+
"single_word": false,
|
| 1436 |
+
"special": false
|
| 1437 |
+
},
|
| 1438 |
+
"32176": {
|
| 1439 |
+
"content": "<y74>",
|
| 1440 |
+
"lstrip": false,
|
| 1441 |
+
"normalized": true,
|
| 1442 |
+
"rstrip": false,
|
| 1443 |
+
"single_word": false,
|
| 1444 |
+
"special": false
|
| 1445 |
+
},
|
| 1446 |
+
"32177": {
|
| 1447 |
+
"content": "<y75>",
|
| 1448 |
+
"lstrip": false,
|
| 1449 |
+
"normalized": true,
|
| 1450 |
+
"rstrip": false,
|
| 1451 |
+
"single_word": false,
|
| 1452 |
+
"special": false
|
| 1453 |
+
},
|
| 1454 |
+
"32178": {
|
| 1455 |
+
"content": "<y76>",
|
| 1456 |
+
"lstrip": false,
|
| 1457 |
+
"normalized": true,
|
| 1458 |
+
"rstrip": false,
|
| 1459 |
+
"single_word": false,
|
| 1460 |
+
"special": false
|
| 1461 |
+
},
|
| 1462 |
+
"32179": {
|
| 1463 |
+
"content": "<y77>",
|
| 1464 |
+
"lstrip": false,
|
| 1465 |
+
"normalized": true,
|
| 1466 |
+
"rstrip": false,
|
| 1467 |
+
"single_word": false,
|
| 1468 |
+
"special": false
|
| 1469 |
+
},
|
| 1470 |
+
"32180": {
|
| 1471 |
+
"content": "<y78>",
|
| 1472 |
+
"lstrip": false,
|
| 1473 |
+
"normalized": true,
|
| 1474 |
+
"rstrip": false,
|
| 1475 |
+
"single_word": false,
|
| 1476 |
+
"special": false
|
| 1477 |
+
},
|
| 1478 |
+
"32181": {
|
| 1479 |
+
"content": "<y79>",
|
| 1480 |
+
"lstrip": false,
|
| 1481 |
+
"normalized": true,
|
| 1482 |
+
"rstrip": false,
|
| 1483 |
+
"single_word": false,
|
| 1484 |
+
"special": false
|
| 1485 |
+
},
|
| 1486 |
+
"32182": {
|
| 1487 |
+
"content": "<y80>",
|
| 1488 |
+
"lstrip": false,
|
| 1489 |
+
"normalized": true,
|
| 1490 |
+
"rstrip": false,
|
| 1491 |
+
"single_word": false,
|
| 1492 |
+
"special": false
|
| 1493 |
+
},
|
| 1494 |
+
"32183": {
|
| 1495 |
+
"content": "<y81>",
|
| 1496 |
+
"lstrip": false,
|
| 1497 |
+
"normalized": true,
|
| 1498 |
+
"rstrip": false,
|
| 1499 |
+
"single_word": false,
|
| 1500 |
+
"special": false
|
| 1501 |
+
},
|
| 1502 |
+
"32184": {
|
| 1503 |
+
"content": "<y82>",
|
| 1504 |
+
"lstrip": false,
|
| 1505 |
+
"normalized": true,
|
| 1506 |
+
"rstrip": false,
|
| 1507 |
+
"single_word": false,
|
| 1508 |
+
"special": false
|
| 1509 |
+
},
|
| 1510 |
+
"32185": {
|
| 1511 |
+
"content": "<y83>",
|
| 1512 |
+
"lstrip": false,
|
| 1513 |
+
"normalized": true,
|
| 1514 |
+
"rstrip": false,
|
| 1515 |
+
"single_word": false,
|
| 1516 |
+
"special": false
|
| 1517 |
+
},
|
| 1518 |
+
"32186": {
|
| 1519 |
+
"content": "<y84>",
|
| 1520 |
+
"lstrip": false,
|
| 1521 |
+
"normalized": true,
|
| 1522 |
+
"rstrip": false,
|
| 1523 |
+
"single_word": false,
|
| 1524 |
+
"special": false
|
| 1525 |
+
},
|
| 1526 |
+
"32187": {
|
| 1527 |
+
"content": "<y85>",
|
| 1528 |
+
"lstrip": false,
|
| 1529 |
+
"normalized": true,
|
| 1530 |
+
"rstrip": false,
|
| 1531 |
+
"single_word": false,
|
| 1532 |
+
"special": false
|
| 1533 |
+
},
|
| 1534 |
+
"32188": {
|
| 1535 |
+
"content": "<y86>",
|
| 1536 |
+
"lstrip": false,
|
| 1537 |
+
"normalized": true,
|
| 1538 |
+
"rstrip": false,
|
| 1539 |
+
"single_word": false,
|
| 1540 |
+
"special": false
|
| 1541 |
+
},
|
| 1542 |
+
"32189": {
|
| 1543 |
+
"content": "<y87>",
|
| 1544 |
+
"lstrip": false,
|
| 1545 |
+
"normalized": true,
|
| 1546 |
+
"rstrip": false,
|
| 1547 |
+
"single_word": false,
|
| 1548 |
+
"special": false
|
| 1549 |
+
},
|
| 1550 |
+
"32190": {
|
| 1551 |
+
"content": "<y88>",
|
| 1552 |
+
"lstrip": false,
|
| 1553 |
+
"normalized": true,
|
| 1554 |
+
"rstrip": false,
|
| 1555 |
+
"single_word": false,
|
| 1556 |
+
"special": false
|
| 1557 |
+
},
|
| 1558 |
+
"32191": {
|
| 1559 |
+
"content": "<y89>",
|
| 1560 |
+
"lstrip": false,
|
| 1561 |
+
"normalized": true,
|
| 1562 |
+
"rstrip": false,
|
| 1563 |
+
"single_word": false,
|
| 1564 |
+
"special": false
|
| 1565 |
+
},
|
| 1566 |
+
"32192": {
|
| 1567 |
+
"content": "<y90>",
|
| 1568 |
+
"lstrip": false,
|
| 1569 |
+
"normalized": true,
|
| 1570 |
+
"rstrip": false,
|
| 1571 |
+
"single_word": false,
|
| 1572 |
+
"special": false
|
| 1573 |
+
},
|
| 1574 |
+
"32193": {
|
| 1575 |
+
"content": "<y91>",
|
| 1576 |
+
"lstrip": false,
|
| 1577 |
+
"normalized": true,
|
| 1578 |
+
"rstrip": false,
|
| 1579 |
+
"single_word": false,
|
| 1580 |
+
"special": false
|
| 1581 |
+
},
|
| 1582 |
+
"32194": {
|
| 1583 |
+
"content": "<y92>",
|
| 1584 |
+
"lstrip": false,
|
| 1585 |
+
"normalized": true,
|
| 1586 |
+
"rstrip": false,
|
| 1587 |
+
"single_word": false,
|
| 1588 |
+
"special": false
|
| 1589 |
+
},
|
| 1590 |
+
"32195": {
|
| 1591 |
+
"content": "<y93>",
|
| 1592 |
+
"lstrip": false,
|
| 1593 |
+
"normalized": true,
|
| 1594 |
+
"rstrip": false,
|
| 1595 |
+
"single_word": false,
|
| 1596 |
+
"special": false
|
| 1597 |
+
},
|
| 1598 |
+
"32196": {
|
| 1599 |
+
"content": "<y94>",
|
| 1600 |
+
"lstrip": false,
|
| 1601 |
+
"normalized": true,
|
| 1602 |
+
"rstrip": false,
|
| 1603 |
+
"single_word": false,
|
| 1604 |
+
"special": false
|
| 1605 |
+
},
|
| 1606 |
+
"32197": {
|
| 1607 |
+
"content": "<y95>",
|
| 1608 |
+
"lstrip": false,
|
| 1609 |
+
"normalized": true,
|
| 1610 |
+
"rstrip": false,
|
| 1611 |
+
"single_word": false,
|
| 1612 |
+
"special": false
|
| 1613 |
+
},
|
| 1614 |
+
"32198": {
|
| 1615 |
+
"content": "<y96>",
|
| 1616 |
+
"lstrip": false,
|
| 1617 |
+
"normalized": true,
|
| 1618 |
+
"rstrip": false,
|
| 1619 |
+
"single_word": false,
|
| 1620 |
+
"special": false
|
| 1621 |
+
},
|
| 1622 |
+
"32199": {
|
| 1623 |
+
"content": "<y97>",
|
| 1624 |
+
"lstrip": false,
|
| 1625 |
+
"normalized": true,
|
| 1626 |
+
"rstrip": false,
|
| 1627 |
+
"single_word": false,
|
| 1628 |
+
"special": false
|
| 1629 |
+
},
|
| 1630 |
+
"32200": {
|
| 1631 |
+
"content": "<y98>",
|
| 1632 |
+
"lstrip": false,
|
| 1633 |
+
"normalized": true,
|
| 1634 |
+
"rstrip": false,
|
| 1635 |
+
"single_word": false,
|
| 1636 |
+
"special": false
|
| 1637 |
+
},
|
| 1638 |
+
"32201": {
|
| 1639 |
+
"content": "<y99>",
|
| 1640 |
+
"lstrip": false,
|
| 1641 |
+
"normalized": true,
|
| 1642 |
+
"rstrip": false,
|
| 1643 |
+
"single_word": false,
|
| 1644 |
+
"special": false
|
| 1645 |
+
},
|
| 1646 |
+
"32202": {
|
| 1647 |
+
"content": "<box>",
|
| 1648 |
+
"lstrip": false,
|
| 1649 |
+
"normalized": true,
|
| 1650 |
+
"rstrip": false,
|
| 1651 |
+
"single_word": false,
|
| 1652 |
+
"special": false
|
| 1653 |
+
},
|
| 1654 |
+
"32203": {
|
| 1655 |
+
"content": "</box>",
|
| 1656 |
+
"lstrip": false,
|
| 1657 |
+
"normalized": true,
|
| 1658 |
+
"rstrip": false,
|
| 1659 |
+
"single_word": false,
|
| 1660 |
+
"special": false
|
| 1661 |
+
},
|
| 1662 |
+
"32204": {
|
| 1663 |
+
"content": "<image>",
|
| 1664 |
+
"lstrip": false,
|
| 1665 |
+
"normalized": true,
|
| 1666 |
+
"rstrip": false,
|
| 1667 |
+
"single_word": false,
|
| 1668 |
+
"special": false
|
| 1669 |
+
},
|
| 1670 |
+
"32205": {
|
| 1671 |
+
"content": "<prev_im>",
|
| 1672 |
+
"lstrip": false,
|
| 1673 |
+
"normalized": true,
|
| 1674 |
+
"rstrip": false,
|
| 1675 |
+
"single_word": false,
|
| 1676 |
+
"special": false
|
| 1677 |
+
},
|
| 1678 |
+
"32206": {
|
| 1679 |
+
"content": "<lat_image>",
|
| 1680 |
+
"lstrip": false,
|
| 1681 |
+
"normalized": true,
|
| 1682 |
+
"rstrip": false,
|
| 1683 |
+
"single_word": false,
|
| 1684 |
+
"special": false
|
| 1685 |
+
}
|
| 1686 |
+
},
|
| 1687 |
+
"bos_token": "<s>",
|
| 1688 |
+
"chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}You are an expert radiology assistant tasked with interpreting a chest X-ray study. {% for message in messages %}{% if message[\"role\"] == \"user\" %}USER: {% else %}ASSISTANT: {% endif %}{% for item in message[\"content\"] %}{% if item[\"type\"] == \"text\" %}{{ item[\"text\"] }}{% elif item[\"type\"] == \"image\" %}<image>{% endif %}{% endfor %}{% if message[\"role\"] == \"user\" %} {% else %}{{eos_token}}{% endif %}{% endfor %}{% if add_generation_prompt %}ASSISTANT: {% endif %}",
|
| 1689 |
+
"clean_up_tokenization_spaces": false,
|
| 1690 |
+
"eos_token": "</s>",
|
| 1691 |
+
"extra_special_tokens": {},
|
| 1692 |
+
"legacy": false,
|
| 1693 |
+
"model_max_length": 4096,
|
| 1694 |
+
"pad_token": "<unk>",
|
| 1695 |
+
"padding_side": "left",
|
| 1696 |
+
"sp_model_kwargs": {},
|
| 1697 |
+
"spaces_between_special_tokens": false,
|
| 1698 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 1699 |
+
"unk_token": "<unk>",
|
| 1700 |
+
"use_default_system_prompt": false
|
| 1701 |
+
}
|