Feature Extraction
Transformers
Safetensors
vision-encoder-decoder
custom_code
anicolson commited on
Commit
11f8889
·
verified ·
1 Parent(s): 8c18a95

Upload model

Browse files
Files changed (1) hide show
  1. modelling_cxrrg.py +3 -3
modelling_cxrrg.py CHANGED
@@ -317,7 +317,7 @@ class CXRRGModel(VisionEncoderDecoderModel):
317
  )
318
  ])
319
 
320
- token_type_ids[ids[:, 0], ids[:, 1]] = self.config.section_ids[i + 1]
321
 
322
  return token_type_ids
323
 
@@ -333,7 +333,7 @@ class CXRRGModel(VisionEncoderDecoderModel):
333
  token_type_ids - token type identifiers.
334
  """
335
 
336
- token_type_ids = torch.full([token_ids.shape[0], 1], self.config.section_ids[0], dtype=torch.long, device=token_ids.device)
337
 
338
  # https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertTokenizer.create_token_type_ids_from_sequences.example
339
  token_ids = token_ids[:, :-1]
@@ -342,7 +342,7 @@ class CXRRGModel(VisionEncoderDecoderModel):
342
 
343
  # Find first occurrence of special token, which indicates the boundary between sections:
344
  exists = torch.any(token_ids == j, dim=1, keepdim=True)
345
- token_type_ids[exists] = self.config.section_ids[i + 1]
346
 
347
  return token_type_ids
348
 
 
317
  )
318
  ])
319
 
320
+ token_type_ids[ids[:, 0], ids[:, 1]] = self.config.decoder.section_ids[i + 1]
321
 
322
  return token_type_ids
323
 
 
333
  token_type_ids - token type identifiers.
334
  """
335
 
336
+ token_type_ids = torch.full([token_ids.shape[0], 1], self.config.decoder.section_ids[0], dtype=torch.long, device=token_ids.device)
337
 
338
  # https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertTokenizer.create_token_type_ids_from_sequences.example
339
  token_ids = token_ids[:, :-1]
 
342
 
343
  # Find first occurrence of special token, which indicates the boundary between sections:
344
  exists = torch.any(token_ids == j, dim=1, keepdim=True)
345
+ token_type_ids[exists] = self.config.decoder.section_ids[i + 1]
346
 
347
  return token_type_ids
348