include retnet modeling
Browse files- .gitmodules +3 -0
- RetNet +1 -0
- config.json +6 -4
- generation_config.json +7 -0
- modeling_retnet.py +8 -0
.gitmodules
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[submodule "RetNet"]
|
2 |
+
path = RetNet
|
3 |
+
url = https://github.com/syncdoth/RetNet.git
|
RetNet
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit a4253a7bc16519459320c140a7e3d14b5f017b32
|
config.json
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
{
|
2 |
"activation_dropout": 0.0,
|
3 |
"activation_fn": "swish",
|
4 |
-
"architectures": [
|
5 |
-
|
6 |
-
|
|
|
|
|
7 |
"decoder_embed_dim": 1280,
|
8 |
"decoder_ffn_embed_dim": 2560,
|
9 |
"decoder_layers": 12,
|
@@ -18,7 +20,7 @@
|
|
18 |
"initializer_range": 0.02,
|
19 |
"is_decoder": true,
|
20 |
"layernorm_embedding": true,
|
21 |
-
"layernorm_eps": 1e-
|
22 |
"model_type": "retnet",
|
23 |
"no_scale_embedding": false,
|
24 |
"output_retentions": false,
|
|
|
1 |
{
|
2 |
"activation_dropout": 0.0,
|
3 |
"activation_fn": "swish",
|
4 |
+
"architectures": ["LightNovelIntroRetNetModelConfig"],
|
5 |
+
"auto_map": {
|
6 |
+
"AutoConfig": "modeling_retnet.LightNovelIntroRetNetModelConfig",
|
7 |
+
"AutoModelForCausalLM": "modeling_retnet.LightNovelIntroRetNetModel"
|
8 |
+
},
|
9 |
"decoder_embed_dim": 1280,
|
10 |
"decoder_ffn_embed_dim": 2560,
|
11 |
"decoder_layers": 12,
|
|
|
20 |
"initializer_range": 0.02,
|
21 |
"is_decoder": true,
|
22 |
"layernorm_embedding": true,
|
23 |
+
"layernorm_eps": 1e-6,
|
24 |
"model_type": "retnet",
|
25 |
"no_scale_embedding": false,
|
26 |
"output_retentions": false,
|
generation_config.json
CHANGED
@@ -2,5 +2,12 @@
|
|
2 |
"_from_model_config": true,
|
3 |
"eos_token_id": 50256,
|
4 |
"pad_token_id": 50256,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
"transformers_version": "4.34.0"
|
6 |
}
|
|
|
2 |
"_from_model_config": true,
|
3 |
"eos_token_id": 50256,
|
4 |
"pad_token_id": 50256,
|
5 |
+
"do_sample": true,
|
6 |
+
"temperature": 1.0,
|
7 |
+
"top_p": 0.95,
|
8 |
+
"top_k": 20,
|
9 |
+
"no_repeat_ngram_size": 3,
|
10 |
+
"repetition_penalty": 1.2,
|
11 |
+
"num_beams": 1,
|
12 |
"transformers_version": "4.34.0"
|
13 |
}
|
modeling_retnet.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from RetNet.retnet.modeling_retnet import RetNetForCausalLM, RetNetConfig
|
2 |
+
|
3 |
+
|
4 |
+
LightNovelIntroRetNetModelConfig = RetNetConfig
|
5 |
+
|
6 |
+
|
7 |
+
class LightNovelIntroRetNetModel(RetNetForCausalLM):
|
8 |
+
config_class = LightNovelIntroRetNetModelConfig
|