Upload model
Browse files- config.json +9 -18
- model.safetensors +2 -2
- modeling_CustomLEDForQA.py +6 -2
config.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"_name_or_path": "
|
| 3 |
-
"_num_labels": 3,
|
| 4 |
"activation_dropout": 0.0,
|
| 5 |
"activation_function": "gelu",
|
| 6 |
"architectures": [
|
|
@@ -8,12 +7,6 @@
|
|
| 8 |
],
|
| 9 |
"attention_dropout": 0.0,
|
| 10 |
"attention_window": [
|
| 11 |
-
1024,
|
| 12 |
-
1024,
|
| 13 |
-
1024,
|
| 14 |
-
1024,
|
| 15 |
-
1024,
|
| 16 |
-
1024,
|
| 17 |
1024,
|
| 18 |
1024,
|
| 19 |
1024,
|
|
@@ -27,17 +20,17 @@
|
|
| 27 |
"bos_token_id": 0,
|
| 28 |
"classif_dropout": 0.0,
|
| 29 |
"classifier_dropout": 0.0,
|
| 30 |
-
"d_model":
|
| 31 |
-
"decoder_attention_heads":
|
| 32 |
-
"decoder_ffn_dim":
|
| 33 |
"decoder_layerdrop": 0.0,
|
| 34 |
-
"decoder_layers":
|
| 35 |
"decoder_start_token_id": 2,
|
| 36 |
"dropout": 0.1,
|
| 37 |
-
"encoder_attention_heads":
|
| 38 |
-
"encoder_ffn_dim":
|
| 39 |
"encoder_layerdrop": 0.0,
|
| 40 |
-
"encoder_layers":
|
| 41 |
"eos_token_id": 2,
|
| 42 |
"gradient_checkpointing": false,
|
| 43 |
"init_std": 0.02,
|
|
@@ -45,10 +38,8 @@
|
|
| 45 |
"max_decoder_position_embeddings": 1024,
|
| 46 |
"max_encoder_position_embeddings": 16384,
|
| 47 |
"model_type": "led",
|
| 48 |
-
"num_hidden_layers":
|
| 49 |
-
"output_past": false,
|
| 50 |
"pad_token_id": 1,
|
| 51 |
-
"prefix": " ",
|
| 52 |
"torch_dtype": "float32",
|
| 53 |
"transformers_version": "4.35.0",
|
| 54 |
"use_cache": true,
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "allenai/led-base-16384",
|
|
|
|
| 3 |
"activation_dropout": 0.0,
|
| 4 |
"activation_function": "gelu",
|
| 5 |
"architectures": [
|
|
|
|
| 7 |
],
|
| 8 |
"attention_dropout": 0.0,
|
| 9 |
"attention_window": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
1024,
|
| 11 |
1024,
|
| 12 |
1024,
|
|
|
|
| 20 |
"bos_token_id": 0,
|
| 21 |
"classif_dropout": 0.0,
|
| 22 |
"classifier_dropout": 0.0,
|
| 23 |
+
"d_model": 768,
|
| 24 |
+
"decoder_attention_heads": 12,
|
| 25 |
+
"decoder_ffn_dim": 3072,
|
| 26 |
"decoder_layerdrop": 0.0,
|
| 27 |
+
"decoder_layers": 6,
|
| 28 |
"decoder_start_token_id": 2,
|
| 29 |
"dropout": 0.1,
|
| 30 |
+
"encoder_attention_heads": 12,
|
| 31 |
+
"encoder_ffn_dim": 3072,
|
| 32 |
"encoder_layerdrop": 0.0,
|
| 33 |
+
"encoder_layers": 6,
|
| 34 |
"eos_token_id": 2,
|
| 35 |
"gradient_checkpointing": false,
|
| 36 |
"init_std": 0.02,
|
|
|
|
| 38 |
"max_decoder_position_embeddings": 1024,
|
| 39 |
"max_encoder_position_embeddings": 16384,
|
| 40 |
"model_type": "led",
|
| 41 |
+
"num_hidden_layers": 6,
|
|
|
|
| 42 |
"pad_token_id": 1,
|
|
|
|
| 43 |
"torch_dtype": "float32",
|
| 44 |
"transformers_version": "4.35.0",
|
| 45 |
"use_cache": true,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fd556d7d74d025da749bb5e36c3c3163516ab32d3be851ae5c52ee2f6daf5f3e
|
| 3 |
+
size 417405656
|
modeling_CustomLEDForQA.py
CHANGED
|
@@ -6,13 +6,17 @@ import torch.nn as nn
|
|
| 6 |
class CustomLEDForQAModel(LEDPreTrainedModel):
|
| 7 |
config_class = LEDConfig
|
| 8 |
|
| 9 |
-
def __init__(self, config: LEDConfig):
|
| 10 |
|
| 11 |
super().__init__(config)
|
| 12 |
config.num_labels = 2
|
| 13 |
self.num_labels = config.num_labels
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels)
|
| 17 |
|
| 18 |
def forward(self, input_ids=None, attention_mask=None, global_attention_mask=None, start_positions=None, end_positions=None):
|
|
|
|
| 6 |
class CustomLEDForQAModel(LEDPreTrainedModel):
|
| 7 |
config_class = LEDConfig
|
| 8 |
|
| 9 |
+
def __init__(self, config: LEDConfig, checkpoint):
|
| 10 |
|
| 11 |
super().__init__(config)
|
| 12 |
config.num_labels = 2
|
| 13 |
self.num_labels = config.num_labels
|
| 14 |
|
| 15 |
+
if (checkpoint):
|
| 16 |
+
self.led = LEDModel.from_pretrained(checkpoint, config=config).get_encoder()
|
| 17 |
+
else:
|
| 18 |
+
self.led = LEDModel(config).get_encoder()
|
| 19 |
+
|
| 20 |
self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels)
|
| 21 |
|
| 22 |
def forward(self, input_ids=None, attention_mask=None, global_attention_mask=None, start_positions=None, end_positions=None):
|