bourdoiscatie
commited on
Commit
•
1ad0ed4
1
Parent(s):
d83cda3
Upload 9 files
Browse files- config.json +60 -0
- configuration_flash_t5.py +84 -0
- generation_config.json +7 -0
- optimizer.pt +3 -0
- pytorch_model.bin +3 -0
- rng_state.pth +3 -0
- scheduler.pt +3 -0
- trainer_state.json +0 -0
- training_args.bin +3 -0
config.json
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"alibi_mode": "symetric",
|
3 |
+
"architectures": [
|
4 |
+
"FlashT5ForConditionalGeneration"
|
5 |
+
],
|
6 |
+
"attention_dropout_rate": 0.0,
|
7 |
+
"attention_scale": 1.0,
|
8 |
+
"attention_type": "ref",
|
9 |
+
"auto_map": {
|
10 |
+
"AutoConfig": "configuration_flash_t5.FlashT5Config",
|
11 |
+
"AutoModel": "modeling_flash_t5.FlashT5ForConditionalGeneration",
|
12 |
+
"AutoModelForQuestionAnswering": "custom_heads_flash_t5.FlashT5ForQuestionAnswering",
|
13 |
+
"AutoModelForSeq2SeqLM": "modeling_flash_t5.FlashT5ForConditionalGeneration",
|
14 |
+
"AutoModelForSequenceClassification": "custom_heads_flash_t5.FlashT5ForSequenceClassification",
|
15 |
+
"AutoModelForTokenClassification": "custom_heads_flash_t5.FlashT5ForTokenClassification"
|
16 |
+
},
|
17 |
+
"classifier_dropout": 0.0,
|
18 |
+
"d_ff": 1024,
|
19 |
+
"d_kv": 64,
|
20 |
+
"d_model": 512,
|
21 |
+
"decoder_start_token_id": 0,
|
22 |
+
"dense_act_fn": "relu",
|
23 |
+
"dropout_rate": 0.0,
|
24 |
+
"eos_token_id": 1,
|
25 |
+
"feed_forward_proj": "relu",
|
26 |
+
"fire_mlp_width": 32,
|
27 |
+
"initializer_factor": 1.0,
|
28 |
+
"is_encoder_decoder": false,
|
29 |
+
"is_gated_act": false,
|
30 |
+
"label_smoothing": 0.0,
|
31 |
+
"layer_norm_epsilon": 1e-06,
|
32 |
+
"max_sequence_length": 1024,
|
33 |
+
"model_type": "flash_t5",
|
34 |
+
"num_decoder_layers": 8,
|
35 |
+
"num_heads": 6,
|
36 |
+
"num_layers": 8,
|
37 |
+
"pad_token_id": 3,
|
38 |
+
"position_encoding_type": "t5",
|
39 |
+
"relative_attention_max_distance": 128,
|
40 |
+
"relative_attention_num_buckets": 32,
|
41 |
+
"rotary_base": 10000,
|
42 |
+
"rotary_emb_fraction": 1.0,
|
43 |
+
"rotary_interleaved": false,
|
44 |
+
"rotary_scale_base": null,
|
45 |
+
"tie_word_embeddings": false,
|
46 |
+
"torch_dtype": "float32",
|
47 |
+
"transformers_version": "4.42.3",
|
48 |
+
"use_cache": true,
|
49 |
+
"use_flash_attention": "triton",
|
50 |
+
"use_full_bias_size": false,
|
51 |
+
"use_gelu_act": true,
|
52 |
+
"use_glu_mlp": true,
|
53 |
+
"use_masking": false,
|
54 |
+
"use_randomized_position_encoding": false,
|
55 |
+
"use_triton_crossentropy": true,
|
56 |
+
"use_triton_gated_mlp": false,
|
57 |
+
"use_triton_layernorm": true,
|
58 |
+
"vocab_size": 32768,
|
59 |
+
"z_loss": 0.0001
|
60 |
+
}
|
configuration_flash_t5.py
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import sys
|
2 |
+
from collections import OrderedDict
|
3 |
+
from typing import Mapping
|
4 |
+
import logging
|
5 |
+
|
6 |
+
from transformers import T5Config
|
7 |
+
|
8 |
+
AUTO_MAP = {
|
9 |
+
"AutoModel": "modeling_flash_t5.FlashT5ForConditionalGeneration",
|
10 |
+
"AutoModelForSeq2SeqLM": "modeling_flash_t5.FlashT5ForConditionalGeneration",
|
11 |
+
"AutoModelForTokenClassification": "custom_heads_flash_t5.FlashT5ForTokenClassification",
|
12 |
+
"AutoModelForQuestionAnswering": "custom_heads_flash_t5.FlashT5ForQuestionAnswering",
|
13 |
+
"AutoModelForSequenceClassification": "custom_heads_flash_t5.FlashT5ForSequenceClassification",
|
14 |
+
}
|
15 |
+
|
16 |
+
class FlashT5Config(T5Config):
|
17 |
+
|
18 |
+
model_type = "flash_t5"
|
19 |
+
|
20 |
+
def __init__(
|
21 |
+
self,
|
22 |
+
decoder_start_token_id=0,
|
23 |
+
pad_token_id=-100,
|
24 |
+
use_glu_mlp=False,
|
25 |
+
position_encoding_type="t5",
|
26 |
+
use_randomized_position_encoding=False,
|
27 |
+
label_smoothing=0.0,
|
28 |
+
z_loss=None,
|
29 |
+
attention_type="ref",
|
30 |
+
max_sequence_length=1024,
|
31 |
+
attention_dropout_rate=0.0,
|
32 |
+
alibi_mode="symetric",
|
33 |
+
use_triton_layernorm=False,
|
34 |
+
use_triton_crossentropy=False,
|
35 |
+
use_triton_gated_mlp=False,
|
36 |
+
use_gelu_act=True,
|
37 |
+
use_full_bias_size=False,
|
38 |
+
rotary_emb_fraction=1.0,
|
39 |
+
rotary_base=10000,
|
40 |
+
rotary_interleaved=False,
|
41 |
+
rotary_scale_base=None,
|
42 |
+
fire_mlp_width=32,
|
43 |
+
use_masking=False,
|
44 |
+
attention_scale=None,
|
45 |
+
**kwargs,
|
46 |
+
):
|
47 |
+
super().__init__(**kwargs)
|
48 |
+
|
49 |
+
self.decoder_start_token_id = decoder_start_token_id
|
50 |
+
self.pad_token_id = pad_token_id
|
51 |
+
self.use_glu_mlp = use_glu_mlp
|
52 |
+
self.position_encoding_type = position_encoding_type
|
53 |
+
self.use_randomized_position_encoding = use_randomized_position_encoding
|
54 |
+
self.label_smoothing = label_smoothing
|
55 |
+
self.z_loss = z_loss
|
56 |
+
self.attention_type = attention_type
|
57 |
+
self.max_sequence_length = max_sequence_length
|
58 |
+
self.alibi_mode = alibi_mode
|
59 |
+
self.attention_dropout_rate = attention_dropout_rate
|
60 |
+
self.use_triton_layernorm = use_triton_layernorm
|
61 |
+
self.use_triton_crossentropy = use_triton_crossentropy
|
62 |
+
self.use_triton_gated_mlp = use_triton_gated_mlp
|
63 |
+
self.use_gelu_act = use_gelu_act
|
64 |
+
self.use_full_bias_size = use_full_bias_size
|
65 |
+
self.rotary_base = rotary_base
|
66 |
+
self.rotary_interleaved = rotary_interleaved
|
67 |
+
self.rotary_scale_base = rotary_scale_base
|
68 |
+
self.rotary_emb_fraction = rotary_emb_fraction
|
69 |
+
self.fire_mlp_width = fire_mlp_width
|
70 |
+
self.use_masking = use_masking
|
71 |
+
self.attention_scale = attention_scale
|
72 |
+
|
73 |
+
self.auto_map = AUTO_MAP
|
74 |
+
|
75 |
+
def str_to_class(classname):
|
76 |
+
return getattr(sys.modules[__name__], classname)
|
77 |
+
|
78 |
+
# Register model in Auto API
|
79 |
+
try:
|
80 |
+
FlashT5Config.register_for_auto_class()
|
81 |
+
for key, value in AUTO_MAP.items():
|
82 |
+
str_to_class(value.split(".")[-1]).register_for_auto_class(key)
|
83 |
+
except:
|
84 |
+
logging.warn("AutoRegister isn't available.")
|
generation_config.json
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"decoder_start_token_id": 0,
|
4 |
+
"eos_token_id": 1,
|
5 |
+
"pad_token_id": 3,
|
6 |
+
"transformers_version": "4.42.3"
|
7 |
+
}
|
optimizer.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fa38aa9103205dbc3d61430bc913c4a717a85d272fb395bf7f582856369fa572
|
3 |
+
size 621095482
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f1fc9ba48bdef31e462c54206ad291f9037263b46df389d578dc91b7bc980fc9
|
3 |
+
size 310533314
|
rng_state.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3f56d72e430dbd41e1d5be36a03fc30b7ed76db0ffce725ffcb770dd624c2c7a
|
3 |
+
size 14244
|
scheduler.pt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1df75838ab9f2b870a5502f483aa0a4f4634e4583f3682dc92e406347f699efa
|
3 |
+
size 1256
|
trainer_state.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
training_args.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:16b1124f4756c43674bdaabb10312885654ecc2f3ba68e50e8365d2409fb1a01
|
3 |
+
size 5176
|