File size: 21,569 Bytes
35e23cc 8398dfc 35e23cc 8398dfc 35e23cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/kyrylo/Sem-7/Anlp/Grokking/Minimal/lib/python3.8/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n"
]
}
],
"source": [
"import torch\n",
"from transformers import AutoModelForCausalLM, AutoTokenizer\n",
"from huggingface_hub import hf_hub_download, upload_folder\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'tokenizer.json'"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"\n",
"model_name = \"gpt2\" # Replace with the Hugging Face model name you want to convert\n",
"local_dir = \"./\" # to store the GGML model\n",
"\n",
"model_path = hf_hub_download(repo_id='openai-community/gpt2', filename=\"pytorch_model.bin\", local_dir=local_dir) \n",
"model_path = hf_hub_download(repo_id='openai-community/gpt2', filename=\"config.json\", local_dir=local_dir) \n",
"model_path = hf_hub_download(repo_id='openai-community/gpt2', filename=\"tokenizer.json\", local_dir=local_dir) \n",
"model_path"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_96016/408161957.py:1: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.\n",
" model =torch.load(f'./pytorch_model.bin')\n"
]
}
],
"source": [
"model =torch.load(f'./pytorch_model.bin')\n",
"torch.save(model, './pytorch_model.bin', _use_new_zipfile_serialization=True)\n",
"# ! rm pytorch_model.bin"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO:hf-to-gguf:Loading model: \n",
"INFO:gguf.gguf_writer:gguf: This GGUF file is for Little Endian only\n",
"INFO:hf-to-gguf:Exporting model...\n",
"INFO:hf-to-gguf:gguf: loading model part 'pytorch_model.bin'\n",
"INFO:hf-to-gguf:token_embd.weight, torch.float32 --> Q8_0, shape = {768, 50257}\n",
"INFO:hf-to-gguf:output.weight, torch.float32 --> Q8_0, shape = {768, 50257}\n",
"INFO:hf-to-gguf:position_embd.weight, torch.float32 --> F32, shape = {768, 1024}\n",
"INFO:hf-to-gguf:blk.0.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.0.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.0.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.0.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.0.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.0.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.0.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.0.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.0.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.0.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.0.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.0.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.1.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.1.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.1.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.1.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.1.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.1.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.1.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.2.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.2.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.2.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.2.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.2.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.2.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.2.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.3.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.3.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.3.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.3.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.3.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.3.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.3.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.4.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.4.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.4.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.4.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.4.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.4.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.4.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.5.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.5.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.5.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.5.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.5.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.5.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.5.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.6.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.6.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.6.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.6.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.6.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.6.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.6.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.7.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.7.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.7.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.7.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.7.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.7.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.7.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.8.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.8.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.8.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.8.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.8.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.8.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.8.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.9.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.9.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.9.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.9.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.9.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.9.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.9.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.10.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.10.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.10.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.10.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.10.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.10.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.10.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.attn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.attn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.attn_qkv.weight, torch.float32 --> Q8_0, shape = {768, 2304}\n",
"INFO:hf-to-gguf:blk.11.attn_qkv.bias, torch.float32 --> F32, shape = {2304}\n",
"INFO:hf-to-gguf:blk.11.attn_output.weight, torch.float32 --> Q8_0, shape = {768, 768}\n",
"INFO:hf-to-gguf:blk.11.attn_output.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.ffn_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.ffn_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:blk.11.ffn_up.weight, torch.float32 --> Q8_0, shape = {768, 3072}\n",
"INFO:hf-to-gguf:blk.11.ffn_up.bias, torch.float32 --> F32, shape = {3072}\n",
"INFO:hf-to-gguf:blk.11.ffn_down.weight, torch.float32 --> Q8_0, shape = {3072, 768}\n",
"INFO:hf-to-gguf:blk.11.ffn_down.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:output_norm.weight, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:output_norm.bias, torch.float32 --> F32, shape = {768}\n",
"INFO:hf-to-gguf:Set meta model\n",
"INFO:hf-to-gguf:Set model parameters\n",
"INFO:hf-to-gguf:Set model tokenizer\n",
"DEBUG:hf-to-gguf:chktok: [198, 220, 628, 220, 628, 198, 220, 197, 220, 197, 197, 220, 197, 198, 220, 220, 198, 220, 220, 220, 198, 220, 220, 220, 220, 198, 220, 220, 220, 220, 220, 198, 8582, 248, 222, 357, 11265, 8, 30325, 114, 447, 235, 8582, 234, 104, 37929, 357, 48101, 795, 13210, 271, 1673, 36686, 515, 8, 14519, 227, 12520, 99, 247, 8582, 99, 247, 513, 4747, 23460, 513, 20370, 23460, 2091, 23460, 20370, 23460, 24840, 23460, 2091, 20370, 513, 13, 18, 513, 492, 18, 513, 986, 18, 28053, 252, 222, 157, 252, 114, 157, 252, 241, 157, 253, 233, 157, 252, 237, 157, 253, 224, 157, 252, 244, 157, 252, 115, 157, 252, 253, 157, 253, 223, 157, 252, 253, 157, 252, 95, 157, 252, 114, 157, 252, 227, 47249, 223, 5633, 22755, 239, 46349, 111, 28839, 101, 18040, 32432, 98, 43291, 1485, 1415, 24309, 25465, 171, 121, 252, 40103, 1421, 18604, 12466, 121, 16843, 141, 231, 15166, 12466, 121, 16142, 12466, 239, 141, 232, 30143, 140, 111, 16142, 21169, 21727, 31583, 18849, 705, 39115, 6, 33153, 15506, 63, 15931, 15931, 16317, 13896, 3228, 9805, 3548, 314, 1053, 587, 705, 44040, 339, 338, 612, 11, 705, 2200, 345, 1654, 30, 705, 44, 407, 1654, 314, 1183, 787, 340, 11, 705, 35, 345, 588, 617, 8887, 30, 775, 6, 26979, 257, 6, 75, 43]\n",
"DEBUG:hf-to-gguf:chkhsh: 3ce83efda5659b07b1ad37ca97ca5797ea4285d9b9ab0dc679e4a720c9da7454\n",
"DEBUG:hf-to-gguf:tokenizer.ggml.pre: 'gpt-2'\n",
"DEBUG:hf-to-gguf:chkhsh: 3ce83efda5659b07b1ad37ca97ca5797ea4285d9b9ab0dc679e4a720c9da7454\n",
"INFO:gguf.vocab:Adding 50000 merge(s).\n",
"INFO:gguf.vocab:Setting special token type bos to 50256\n",
"INFO:gguf.vocab:Setting special token type eos to 50256\n",
"INFO:hf-to-gguf:Set model quantization version\n",
"INFO:gguf.gguf_writer:Writing the following files:\n",
"INFO:gguf.gguf_writer:gpt2.ggml: n_tensors = 149, total_size = 175.9M\n",
"Writing: 100%|βββββββββββββββββββββββββββββ| 176M/176M [00:01<00:00, 129Mbyte/s]\n",
"INFO:hf-to-gguf:Model successfully exported to gpt2.ggml\n"
]
}
],
"source": [
"!../llama.cpp/convert_hf_to_gguf.py --outfile {local_dir}/{model_name}.ggml --outtype q8_0 --verbose ./"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/kyrylo/Sem-7/Anlp/Grokking/Minimal/lib/python3.8/site-packages/huggingface_hub/hf_api.py:9628: UserWarning: Warnings while validating metadata in README.md:\n",
"- empty or missing yaml metadata in repo card\n",
" warnings.warn(f\"Warnings while validating metadata in README.md:\\n{message}\")\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Directory './' pushed to: kyrylokumar/gpt2-quantzed-gguf\n"
]
}
],
"source": [
"from huggingface_hub import create_repo, upload_folder\n",
"\n",
"\n",
"repo_id = \"kyrylokumar/gpt2-quantzed-gguf\" \n",
"create_repo(repo_id=repo_id, exist_ok=True) # exist_ok=True avoids errors if the repo already exists\n",
"\n",
"# Upload the folder\n",
"local_dir = \"./\" # Path to the directory you want to upload\n",
"upload_folder(\n",
" repo_id=repo_id,\n",
" folder_path=local_dir,\n",
" commit_message=\"Added extra files\", # Optional commit message\n",
" ignore_patterns=\".git*\", # Optional: ignore .git files and other patterns\n",
")\n",
"\n",
"print(f\"Directory '{local_dir}' pushed to: {repo_id}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Minimal",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|