AliMuhammad73 commited on
Commit
488dabf
·
1 Parent(s): 5633754
.gitignore CHANGED
@@ -1,3 +1,4 @@
 
1
  /Model/
2
  /Tokenizer/
3
  *.pth
 
1
+ /hf_model/
2
  /Model/
3
  /Tokenizer/
4
  *.pth
config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "_attn_implementation_autoset": true,
3
- "block_size": 1024,
4
- "dropout": 0.2,
5
- "model_type": "gpt_custom",
6
- "n_embd": 768,
7
- "n_head": 12,
8
- "n_layer": 12,
9
- "transformers_version": "4.46.2",
10
- "vocab_size": 20000
11
- }
 
 
 
 
 
 
 
 
 
 
 
 
modeling_gpt_custom.py DELETED
@@ -1,33 +0,0 @@
1
- from transformers import PreTrainedModel, PretrainedConfig, AutoModel, AutoConfig
2
- import torch
3
- from Naive_gpt.model import GPTLanguageModel
4
-
5
- class GPTConfig(PretrainedConfig):
6
- model_type = "gpt_custom"
7
-
8
- def __init__(self, vocab_size=20000, **kwargs):
9
- super().__init__(**kwargs)
10
- self.vocab_size = vocab_size
11
- self.block_size = 1024
12
- self.n_embd = 768
13
- self.n_head = 12
14
- self.n_layer = 12
15
- self.dropout = 0.2
16
-
17
- class GPTModelHF(PreTrainedModel):
18
- config_class = GPTConfig
19
-
20
- def __init__(self, config):
21
- super().__init__(config)
22
- self.model = GPTLanguageModel(config.vocab_size, config)
23
- self.config = config
24
-
25
- def forward(self, x):
26
- return self.model(x)
27
-
28
- def generate(self, idx, max_new_tokens):
29
- return self.model.generate(idx, max_new_tokens)
30
-
31
- # Register the model (this will run when the file is imported)
32
- AutoConfig.register("gpt_custom", GPTConfig)
33
- AutoModel.register(GPTConfig, GPTModelHF)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pytorch_model.bin DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:98621e405ea217da4b3906ae0ebe10862d9225d7ca9479ed714a0576e407b31e
3
- size 404940190
 
 
 
 
tokenizer_config.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "type": "llama",
3
- "vocab_size": 20000
4
- }