Fill-Mask
Transformers
Safetensors
gte

feat(transformers): Add native Transformers config

#2
Files changed (2) hide show
  1. README.md +17 -1
  2. config.json +10 -21
README.md CHANGED
@@ -1,5 +1,6 @@
1
  ---
2
  license: apache-2.0
 
3
  datasets:
4
  - allenai/c4
5
  - wikimedia/wikipedia
@@ -86,6 +87,21 @@ pipeline_tag: fill-mask
86
 
87
  ## gte-multilingual-mlm-base
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  We introduce `mGTE` series, new generalized text encoder, embedding and reranking models that support 75 languages and the context length of up to 8192.
91
  The models are built upon the transformer++ encoder backbone (BERT + RoPE + GLU, code refer to [Alibaba-NLP/new-impl](https://huggingface.co/Alibaba-NLP/new-impl))
@@ -95,7 +111,7 @@ This text encoder (`mGTE-MLM-8192` in our [paper](https://arxiv.org/pdf/2407.196
95
  in both [GLUE](https://aclanthology.org/W18-5446.pdf) and [XTREME-R](https://aclanthology.org/2021.emnlp-main.802.pdf).
96
 
97
  - **Developed by**: Institute for Intelligent Computing, Alibaba Group
98
- - **Model type**: Text Encoder
99
  - **Paper**: [mGTE: Generalized Long-Context Text Representation and Reranking
100
  Models for Multilingual Text Retrieval](https://arxiv.org/pdf/2407.19669).
101
 
 
1
  ---
2
  license: apache-2.0
3
+ library_name: transformers
4
  datasets:
5
  - allenai/c4
6
  - wikimedia/wikipedia
 
87
 
88
  ## gte-multilingual-mlm-base
89
 
90
+ > [!NOTE]
91
+ > This model now works natively with Hugging Face `transformers` (`transformers>=5.18.0`) without `trust_remote_code=True`. The original model weights and tokenizer are unchanged.
92
+ >
93
+ > The native `transformers` configuration updates were merged from [tomaarsen/gte-multilingual-mlm-base-native](https://huggingface.co/tomaarsen/gte-multilingual-mlm-base-native) by [@tomaarsen](https://huggingface.co/tomaarsen), building on the native GTE implementation added to `transformers` ([huggingface/transformers#48416](https://github.com/huggingface/transformers/pull/48416)) and initial Hub PR by [@harshaljanjani](https://huggingface.co/harshaljanjani).
94
+ >
95
+ > ```python
96
+ > from transformers import AutoModelForMaskedLM, AutoTokenizer
97
+ >
98
+ > model_id = "Alibaba-NLP/gte-multilingual-mlm-base"
99
+ > tokenizer = AutoTokenizer.from_pretrained(model_id)
100
+ > model = AutoModelForMaskedLM.from_pretrained(model_id)
101
+ > ```
102
+ >
103
+ > It also serves as a strong base model for retrieval fine-tuning, including with [`sentence_transformers.SparseEncoder`](https://sbert.net/docs/sparse_encoder/training_overview.html). For older versions (`transformers<5.18.0`), pin `revision="b747c5e"` with `trust_remote_code=True`.
104
+
105
 
106
  We introduce `mGTE` series, new generalized text encoder, embedding and reranking models that support 75 languages and the context length of up to 8192.
107
  The models are built upon the transformer++ encoder backbone (BERT + RoPE + GLU, code refer to [Alibaba-NLP/new-impl](https://huggingface.co/Alibaba-NLP/new-impl))
 
111
  in both [GLUE](https://aclanthology.org/W18-5446.pdf) and [XTREME-R](https://aclanthology.org/2021.emnlp-main.802.pdf).
112
 
113
  - **Developed by**: Institute for Intelligent Computing, Alibaba Group
114
+ - **Model type**: Bidirectional Language Model, Text Encoder
115
  - **Paper**: [mGTE: Generalized Long-Context Text Representation and Reranking
116
  Models for Multilingual Text Retrieval](https://arxiv.org/pdf/2407.19669).
117
 
config.json CHANGED
@@ -1,38 +1,27 @@
1
  {
2
- "architectures": [
3
- "NewForMaskedLM"
4
  ],
5
  "attention_probs_dropout_prob": 0.0,
6
- "auto_map": {
7
- "AutoConfig": "Alibaba-NLP/new-impl--configuration.NewConfig",
8
- "AutoModelForMaskedLM": "Alibaba-NLP/new-impl--modeling.NewForMaskedLM",
9
- "AutoModel": "Alibaba-NLP/new-impl--modeling.NewModel",
10
- "AutoModelForMultipleChoice": "Alibaba-NLP/new-impl--modeling.NewForMultipleChoice",
11
- "AutoModelForQuestionAnswering": "Alibaba-NLP/new-impl--modeling.NewForQuestionAnswering",
12
- "AutoModelForSequenceClassification": "Alibaba-NLP/new-impl--modeling.NewForSequenceClassification",
13
- "AutoModelForTokenClassification": "Alibaba-NLP/new-impl--modeling.NewForTokenClassification"
14
- },
15
  "classifier_dropout": 0.1,
 
16
  "hidden_act": "gelu",
17
  "hidden_dropout_prob": 0.1,
18
  "hidden_size": 768,
19
  "initializer_range": 0.02,
20
  "intermediate_size": 3072,
21
  "layer_norm_eps": 1e-12,
22
- "layer_norm_type": "layer_norm",
23
  "max_position_embeddings": 8192,
24
- "model_type": "new",
25
  "num_attention_heads": 12,
26
  "num_hidden_layers": 12,
27
- "pack_qkv": true,
28
  "pad_token_id": 1,
29
- "position_embedding_type": "rope",
30
- "rope_scaling": null,
31
- "rope_theta": 160000,
32
- "torch_dtype": "bfloat16",
33
- "transformers_version": "4.37.2",
 
34
  "type_vocab_size": 1,
35
- "unpad_inputs": false,
36
- "use_memory_efficient_attention": false,
37
  "vocab_size": 250048
38
  }
 
1
  {
2
+ "architectures": [
3
+ "GteForMaskedLM"
4
  ],
5
  "attention_probs_dropout_prob": 0.0,
 
 
 
 
 
 
 
 
 
6
  "classifier_dropout": 0.1,
7
+ "dtype": "bfloat16",
8
  "hidden_act": "gelu",
9
  "hidden_dropout_prob": 0.1,
10
  "hidden_size": 768,
11
  "initializer_range": 0.02,
12
  "intermediate_size": 3072,
13
  "layer_norm_eps": 1e-12,
 
14
  "max_position_embeddings": 8192,
15
+ "model_type": "gte",
16
  "num_attention_heads": 12,
17
  "num_hidden_layers": 12,
 
18
  "pad_token_id": 1,
19
+ "rope_parameters": {
20
+ "rope_type": "default",
21
+ "rope_theta": 160000
22
+ },
23
+ "tie_word_embeddings": true,
24
+ "transformers_version": "5.23.0",
25
  "type_vocab_size": 1,
 
 
26
  "vocab_size": 250048
27
  }