xzuyn commited on
Commit
31b540f
1 Parent(s): 1e3f96a

Upload 8 files

Browse files
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 50256,
8
+ "embd_pdrop": 0.1,
9
+ "eos_token_id": 50256,
10
+ "initializer_range": 0.02,
11
+ "layer_norm_epsilon": 1e-05,
12
+ "model_type": "gpt2",
13
+ "n_ctx": 1024,
14
+ "n_embd": 1600,
15
+ "n_head": 12,
16
+ "n_layer": 12,
17
+ "n_positions": 1024,
18
+ "output_past": true,
19
+ "resid_pdrop": 0.1,
20
+ "summary_activation": null,
21
+ "summary_first_dropout": 0.1,
22
+ "summary_proj_to_labels": true,
23
+ "summary_type": "cls_index",
24
+ "summary_use_proj": true,
25
+ "task_specific_params": {
26
+ "text-generation": {
27
+ "do_sample": true,
28
+ "max_length": 50
29
+ }
30
+ },
31
+ "vocab_size": 50257
32
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 50256,
4
+ "eos_token_id": 50256,
5
+ "transformers_version": "4.27.0.dev0"
6
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53761927cfd2227ce36499107b66b3dcc2764101bd288d5d46040b84407fcae2
3
+ size 1854151118
pytorch_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba108df3f437e29200ba093d2aedd9e877d3d55ddf57b24eb0519e47a753f1a3
3
+ size 1854115872
stripper-gpt2.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import sys
3
+ from safetensors.torch import save_file
4
+
5
+
6
+ model = torch.load('pytorch_model.bin', map_location="cpu")
7
+ for key, value in model.items():
8
+ print(key)
9
+ # sys.exit() # Comment this out after you've found the key you wish to stop at, and also the final key you wish to keep.
10
+
11
+
12
+ stop_key = 'h.12.ln_1.weight' # The key you want to stop at (the previous key is kept)
13
+ final_keys = ['ln_f.weight', 'ln_f.bias'] # The final key/keys in the model which get saved.
14
+
15
+
16
+ stripped = {}
17
+ stopped = False
18
+ for key, value in model.items():
19
+ if key == stop_key:
20
+ stopped = True
21
+ continue
22
+
23
+ if key in final_keys:
24
+ stripped[key] = value
25
+
26
+ if stopped is False:
27
+ stripped[key] = value
28
+
29
+
30
+ save_file(stripped, 'pytorch_model_stripped.safetensors')
31
+ torch.save(stripped, 'pytorch_model_stripped.bin')
32
+
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
vocab.json ADDED
The diff for this file is too large to render. See raw diff