anicolson commited on
Commit
84bbf2b
·
verified ·
1 Parent(s): f26c980

Upload model

Browse files
config.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "_commit_hash": null,
3
  "architectures": [
4
  "MultiCXREncoderDecoderModel"
5
  ],
@@ -78,7 +77,6 @@
78
  "top_p": 1.0,
79
  "torch_dtype": null,
80
  "torchscript": false,
81
- "transformers_version": "4.31.0",
82
  "type_vocab_size": 2,
83
  "typical_p": 1.0,
84
  "use_bfloat16": false,
@@ -2243,7 +2241,6 @@
2243
  "top_p": 1.0,
2244
  "torch_dtype": "float32",
2245
  "torchscript": false,
2246
- "transformers_version": "4.31.0",
2247
  "typical_p": 1.0,
2248
  "use_bfloat16": false
2249
  },
@@ -2251,5 +2248,5 @@
2251
  "model_type": "vision-encoder-decoder",
2252
  "tie_word_embeddings": false,
2253
  "torch_dtype": "float32",
2254
- "transformers_version": null
2255
  }
 
1
  {
 
2
  "architectures": [
3
  "MultiCXREncoderDecoderModel"
4
  ],
 
77
  "top_p": 1.0,
78
  "torch_dtype": null,
79
  "torchscript": false,
 
80
  "type_vocab_size": 2,
81
  "typical_p": 1.0,
82
  "use_bfloat16": false,
 
2241
  "top_p": 1.0,
2242
  "torch_dtype": "float32",
2243
  "torchscript": false,
 
2244
  "typical_p": 1.0,
2245
  "use_bfloat16": false
2246
  },
 
2248
  "model_type": "vision-encoder-decoder",
2249
  "tie_word_embeddings": false,
2250
  "torch_dtype": "float32",
2251
+ "transformers_version": "4.36.2"
2252
  }
generation_config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
  "_from_model_config": true,
3
  "pad_token_id": 0,
4
- "transformers_version": "4.31.0"
5
  }
 
1
  {
2
  "_from_model_config": true,
3
  "pad_token_id": 0,
4
+ "transformers_version": "4.36.2"
5
  }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6640d7d1687ce14e46f620f37c7df0eaf57bc9534a8314950e41e5faf08eed3e
3
+ size 449521072
modelling_multi.py CHANGED
@@ -6,7 +6,8 @@ import transformers
6
  from torch.nn import CrossEntropyLoss
7
  from transformers import PreTrainedTokenizerFast, VisionEncoderDecoderModel
8
  from transformers.configuration_utils import PretrainedConfig
9
- from transformers.modeling_outputs import BaseModelOutput, Seq2SeqLMOutput
 
10
  from transformers.modeling_utils import PreTrainedModel
11
  from transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder import \
12
  VisionEncoderDecoderConfig
@@ -21,11 +22,6 @@ class CvtWithProjectionHeadConfig(transformers.CvtConfig):
21
  self.projection_size = projection_size
22
 
23
 
24
- class ModelOutputWithProjectionEmbedding(transformers.modeling_outputs.ModelOutput):
25
- last_hidden_state: torch.FloatTensor
26
- attention_mask: torch.FloatTensor
27
-
28
-
29
  class CvtProjectionHead(torch.nn.Module):
30
 
31
  def __init__(self, config) -> None:
@@ -59,7 +55,7 @@ class MultiCvtWithProjectionHead(transformers.CvtPreTrainedModel):
59
  pixel_values: Optional[torch.Tensor] = None,
60
  output_hidden_states: Optional[bool] = None,
61
  return_dict: Optional[bool] = None,
62
- ) -> Union[Tuple, ModelOutputWithProjectionEmbedding]:
63
 
64
  return_dict = return_dict if return_dict is not None else self.config.use_return_dict
65
 
@@ -85,7 +81,7 @@ class MultiCvtWithProjectionHead(transformers.CvtPreTrainedModel):
85
  if not return_dict:
86
  return projection
87
 
88
- return ModelOutputWithProjectionEmbedding(
89
  last_hidden_state=projection, attention_mask=attention_mask,
90
  )
91
 
 
6
  from torch.nn import CrossEntropyLoss
7
  from transformers import PreTrainedTokenizerFast, VisionEncoderDecoderModel
8
  from transformers.configuration_utils import PretrainedConfig
9
+ from transformers.modeling_outputs import (BaseModelOutput, ModelOutput,
10
+ Seq2SeqLMOutput)
11
  from transformers.modeling_utils import PreTrainedModel
12
  from transformers.models.vision_encoder_decoder.configuration_vision_encoder_decoder import \
13
  VisionEncoderDecoderConfig
 
22
  self.projection_size = projection_size
23
 
24
 
 
 
 
 
 
25
  class CvtProjectionHead(torch.nn.Module):
26
 
27
  def __init__(self, config) -> None:
 
55
  pixel_values: Optional[torch.Tensor] = None,
56
  output_hidden_states: Optional[bool] = None,
57
  return_dict: Optional[bool] = None,
58
+ ) -> Union[Tuple, ModelOutput]:
59
 
60
  return_dict = return_dict if return_dict is not None else self.config.use_return_dict
61
 
 
81
  if not return_dict:
82
  return projection
83
 
84
+ return ModelOutput(
85
  last_hidden_state=projection, attention_mask=attention_mask,
86
  )
87