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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 5,
|
| 6 |
+
"metadata": {
|
| 7 |
+
"id": "hS2zWviCGv-j"
|
| 8 |
+
},
|
| 9 |
+
"outputs": [],
|
| 10 |
+
"source": [
|
| 11 |
+
"model_name_or_path = \"mistralai/Mixtral-8x7B-Instruct-v0.1\"#@param {type:\"string\"}\n",
|
| 12 |
+
"experts_extract_bit = \"10101010\" #@param {type:\"string\"}\n",
|
| 13 |
+
"num_experts_per_tok = 2 #@param {type:\"integer\"}\n",
|
| 14 |
+
"\n",
|
| 15 |
+
"temp_dir = \"/content/drive/MyDrive/tf_models\" #@param {type:\"string\"}\n",
|
| 16 |
+
"model_name = model_name_or_path.split(\"/\")[-1]\n",
|
| 17 |
+
"target_dir = f\"{temp_dir}/{model_name}\"\n",
|
| 18 |
+
"save_dir = \"/content/drive/MyDrive/tf_models/mx4x7b_x3\" #@param {type:\"string\"}\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"\n",
|
| 21 |
+
"experts_indexies = [i for i, bit in enumerate(experts_extract_bit) if bit == '1']\n",
|
| 22 |
+
"# print( experts_indexies )\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"if len(experts_extract_bit) != 8:\n",
|
| 25 |
+
" raise ValueError(\"experts_extract_bit length must be 8\")\n",
|
| 26 |
+
""
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"cell_type": "code",
|
| 31 |
+
"source": [
|
| 32 |
+
"!pip install git+https://github.com/huggingface/transformers --upgrade\n",
|
| 33 |
+
"!pip install torch accelerate bitsandbytes flash_attn sentencepiece protobuf"
|
| 34 |
+
],
|
| 35 |
+
"metadata": {
|
| 36 |
+
"id": "gJhESaUCul4-"
|
| 37 |
+
},
|
| 38 |
+
"execution_count": null,
|
| 39 |
+
"outputs": []
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"cell_type": "code",
|
| 43 |
+
"source": [
|
| 44 |
+
"from google.colab import drive\n",
|
| 45 |
+
"drive.mount('/content/drive')"
|
| 46 |
+
],
|
| 47 |
+
"metadata": {
|
| 48 |
+
"colab": {
|
| 49 |
+
"base_uri": "https://localhost:8080/"
|
| 50 |
+
},
|
| 51 |
+
"id": "0kn65H6HvwXB",
|
| 52 |
+
"outputId": "0fdbc596-8288-4a1e-b0a4-ee4904b0a32a"
|
| 53 |
+
},
|
| 54 |
+
"execution_count": 2,
|
| 55 |
+
"outputs": [
|
| 56 |
+
{
|
| 57 |
+
"output_type": "stream",
|
| 58 |
+
"name": "stdout",
|
| 59 |
+
"text": [
|
| 60 |
+
"Mounted at /content/drive\n"
|
| 61 |
+
]
|
| 62 |
+
}
|
| 63 |
+
]
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"cell_type": "code",
|
| 67 |
+
"execution_count": null,
|
| 68 |
+
"metadata": {
|
| 69 |
+
"colab": {
|
| 70 |
+
"background_save": true
|
| 71 |
+
},
|
| 72 |
+
"id": "WwnZPGHATsqv"
|
| 73 |
+
},
|
| 74 |
+
"outputs": [],
|
| 75 |
+
"source": [
|
| 76 |
+
"%cd {temp_dir}\n",
|
| 77 |
+
"save_model_dir = model_name.split('/')[-1]\n",
|
| 78 |
+
"!mkdir -p {save_model_dir}\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"!wget https://huggingface.co/{model_name_or_path}/resolve/main/config.json -O {save_model_dir}/config.json\n",
|
| 81 |
+
"!wget https://huggingface.co/{model_name_or_path}/resolve/main/model.safetensors.index.json -O {save_model_dir}/model.safetensors.index.json\n",
|
| 82 |
+
"!wget https://huggingface.co/{model_name_or_path}/resolve/main/generation_config.json -O {save_model_dir}/generation_config.json\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"for i in range(1,20):\n",
|
| 85 |
+
" file_count_str = str(i).zfill(5)\n",
|
| 86 |
+
" !wget https://huggingface.co/{model_name_or_path}/resolve/main/model-{file_count_str}-of-00019.safetensors?download=true -O {save_model_dir}/model-{file_count_str}-of-00019.safetensors"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "code",
|
| 91 |
+
"source": [
|
| 92 |
+
"def download_tokenizer_model(save_tokenizer_dir):\n",
|
| 93 |
+
" !wget https://huggingface.co/{model_name_or_path}/resolve/main/tokenizer.model -O {save_tokenizer_dir}/tokenizer.model\n"
|
| 94 |
+
],
|
| 95 |
+
"metadata": {
|
| 96 |
+
"id": "SDnbZoAMSEB8"
|
| 97 |
+
},
|
| 98 |
+
"execution_count": 5,
|
| 99 |
+
"outputs": []
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"cell_type": "code",
|
| 103 |
+
"execution_count": null,
|
| 104 |
+
"metadata": {
|
| 105 |
+
"id": "GpHX5HoDPCEM"
|
| 106 |
+
},
|
| 107 |
+
"outputs": [],
|
| 108 |
+
"source": [
|
| 109 |
+
"%cd {temp_dir}\n",
|
| 110 |
+
"\n",
|
| 111 |
+
"import json\n",
|
| 112 |
+
"import re\n",
|
| 113 |
+
"import torch\n",
|
| 114 |
+
"from safetensors import safe_open\n",
|
| 115 |
+
"from safetensors.torch import save_file\n",
|
| 116 |
+
"\n",
|
| 117 |
+
"# model-00001-of-00019.safetensors\n",
|
| 118 |
+
"# model.safetensors.index.json\n",
|
| 119 |
+
"\n",
|
| 120 |
+
"# save tokenizer\n",
|
| 121 |
+
"from transformers import AutoTokenizer\n",
|
| 122 |
+
"tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=False)\n",
|
| 123 |
+
"tokenizer.save_pretrained(save_dir)\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"# save config\n",
|
| 126 |
+
"config_path = f\"{target_dir}/config.json\"\n",
|
| 127 |
+
"config = None\n",
|
| 128 |
+
"with open(config_path, \"r\") as f:\n",
|
| 129 |
+
" config = json.load(f)\n",
|
| 130 |
+
" config[\"num_experts_per_tok\"] = num_experts_per_tok if len(experts_indexies) >= num_experts_per_tok else 1\n",
|
| 131 |
+
" config[\"num_local_experts\"] = len(experts_indexies)\n",
|
| 132 |
+
"\n",
|
| 133 |
+
"# save config\n",
|
| 134 |
+
"with open(f\"{save_dir}/config.json\", \"w\") as f:\n",
|
| 135 |
+
" json.dump(config, f, indent=2)\n",
|
| 136 |
+
"\n",
|
| 137 |
+
"\n",
|
| 138 |
+
"# weight\n",
|
| 139 |
+
"weight_map = {}\n",
|
| 140 |
+
"first_weights = [\"lm_head.weight\", \"model.embed_tokens.weight\", \"model.norm.weight\"]\n",
|
| 141 |
+
"\n",
|
| 142 |
+
"# load weight map\n",
|
| 143 |
+
"bin_index_path = f\"{target_dir}/model.safetensors.index.json\"\n",
|
| 144 |
+
"with open(bin_index_path, \"r\") as f:\n",
|
| 145 |
+
" weight_map = json.load(f)[\"weight_map\"]\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"def tensor_load(file_name, map_location=None):\n",
|
| 148 |
+
" tensors = {}\n",
|
| 149 |
+
" with safe_open(file_name, framework=\"pt\") as f:\n",
|
| 150 |
+
" for k in f.keys():\n",
|
| 151 |
+
" tensors[k] = f.get_tensor(k)\n",
|
| 152 |
+
" return tensors\n",
|
| 153 |
+
"\n",
|
| 154 |
+
"def get_weight_byte_size(weight):\n",
|
| 155 |
+
"\n",
|
| 156 |
+
" if isinstance(weight, torch.Tensor):\n",
|
| 157 |
+
" weight_byte_size = weight.nelement() * weight.element_size()\n",
|
| 158 |
+
" else:\n",
|
| 159 |
+
" weight_byte_size = sum(p.nelement() * p.element_size() for p in weight.parameters())\n",
|
| 160 |
+
"\n",
|
| 161 |
+
" return weight_byte_size\n",
|
| 162 |
+
"\n",
|
| 163 |
+
"# load weight map\n",
|
| 164 |
+
"layers = {}\n",
|
| 165 |
+
"for key in weight_map.keys():\n",
|
| 166 |
+
" if key in first_weights:\n",
|
| 167 |
+
" continue\n",
|
| 168 |
+
"\n",
|
| 169 |
+
" # keyが\"model.layers.[0-9]+.\"にmatchする場合はlayers_listに追加する\n",
|
| 170 |
+
" layer_str = re.match(r\"model\\.layers\\.[0-9]+\\.\", key)[0]\n",
|
| 171 |
+
" if layer_str:\n",
|
| 172 |
+
" layer_no = re.findall(r\"\\d+\",layer_str)\n",
|
| 173 |
+
" layer_no = layer_no[0]\n",
|
| 174 |
+
" if layer_no not in layers.keys():\n",
|
| 175 |
+
" layers[layer_no] = []\n",
|
| 176 |
+
"\n",
|
| 177 |
+
" layers[layer_no].append({ \"key\":key, \"file_name\":weight_map[key] })\n",
|
| 178 |
+
"\n",
|
| 179 |
+
"# new weight_map index\n",
|
| 180 |
+
"new_weight_map = {\n",
|
| 181 |
+
" \"metadata\": {\n",
|
| 182 |
+
" \"total_size\": 0\n",
|
| 183 |
+
" },\n",
|
| 184 |
+
" \"weight_map\": {\n",
|
| 185 |
+
" }\n",
|
| 186 |
+
"}\n",
|
| 187 |
+
"\n",
|
| 188 |
+
"# load tensors\n",
|
| 189 |
+
"total_size = 0\n",
|
| 190 |
+
"tensor_weights = {}\n",
|
| 191 |
+
"tensors = {}\n",
|
| 192 |
+
"current_file_name = \"\"\n",
|
| 193 |
+
"\n",
|
| 194 |
+
"file_count = 0\n",
|
| 195 |
+
"file_count_str = str(file_count).zfill(5)\n",
|
| 196 |
+
"\n",
|
| 197 |
+
"for key in first_weights:\n",
|
| 198 |
+
" file_name = weight_map[key]\n",
|
| 199 |
+
" if current_file_name != file_name:\n",
|
| 200 |
+
"\n",
|
| 201 |
+
" # load safetensor\n",
|
| 202 |
+
" tensors = tensor_load(f\"{target_dir}/{file_name}\", map_location=\"cpu\")\n",
|
| 203 |
+
" current_file_name = file_name\n",
|
| 204 |
+
"\n",
|
| 205 |
+
" tensor_weights[key] = tensors[key]\n",
|
| 206 |
+
" new_weight_map[\"weight_map\"][key] = f\"model-{file_count_str}.safetensors\"\n",
|
| 207 |
+
"\n",
|
| 208 |
+
" # add weight size\n",
|
| 209 |
+
" total_size += get_weight_byte_size(tensor_weights[key])\n",
|
| 210 |
+
"\n",
|
| 211 |
+
"# save tensor\n",
|
| 212 |
+
"save_file(tensor_weights, f\"{save_dir}/model-{file_count_str}.safetensors\", metadata={\"format\":\"pt\"})\n",
|
| 213 |
+
"file_count += 1\n",
|
| 214 |
+
"\n",
|
| 215 |
+
"layer_keys = sorted([ int(k) for k in layers.keys()])\n",
|
| 216 |
+
"\n",
|
| 217 |
+
"for layer_no in layer_keys:\n",
|
| 218 |
+
" print(\"starting layer:\",layer_no)\n",
|
| 219 |
+
" file_count_str = str(file_count).zfill(5)\n",
|
| 220 |
+
" tensor_weights = {}\n",
|
| 221 |
+
"\n",
|
| 222 |
+
" stock_expert_weights = {}\n",
|
| 223 |
+
"\n",
|
| 224 |
+
" current_file_name = \"\"\n",
|
| 225 |
+
" for info in layers[str(layer_no)]:\n",
|
| 226 |
+
" file_name = info[\"file_name\"]\n",
|
| 227 |
+
" if current_file_name != file_name:\n",
|
| 228 |
+
" print(\"Loading Tensors \", file_name)\n",
|
| 229 |
+
" tensors = tensor_load(f\"{target_dir}/{file_name}\", map_location=\"cpu\")\n",
|
| 230 |
+
" current_file_name = file_name\n",
|
| 231 |
+
"\n",
|
| 232 |
+
" layer_key = info[\"key\"]\n",
|
| 233 |
+
" layer_weights = tensors[layer_key]\n",
|
| 234 |
+
"\n",
|
| 235 |
+
" if 'experts' in layer_key:\n",
|
| 236 |
+
"\n",
|
| 237 |
+
" lk = re.findall(r\"block_sparse_moe[.]experts[.][0-9]+.w\", layer_key)[0]\n",
|
| 238 |
+
" exp_index = int( re.findall(r\"\\d+\",lk)[0] )\n",
|
| 239 |
+
"\n",
|
| 240 |
+
" # select target experts\n",
|
| 241 |
+
" if exp_index in experts_indexies:\n",
|
| 242 |
+
" new_layer_key = re.sub(r\"block_sparse_moe\\.experts\\.\\d+\\.w\", f\"block_sparse_moe.experts.{experts_indexies.index(exp_index)}.w\", layer_key)\n",
|
| 243 |
+
"\n",
|
| 244 |
+
" tensor_weights[new_layer_key] = layer_weights\n",
|
| 245 |
+
"\n",
|
| 246 |
+
" # add weight size\n",
|
| 247 |
+
" total_size += get_weight_byte_size(tensor_weights[new_layer_key])\n",
|
| 248 |
+
"\n",
|
| 249 |
+
" new_weight_map[\"weight_map\"][new_layer_key] = f\"model-{file_count_str}.safetensors\"\n",
|
| 250 |
+
" print(\"new experts\", new_layer_key, tensor_weights[new_layer_key].shape, \"from\", layer_key)\n",
|
| 251 |
+
"\n",
|
| 252 |
+
" elif 'gate' in layer_key:\n",
|
| 253 |
+
" print(\"slice gate \", experts_indexies, layer_weights.shape, f\"-> ({len(experts_indexies)}, 4096)\", layer_key)\n",
|
| 254 |
+
"\n",
|
| 255 |
+
" # slice gate\n",
|
| 256 |
+
" tensor_weights[layer_key] = layer_weights[experts_indexies]\n",
|
| 257 |
+
"\n",
|
| 258 |
+
" # add weight size\n",
|
| 259 |
+
" total_size += get_weight_byte_size(tensor_weights[layer_key])\n",
|
| 260 |
+
"\n",
|
| 261 |
+
" new_weight_map[\"weight_map\"][layer_key] = f\"model-{file_count_str}.safetensors\"\n",
|
| 262 |
+
" print(layer_key, tensor_weights[layer_key].shape)\n",
|
| 263 |
+
"\n",
|
| 264 |
+
" else:\n",
|
| 265 |
+
" tensor_weights[layer_key] = layer_weights\n",
|
| 266 |
+
"\n",
|
| 267 |
+
" # add weight size\n",
|
| 268 |
+
" total_size += get_weight_byte_size(tensor_weights[layer_key])\n",
|
| 269 |
+
"\n",
|
| 270 |
+
" new_weight_map[\"weight_map\"][layer_key] = f\"model-{file_count_str}.safetensors\"\n",
|
| 271 |
+
" print(layer_key, tensor_weights[layer_key].shape)\n",
|
| 272 |
+
"\n",
|
| 273 |
+
" # save tensor\n",
|
| 274 |
+
" save_file(tensor_weights, f\"{save_dir}/model-{file_count_str}.safetensors\", metadata={\"format\":\"pt\"})\n",
|
| 275 |
+
" print(\"Save Tensors \", f\"{save_dir}/model-{file_count_str}.safetensors\")\n",
|
| 276 |
+
" file_count += 1\n",
|
| 277 |
+
"\n",
|
| 278 |
+
"# save new_weight_map\n",
|
| 279 |
+
"new_weight_map[\"metadata\"][\"total_size\"] = total_size\n",
|
| 280 |
+
"with open(f\"{save_dir}/model.safetensors.index.json\", \"w\") as f:\n",
|
| 281 |
+
" json.dump(new_weight_map, f, indent=2)\n",
|
| 282 |
+
"\n",
|
| 283 |
+
"# download tokenizer.model\n",
|
| 284 |
+
"download_tokenizer_model(save_dir)\n",
|
| 285 |
+
"\n",
|
| 286 |
+
"print(\"Done.\")\n"
|
| 287 |
+
]
|
| 288 |
+
},
|
| 289 |
+
{
|
| 290 |
+
"cell_type": "code",
|
| 291 |
+
"source": [
|
| 292 |
+
"from transformers import AutoTokenizer, AutoModelForCausalLM, MixtralForCausalLM\n",
|
| 293 |
+
"import torch\n",
|
| 294 |
+
"\n",
|
| 295 |
+
"model_name_or_path = save_dir\n",
|
| 296 |
+
"\n",
|
| 297 |
+
"tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)\n",
|
| 298 |
+
"model = MixtralForCausalLM.from_pretrained(model_name_or_path, load_in_8bit=True)\n",
|
| 299 |
+
"\n",
|
| 300 |
+
"text = \"[INST] What was John Holt's vision on education? [/INST] \"\n",
|
| 301 |
+
"# text = \"[INST] What is the best anime? [/INST] \"\n",
|
| 302 |
+
"inputs = tokenizer(\"<s> \" + text, return_tensors=\"pt\")\n",
|
| 303 |
+
"\n",
|
| 304 |
+
"outputs = model.generate(**inputs, max_new_tokens=128)\n",
|
| 305 |
+
"print(tokenizer.decode(outputs[0], skip_special_tokens=True))\n"
|
| 306 |
+
],
|
| 307 |
+
"metadata": {
|
| 308 |
+
"colab": {
|
| 309 |
+
"base_uri": "https://localhost:8080/",
|
| 310 |
+
"height": 138,
|
| 311 |
+
"referenced_widgets": [
|
| 312 |
+
"e9cfddc47787435993179dcbfb1fb89c",
|
| 313 |
+
"19f57b50941e4f929d12aadc944ce01b",
|
| 314 |
+
"b27b7fcb570c4f95bf4adeefba1aa146",
|
| 315 |
+
"05de7d1f41054d28b69479146f8cd557",
|
| 316 |
+
"41b69b2ea8204f69b87d7ecc8c83977b",
|
| 317 |
+
"3436fe87cab3486a829cd80f0805a099",
|
| 318 |
+
"d7325fddbaea46639294e0831aa4df18",
|
| 319 |
+
"420b8967a123405bb6349b2bee24a4d3",
|
| 320 |
+
"c480548c4a3f42628cde8b011ababff0",
|
| 321 |
+
"a28af63811954d6ebfbbb1d4ef437627",
|
| 322 |
+
"f07257d9b18a4f69b2efea9550d12014"
|
| 323 |
+
]
|
| 324 |
+
},
|
| 325 |
+
"id": "3dFbRvPe8yyK",
|
| 326 |
+
"outputId": "5b7f3a08-68f7-4e16-ecc4-cf36d9756f66"
|
| 327 |
+
},
|
| 328 |
+
"execution_count": 4,
|
| 329 |
+
"outputs": [
|
| 330 |
+
{
|
| 331 |
+
"output_type": "display_data",
|
| 332 |
+
"data": {
|
| 333 |
+
"text/plain": [
|
| 334 |
+
"Loading checkpoint shards: 0%| | 0/33 [00:00<?, ?it/s]"
|
| 335 |
+
],
|
| 336 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 337 |
+
"version_major": 2,
|
| 338 |
+
"version_minor": 0,
|
| 339 |
+
"model_id": "e9cfddc47787435993179dcbfb1fb89c"
|
| 340 |
+
}
|
| 341 |
+
},
|
| 342 |
+
"metadata": {}
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"output_type": "stream",
|
| 346 |
+
"name": "stderr",
|
| 347 |
+
"text": [
|
| 348 |
+
"Setting `pad_token_id` to `eos_token_id`:2 for open-end generation.\n",
|
| 349 |
+
"/usr/local/lib/python3.10/dist-packages/transformers/generation/utils.py:1665: UserWarning: You are calling .generate() with the `input_ids` being on a device type different than your model's device. `input_ids` is on cpu, whereas the model is on cuda. You may experience unexpected behaviors or slower generation. Please make sure that you have put `input_ids` to the correct device by calling for example input_ids = input_ids.to('cuda') before running `.generate()`.\n",
|
| 350 |
+
" warnings.warn(\n"
|
| 351 |
+
]
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
"output_type": "stream",
|
| 355 |
+
"name": "stdout",
|
| 356 |
+
"text": [
|
| 357 |
+
" [INST] What was John Holt's vision on education? [/INST] 10 John Holt's vision on education was to create a system that would allow students to learn at their own pace. He believed that this would help students to become better learners. He also wanted to provide a platform that would allow students to learn in a safe environment. He believed that this would help students to become better learners. He also wanted to provide a platform that would allow students to learn in a safe environment. He believed that this would help students to become better learners. He also wanted to provide a platform that would allow students to learn in a safe environment. He believed that this would help students to become\n"
|
| 358 |
+
]
|
| 359 |
+
}
|
| 360 |
+
]
|
| 361 |
+
}
|
| 362 |
+
],
|
| 363 |
+
"metadata": {
|
| 364 |
+
"colab": {
|
| 365 |
+
"machine_shape": "hm",
|
| 366 |
+
"provenance": [],
|
| 367 |
+
"gpuType": "A100"
|
| 368 |
+
},
|
| 369 |
+
"kernelspec": {
|
| 370 |
+
"display_name": "Python 3",
|
| 371 |
+
"name": "python3"
|
| 372 |
+
},
|
| 373 |
+
"language_info": {
|
| 374 |
+
"name": "python"
|
| 375 |
+
},
|
| 376 |
+
"accelerator": "GPU",
|
| 377 |
+
"widgets": {
|
| 378 |
+
"application/vnd.jupyter.widget-state+json": {
|
| 379 |
+
"e9cfddc47787435993179dcbfb1fb89c": {
|
| 380 |
+
"model_module": "@jupyter-widgets/controls",
|
| 381 |
+
"model_name": "HBoxModel",
|
| 382 |
+
"model_module_version": "1.5.0",
|
| 383 |
+
"state": {
|
| 384 |
+
"_dom_classes": [],
|
| 385 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 386 |
+
"_model_module_version": "1.5.0",
|
| 387 |
+
"_model_name": "HBoxModel",
|
| 388 |
+
"_view_count": null,
|
| 389 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 390 |
+
"_view_module_version": "1.5.0",
|
| 391 |
+
"_view_name": "HBoxView",
|
| 392 |
+
"box_style": "",
|
| 393 |
+
"children": [
|
| 394 |
+
"IPY_MODEL_19f57b50941e4f929d12aadc944ce01b",
|
| 395 |
+
"IPY_MODEL_b27b7fcb570c4f95bf4adeefba1aa146",
|
| 396 |
+
"IPY_MODEL_05de7d1f41054d28b69479146f8cd557"
|
| 397 |
+
],
|
| 398 |
+
"layout": "IPY_MODEL_41b69b2ea8204f69b87d7ecc8c83977b"
|
| 399 |
+
}
|
| 400 |
+
},
|
| 401 |
+
"19f57b50941e4f929d12aadc944ce01b": {
|
| 402 |
+
"model_module": "@jupyter-widgets/controls",
|
| 403 |
+
"model_name": "HTMLModel",
|
| 404 |
+
"model_module_version": "1.5.0",
|
| 405 |
+
"state": {
|
| 406 |
+
"_dom_classes": [],
|
| 407 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 408 |
+
"_model_module_version": "1.5.0",
|
| 409 |
+
"_model_name": "HTMLModel",
|
| 410 |
+
"_view_count": null,
|
| 411 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 412 |
+
"_view_module_version": "1.5.0",
|
| 413 |
+
"_view_name": "HTMLView",
|
| 414 |
+
"description": "",
|
| 415 |
+
"description_tooltip": null,
|
| 416 |
+
"layout": "IPY_MODEL_3436fe87cab3486a829cd80f0805a099",
|
| 417 |
+
"placeholder": "",
|
| 418 |
+
"style": "IPY_MODEL_d7325fddbaea46639294e0831aa4df18",
|
| 419 |
+
"value": "Loading checkpoint shards: 100%"
|
| 420 |
+
}
|
| 421 |
+
},
|
| 422 |
+
"b27b7fcb570c4f95bf4adeefba1aa146": {
|
| 423 |
+
"model_module": "@jupyter-widgets/controls",
|
| 424 |
+
"model_name": "FloatProgressModel",
|
| 425 |
+
"model_module_version": "1.5.0",
|
| 426 |
+
"state": {
|
| 427 |
+
"_dom_classes": [],
|
| 428 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 429 |
+
"_model_module_version": "1.5.0",
|
| 430 |
+
"_model_name": "FloatProgressModel",
|
| 431 |
+
"_view_count": null,
|
| 432 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 433 |
+
"_view_module_version": "1.5.0",
|
| 434 |
+
"_view_name": "ProgressView",
|
| 435 |
+
"bar_style": "success",
|
| 436 |
+
"description": "",
|
| 437 |
+
"description_tooltip": null,
|
| 438 |
+
"layout": "IPY_MODEL_420b8967a123405bb6349b2bee24a4d3",
|
| 439 |
+
"max": 33,
|
| 440 |
+
"min": 0,
|
| 441 |
+
"orientation": "horizontal",
|
| 442 |
+
"style": "IPY_MODEL_c480548c4a3f42628cde8b011ababff0",
|
| 443 |
+
"value": 33
|
| 444 |
+
}
|
| 445 |
+
},
|
| 446 |
+
"05de7d1f41054d28b69479146f8cd557": {
|
| 447 |
+
"model_module": "@jupyter-widgets/controls",
|
| 448 |
+
"model_name": "HTMLModel",
|
| 449 |
+
"model_module_version": "1.5.0",
|
| 450 |
+
"state": {
|
| 451 |
+
"_dom_classes": [],
|
| 452 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 453 |
+
"_model_module_version": "1.5.0",
|
| 454 |
+
"_model_name": "HTMLModel",
|
| 455 |
+
"_view_count": null,
|
| 456 |
+
"_view_module": "@jupyter-widgets/controls",
|
| 457 |
+
"_view_module_version": "1.5.0",
|
| 458 |
+
"_view_name": "HTMLView",
|
| 459 |
+
"description": "",
|
| 460 |
+
"description_tooltip": null,
|
| 461 |
+
"layout": "IPY_MODEL_a28af63811954d6ebfbbb1d4ef437627",
|
| 462 |
+
"placeholder": "",
|
| 463 |
+
"style": "IPY_MODEL_f07257d9b18a4f69b2efea9550d12014",
|
| 464 |
+
"value": " 33/33 [11:07<00:00, 18.66s/it]"
|
| 465 |
+
}
|
| 466 |
+
},
|
| 467 |
+
"41b69b2ea8204f69b87d7ecc8c83977b": {
|
| 468 |
+
"model_module": "@jupyter-widgets/base",
|
| 469 |
+
"model_name": "LayoutModel",
|
| 470 |
+
"model_module_version": "1.2.0",
|
| 471 |
+
"state": {
|
| 472 |
+
"_model_module": "@jupyter-widgets/base",
|
| 473 |
+
"_model_module_version": "1.2.0",
|
| 474 |
+
"_model_name": "LayoutModel",
|
| 475 |
+
"_view_count": null,
|
| 476 |
+
"_view_module": "@jupyter-widgets/base",
|
| 477 |
+
"_view_module_version": "1.2.0",
|
| 478 |
+
"_view_name": "LayoutView",
|
| 479 |
+
"align_content": null,
|
| 480 |
+
"align_items": null,
|
| 481 |
+
"align_self": null,
|
| 482 |
+
"border": null,
|
| 483 |
+
"bottom": null,
|
| 484 |
+
"display": null,
|
| 485 |
+
"flex": null,
|
| 486 |
+
"flex_flow": null,
|
| 487 |
+
"grid_area": null,
|
| 488 |
+
"grid_auto_columns": null,
|
| 489 |
+
"grid_auto_flow": null,
|
| 490 |
+
"grid_auto_rows": null,
|
| 491 |
+
"grid_column": null,
|
| 492 |
+
"grid_gap": null,
|
| 493 |
+
"grid_row": null,
|
| 494 |
+
"grid_template_areas": null,
|
| 495 |
+
"grid_template_columns": null,
|
| 496 |
+
"grid_template_rows": null,
|
| 497 |
+
"height": null,
|
| 498 |
+
"justify_content": null,
|
| 499 |
+
"justify_items": null,
|
| 500 |
+
"left": null,
|
| 501 |
+
"margin": null,
|
| 502 |
+
"max_height": null,
|
| 503 |
+
"max_width": null,
|
| 504 |
+
"min_height": null,
|
| 505 |
+
"min_width": null,
|
| 506 |
+
"object_fit": null,
|
| 507 |
+
"object_position": null,
|
| 508 |
+
"order": null,
|
| 509 |
+
"overflow": null,
|
| 510 |
+
"overflow_x": null,
|
| 511 |
+
"overflow_y": null,
|
| 512 |
+
"padding": null,
|
| 513 |
+
"right": null,
|
| 514 |
+
"top": null,
|
| 515 |
+
"visibility": null,
|
| 516 |
+
"width": null
|
| 517 |
+
}
|
| 518 |
+
},
|
| 519 |
+
"3436fe87cab3486a829cd80f0805a099": {
|
| 520 |
+
"model_module": "@jupyter-widgets/base",
|
| 521 |
+
"model_name": "LayoutModel",
|
| 522 |
+
"model_module_version": "1.2.0",
|
| 523 |
+
"state": {
|
| 524 |
+
"_model_module": "@jupyter-widgets/base",
|
| 525 |
+
"_model_module_version": "1.2.0",
|
| 526 |
+
"_model_name": "LayoutModel",
|
| 527 |
+
"_view_count": null,
|
| 528 |
+
"_view_module": "@jupyter-widgets/base",
|
| 529 |
+
"_view_module_version": "1.2.0",
|
| 530 |
+
"_view_name": "LayoutView",
|
| 531 |
+
"align_content": null,
|
| 532 |
+
"align_items": null,
|
| 533 |
+
"align_self": null,
|
| 534 |
+
"border": null,
|
| 535 |
+
"bottom": null,
|
| 536 |
+
"display": null,
|
| 537 |
+
"flex": null,
|
| 538 |
+
"flex_flow": null,
|
| 539 |
+
"grid_area": null,
|
| 540 |
+
"grid_auto_columns": null,
|
| 541 |
+
"grid_auto_flow": null,
|
| 542 |
+
"grid_auto_rows": null,
|
| 543 |
+
"grid_column": null,
|
| 544 |
+
"grid_gap": null,
|
| 545 |
+
"grid_row": null,
|
| 546 |
+
"grid_template_areas": null,
|
| 547 |
+
"grid_template_columns": null,
|
| 548 |
+
"grid_template_rows": null,
|
| 549 |
+
"height": null,
|
| 550 |
+
"justify_content": null,
|
| 551 |
+
"justify_items": null,
|
| 552 |
+
"left": null,
|
| 553 |
+
"margin": null,
|
| 554 |
+
"max_height": null,
|
| 555 |
+
"max_width": null,
|
| 556 |
+
"min_height": null,
|
| 557 |
+
"min_width": null,
|
| 558 |
+
"object_fit": null,
|
| 559 |
+
"object_position": null,
|
| 560 |
+
"order": null,
|
| 561 |
+
"overflow": null,
|
| 562 |
+
"overflow_x": null,
|
| 563 |
+
"overflow_y": null,
|
| 564 |
+
"padding": null,
|
| 565 |
+
"right": null,
|
| 566 |
+
"top": null,
|
| 567 |
+
"visibility": null,
|
| 568 |
+
"width": null
|
| 569 |
+
}
|
| 570 |
+
},
|
| 571 |
+
"d7325fddbaea46639294e0831aa4df18": {
|
| 572 |
+
"model_module": "@jupyter-widgets/controls",
|
| 573 |
+
"model_name": "DescriptionStyleModel",
|
| 574 |
+
"model_module_version": "1.5.0",
|
| 575 |
+
"state": {
|
| 576 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 577 |
+
"_model_module_version": "1.5.0",
|
| 578 |
+
"_model_name": "DescriptionStyleModel",
|
| 579 |
+
"_view_count": null,
|
| 580 |
+
"_view_module": "@jupyter-widgets/base",
|
| 581 |
+
"_view_module_version": "1.2.0",
|
| 582 |
+
"_view_name": "StyleView",
|
| 583 |
+
"description_width": ""
|
| 584 |
+
}
|
| 585 |
+
},
|
| 586 |
+
"420b8967a123405bb6349b2bee24a4d3": {
|
| 587 |
+
"model_module": "@jupyter-widgets/base",
|
| 588 |
+
"model_name": "LayoutModel",
|
| 589 |
+
"model_module_version": "1.2.0",
|
| 590 |
+
"state": {
|
| 591 |
+
"_model_module": "@jupyter-widgets/base",
|
| 592 |
+
"_model_module_version": "1.2.0",
|
| 593 |
+
"_model_name": "LayoutModel",
|
| 594 |
+
"_view_count": null,
|
| 595 |
+
"_view_module": "@jupyter-widgets/base",
|
| 596 |
+
"_view_module_version": "1.2.0",
|
| 597 |
+
"_view_name": "LayoutView",
|
| 598 |
+
"align_content": null,
|
| 599 |
+
"align_items": null,
|
| 600 |
+
"align_self": null,
|
| 601 |
+
"border": null,
|
| 602 |
+
"bottom": null,
|
| 603 |
+
"display": null,
|
| 604 |
+
"flex": null,
|
| 605 |
+
"flex_flow": null,
|
| 606 |
+
"grid_area": null,
|
| 607 |
+
"grid_auto_columns": null,
|
| 608 |
+
"grid_auto_flow": null,
|
| 609 |
+
"grid_auto_rows": null,
|
| 610 |
+
"grid_column": null,
|
| 611 |
+
"grid_gap": null,
|
| 612 |
+
"grid_row": null,
|
| 613 |
+
"grid_template_areas": null,
|
| 614 |
+
"grid_template_columns": null,
|
| 615 |
+
"grid_template_rows": null,
|
| 616 |
+
"height": null,
|
| 617 |
+
"justify_content": null,
|
| 618 |
+
"justify_items": null,
|
| 619 |
+
"left": null,
|
| 620 |
+
"margin": null,
|
| 621 |
+
"max_height": null,
|
| 622 |
+
"max_width": null,
|
| 623 |
+
"min_height": null,
|
| 624 |
+
"min_width": null,
|
| 625 |
+
"object_fit": null,
|
| 626 |
+
"object_position": null,
|
| 627 |
+
"order": null,
|
| 628 |
+
"overflow": null,
|
| 629 |
+
"overflow_x": null,
|
| 630 |
+
"overflow_y": null,
|
| 631 |
+
"padding": null,
|
| 632 |
+
"right": null,
|
| 633 |
+
"top": null,
|
| 634 |
+
"visibility": null,
|
| 635 |
+
"width": null
|
| 636 |
+
}
|
| 637 |
+
},
|
| 638 |
+
"c480548c4a3f42628cde8b011ababff0": {
|
| 639 |
+
"model_module": "@jupyter-widgets/controls",
|
| 640 |
+
"model_name": "ProgressStyleModel",
|
| 641 |
+
"model_module_version": "1.5.0",
|
| 642 |
+
"state": {
|
| 643 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 644 |
+
"_model_module_version": "1.5.0",
|
| 645 |
+
"_model_name": "ProgressStyleModel",
|
| 646 |
+
"_view_count": null,
|
| 647 |
+
"_view_module": "@jupyter-widgets/base",
|
| 648 |
+
"_view_module_version": "1.2.0",
|
| 649 |
+
"_view_name": "StyleView",
|
| 650 |
+
"bar_color": null,
|
| 651 |
+
"description_width": ""
|
| 652 |
+
}
|
| 653 |
+
},
|
| 654 |
+
"a28af63811954d6ebfbbb1d4ef437627": {
|
| 655 |
+
"model_module": "@jupyter-widgets/base",
|
| 656 |
+
"model_name": "LayoutModel",
|
| 657 |
+
"model_module_version": "1.2.0",
|
| 658 |
+
"state": {
|
| 659 |
+
"_model_module": "@jupyter-widgets/base",
|
| 660 |
+
"_model_module_version": "1.2.0",
|
| 661 |
+
"_model_name": "LayoutModel",
|
| 662 |
+
"_view_count": null,
|
| 663 |
+
"_view_module": "@jupyter-widgets/base",
|
| 664 |
+
"_view_module_version": "1.2.0",
|
| 665 |
+
"_view_name": "LayoutView",
|
| 666 |
+
"align_content": null,
|
| 667 |
+
"align_items": null,
|
| 668 |
+
"align_self": null,
|
| 669 |
+
"border": null,
|
| 670 |
+
"bottom": null,
|
| 671 |
+
"display": null,
|
| 672 |
+
"flex": null,
|
| 673 |
+
"flex_flow": null,
|
| 674 |
+
"grid_area": null,
|
| 675 |
+
"grid_auto_columns": null,
|
| 676 |
+
"grid_auto_flow": null,
|
| 677 |
+
"grid_auto_rows": null,
|
| 678 |
+
"grid_column": null,
|
| 679 |
+
"grid_gap": null,
|
| 680 |
+
"grid_row": null,
|
| 681 |
+
"grid_template_areas": null,
|
| 682 |
+
"grid_template_columns": null,
|
| 683 |
+
"grid_template_rows": null,
|
| 684 |
+
"height": null,
|
| 685 |
+
"justify_content": null,
|
| 686 |
+
"justify_items": null,
|
| 687 |
+
"left": null,
|
| 688 |
+
"margin": null,
|
| 689 |
+
"max_height": null,
|
| 690 |
+
"max_width": null,
|
| 691 |
+
"min_height": null,
|
| 692 |
+
"min_width": null,
|
| 693 |
+
"object_fit": null,
|
| 694 |
+
"object_position": null,
|
| 695 |
+
"order": null,
|
| 696 |
+
"overflow": null,
|
| 697 |
+
"overflow_x": null,
|
| 698 |
+
"overflow_y": null,
|
| 699 |
+
"padding": null,
|
| 700 |
+
"right": null,
|
| 701 |
+
"top": null,
|
| 702 |
+
"visibility": null,
|
| 703 |
+
"width": null
|
| 704 |
+
}
|
| 705 |
+
},
|
| 706 |
+
"f07257d9b18a4f69b2efea9550d12014": {
|
| 707 |
+
"model_module": "@jupyter-widgets/controls",
|
| 708 |
+
"model_name": "DescriptionStyleModel",
|
| 709 |
+
"model_module_version": "1.5.0",
|
| 710 |
+
"state": {
|
| 711 |
+
"_model_module": "@jupyter-widgets/controls",
|
| 712 |
+
"_model_module_version": "1.5.0",
|
| 713 |
+
"_model_name": "DescriptionStyleModel",
|
| 714 |
+
"_view_count": null,
|
| 715 |
+
"_view_module": "@jupyter-widgets/base",
|
| 716 |
+
"_view_module_version": "1.2.0",
|
| 717 |
+
"_view_name": "StyleView",
|
| 718 |
+
"description_width": ""
|
| 719 |
+
}
|
| 720 |
+
}
|
| 721 |
+
}
|
| 722 |
+
}
|
| 723 |
+
},
|
| 724 |
+
"nbformat": 4,
|
| 725 |
+
"nbformat_minor": 0
|
| 726 |
+
}
|