lambkinbinge commited on
Commit
d7d79b9
·
verified ·
1 Parent(s): 15c9b3c

Initial upload of CarsonTalk 2.0

Browse files
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<|endoftext|>": 17418
3
+ }
carson_model_final_weights.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:695dc1afbc8dd07b8083bdf33e8e7f1c8d7f4c94946dd193f1eae9d1aa7f7798
3
+ size 171943913
config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": ["MiniTransformer"],
3
+ "vocab_size": 32000,
4
+ "hidden_size": 384,
5
+ "num_hidden_layers": 6,
6
+ "num_attention_heads": 8,
7
+ "max_position_embeddings": 512,
8
+ "model_type": "gpt2"
9
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
modeling_minitransformer.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import torch.nn as nn
3
+ from torch.nn import CrossEntropyLoss
4
+
5
+ class MiniTransformer(nn.Module):
6
+ def __init__(self, vocab_size, hidden_dim):
7
+ super().__init__()
8
+ self.embed = nn.Embedding(vocab_size, hidden_dim)
9
+ self.transformer = nn.Transformer(hidden_dim, nhead=8, num_encoder_layers=6)
10
+ self.out = nn.Linear(hidden_dim, vocab_size)
11
+
12
+ def forward(self, input_ids, attention_mask=None, labels=None):
13
+ x = self.embed(input_ids)
14
+ x = self.transformer(x, x)
15
+ logits = self.out(x)
16
+ loss = None
17
+ if labels is not None:
18
+ shift_logits = logits[:, :-1, :].contiguous()
19
+ shift_labels = labels[:, 1:].contiguous()
20
+ loss_fct = CrossEntropyLoss()
21
+ loss = loss_fct(shift_logits.view(-1, shift_logits.size(-1)), shift_labels.view(-1))
22
+ return {"loss": loss, "logits": logits}
special_tokens_map.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "mask_token": {
17
+ "content": "<mask>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "pad_token": {
24
+ "content": "<pad>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "unk_token": {
31
+ "content": "<unk>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ }
37
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "0": {
6
+ "content": "<s>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "1": {
14
+ "content": "<pad>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "2": {
22
+ "content": "</s>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "3": {
30
+ "content": "<unk>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "4": {
38
+ "content": "<mask>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "17418": {
46
+ "content": "<|endoftext|>",
47
+ "lstrip": false,
48
+ "normalized": true,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ }
53
+ },
54
+ "bos_token": "<s>",
55
+ "clean_up_tokenization_spaces": false,
56
+ "eos_token": "</s>",
57
+ "errors": "replace",
58
+ "extra_special_tokens": {},
59
+ "mask_token": "<mask>",
60
+ "model_max_length": 1000000000000000019884624838656,
61
+ "pad_token": "<pad>",
62
+ "tokenizer_class": "GPT2Tokenizer",
63
+ "unk_token": "<unk>"
64
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff