Downloads · 30 days
16
3% of all-time downloads
robvanderg/bert-base-multilingual-cased-segment1
bert-base-multilingual-cased-segment1 is a feature extraction model from robvanderg. Use it when you need embeddings to search or compare text. It is set up for transformers.
This is a version of multilingual bert (bert-base-multilingual-cased), where the segment embedding of the 1's is copied into the 0's. Yes, that's all there is to it. We have found that this improves performance substa…
Downloads · 30 days
16
3% of all-time downloads
All-time downloads
539
Public
Repo size
1.4 GB
Likes
0
Public
Click a slice to open those files.
.bin711 MB · 100%
From the Hugging Face model README
This is a version of multilingual bert (bert-base-multilingual-cased), where the segment embedding of the 1's is copied into the 0's. Yes, that's all there is to it. We have found that this improves performance substantially in low-resource setups for word-level tasks (e.g. average 2.5 LAS on a variety of UD treebanks). More details are to be released in our LREC2022 paper titled: Frustratingly Easy Performance Improvements for Cross-lingual Transfer: A Tale on BERT and Segment Embeddings.
These embeddings are generated by the following code
import AutoModel
baseEmbeddings = AutoModel.from_pretrained("bert-base-multilingual-cased")
tte = baseEmbeddings.embeddings.token_type_embeddings.weight.clone().detach()
baseEmbeddings.embeddings.token_type_embeddings.weight[0,:] = tte[1,:]
More details and other varieties can be found in the repo: https://bitbucket.org/robvanderg/segmentembeds/
Note that when using this model on a single sentence task (or word-level task), the results would be similar as just using token_type_id=1 for all tokens.