OwenElliott commited on
Commit
2e4c665
1 Parent(s): 2678125

Update modeling_marqo_arctic_bge_chimera_m.py

Browse files
modeling_marqo_arctic_bge_chimera_m.py CHANGED
@@ -1,5 +1,6 @@
1
  import torch
2
  import torch.nn as nn
 
3
  from transformers import BertModel, PreTrainedModel, BertConfig, AutoModel
4
  from typing import List
5
  from .configuration_marqo_arctic_bge_chimera_m import ChimeraConfig
@@ -46,6 +47,7 @@ class Chimera(PreTrainedModel):
46
  token_type_ids=token_type_ids,
47
  )
48
  pooled_output = model_output[0][:, 0]
 
49
  embeddings.append(pooled_output)
50
 
51
  return torch.cat(embeddings, dim=-1)
 
1
  import torch
2
  import torch.nn as nn
3
+ import torch.nn.functional as F
4
  from transformers import BertModel, PreTrainedModel, BertConfig, AutoModel
5
  from typing import List
6
  from .configuration_marqo_arctic_bge_chimera_m import ChimeraConfig
 
47
  token_type_ids=token_type_ids,
48
  )
49
  pooled_output = model_output[0][:, 0]
50
+ pooled_output = F.normalize(pooled_output, p=2, dim=-1)
51
  embeddings.append(pooled_output)
52
 
53
  return torch.cat(embeddings, dim=-1)