ruhook commited on
Commit
9d4903e
·
verified ·
1 Parent(s): 3dca57b

Upload 7 files

Browse files
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ library_name: transformers
4
+ pipeline_tag: text-generation
5
+ language:
6
+ - en
7
+ tags:
8
+ - testing
9
+ - random-initialization
10
+ - gpt2
11
+ ---
12
+ # Tiny random GPT-2 for testing
13
+
14
+ This model is randomly initialized and **has not been trained**. It is for
15
+ testing upload, download, tokenization, and model loading only. Its output is
16
+ not meaningful and it is not suitable for real language tasks or benchmarking.
17
+ No pretrained model weights or training datasets were used.
18
+
19
+ Architecture: 1 GPT-2 layer, 1 attention head, 16 hidden dimensions,
20
+ 32 vocabulary tokens, and a maximum context length of 64 tokens.
21
+ Parameter count: 3792.
22
+
23
+ ## Usage
24
+ ```python
25
+ from transformers import AutoTokenizer, AutoModelForCausalLM
26
+
27
+ repo = "ruhook/test-ruhook"
28
+ tokenizer = AutoTokenizer.from_pretrained(repo)
29
+ model = AutoModelForCausalLM.from_pretrained(repo)
30
+ inputs = tokenizer("hello world", return_tensors="pt")
31
+ outputs = model.generate(**inputs, max_new_tokens=5, do_sample=False)
32
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
33
+ ```
34
+
35
+ Validated locally with Python 3, torch 2.2.2 and transformers 4.46.3.
36
+ The toy word-level tokenizer maps words outside its small vocabulary to UNK.
config.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation_function": "gelu_new",
3
+ "architectures": [
4
+ "GPT2LMHeadModel"
5
+ ],
6
+ "attn_pdrop": 0.1,
7
+ "bos_token_id": 2,
8
+ "embd_pdrop": 0.1,
9
+ "eos_token_id": 3,
10
+ "initializer_range": 0.02,
11
+ "layer_norm_epsilon": 1e-05,
12
+ "model_type": "gpt2",
13
+ "n_ctx": 64,
14
+ "n_embd": 16,
15
+ "n_head": 1,
16
+ "n_inner": 32,
17
+ "n_layer": 1,
18
+ "n_positions": 64,
19
+ "pad_token_id": 0,
20
+ "reorder_and_upcast_attn": false,
21
+ "resid_pdrop": 0.1,
22
+ "scale_attn_by_inverse_layer_idx": false,
23
+ "scale_attn_weights": true,
24
+ "summary_activation": null,
25
+ "summary_first_dropout": 0.1,
26
+ "summary_proj_to_labels": true,
27
+ "summary_type": "cls_index",
28
+ "summary_use_proj": true,
29
+ "torch_dtype": "float32",
30
+ "transformers_version": "4.46.3",
31
+ "use_cache": true,
32
+ "vocab_size": 32
33
+ }
generation_config.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 2,
4
+ "eos_token_id": 3,
5
+ "pad_token_id": 0,
6
+ "transformers_version": "4.46.3"
7
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c96ccdf45486148fb74372624cac7cc827f005453c2da736f0d688464a9f0117
3
+ size 16616
special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[BOS]",
3
+ "eos_token": "[EOS]",
4
+ "pad_token": "[PAD]",
5
+ "unk_token": "[UNK]"
6
+ }
tokenizer.json ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "[PAD]",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ },
15
+ {
16
+ "id": 1,
17
+ "content": "[UNK]",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ {
25
+ "id": 2,
26
+ "content": "[BOS]",
27
+ "single_word": false,
28
+ "lstrip": false,
29
+ "rstrip": false,
30
+ "normalized": false,
31
+ "special": true
32
+ },
33
+ {
34
+ "id": 3,
35
+ "content": "[EOS]",
36
+ "single_word": false,
37
+ "lstrip": false,
38
+ "rstrip": false,
39
+ "normalized": false,
40
+ "special": true
41
+ }
42
+ ],
43
+ "normalizer": null,
44
+ "pre_tokenizer": {
45
+ "type": "Whitespace"
46
+ },
47
+ "post_processor": null,
48
+ "decoder": null,
49
+ "model": {
50
+ "type": "WordLevel",
51
+ "vocab": {
52
+ "[PAD]": 0,
53
+ "[UNK]": 1,
54
+ "[BOS]": 2,
55
+ "[EOS]": 3,
56
+ "hello": 4,
57
+ "world": 5,
58
+ "this": 6,
59
+ "is": 7,
60
+ "a": 8,
61
+ "tiny": 9,
62
+ "test": 10,
63
+ "model": 11,
64
+ "the": 12,
65
+ "cat": 13,
66
+ "sat": 14,
67
+ "on": 15,
68
+ "mat": 16,
69
+ ".": 17,
70
+ "I": 18,
71
+ "you": 19,
72
+ "we": 20,
73
+ "like": 21,
74
+ "code": 22,
75
+ "and": 23,
76
+ "data": 24,
77
+ "good": 25,
78
+ "morning": 26,
79
+ "one": 27,
80
+ "two": 28,
81
+ "three": 29,
82
+ "yes": 30,
83
+ "no": 31
84
+ },
85
+ "unk_token": "[UNK]"
86
+ }
87
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[BOS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[EOS]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ }
35
+ },
36
+ "bos_token": "[BOS]",
37
+ "clean_up_tokenization_spaces": false,
38
+ "eos_token": "[EOS]",
39
+ "model_max_length": 64,
40
+ "pad_token": "[PAD]",
41
+ "tokenizer_class": "PreTrainedTokenizerFast",
42
+ "unk_token": "[UNK]"
43
+ }