初始化项目,由ModelHub XC社区提供模型
Model: sentence-transformers/LaBSE Source: Original Platform
This commit is contained in:
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||
7
1_Pooling/config.json
Normal file
7
1_Pooling/config.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"word_embedding_dimension": 768,
|
||||
"pooling_mode_cls_token": true,
|
||||
"pooling_mode_mean_tokens": false,
|
||||
"pooling_mode_max_tokens": false,
|
||||
"pooling_mode_mean_sqrt_len_tokens": false
|
||||
}
|
||||
1
2_Dense/config.json
Normal file
1
2_Dense/config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"in_features": 768, "out_features": 768, "bias": true, "activation_function": "torch.nn.modules.activation.Tanh"}
|
||||
3
2_Dense/model.safetensors
Normal file
3
2_Dense/model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f866c945fa2147ce4940c8ead0b4b20af4217e0f4664bd35f41c2a0967c4fe77
|
||||
size 2362528
|
||||
3
2_Dense/pytorch_model.bin
Normal file
3
2_Dense/pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:06fb85120e40adf0ab188c4f0cc7684f702cb2023532947d1b85f325b0a3645c
|
||||
size 2363431
|
||||
160
README.md
Normal file
160
README.md
Normal file
@@ -0,0 +1,160 @@
|
||||
---
|
||||
language:
|
||||
- multilingual
|
||||
- af
|
||||
- sq
|
||||
- am
|
||||
- ar
|
||||
- hy
|
||||
- as
|
||||
- az
|
||||
- eu
|
||||
- be
|
||||
- bn
|
||||
- bs
|
||||
- bg
|
||||
- my
|
||||
- ca
|
||||
- ceb
|
||||
- zh
|
||||
- co
|
||||
- hr
|
||||
- cs
|
||||
- da
|
||||
- nl
|
||||
- en
|
||||
- eo
|
||||
- et
|
||||
- fi
|
||||
- fr
|
||||
- fy
|
||||
- gl
|
||||
- ka
|
||||
- de
|
||||
- el
|
||||
- gu
|
||||
- ht
|
||||
- ha
|
||||
- haw
|
||||
- he
|
||||
- hi
|
||||
- hmn
|
||||
- hu
|
||||
- is
|
||||
- ig
|
||||
- id
|
||||
- ga
|
||||
- it
|
||||
- ja
|
||||
- jv
|
||||
- kn
|
||||
- kk
|
||||
- km
|
||||
- rw
|
||||
- ko
|
||||
- ku
|
||||
- ky
|
||||
- lo
|
||||
- la
|
||||
- lv
|
||||
- lt
|
||||
- lb
|
||||
- mk
|
||||
- mg
|
||||
- ms
|
||||
- ml
|
||||
- mt
|
||||
- mi
|
||||
- mr
|
||||
- mn
|
||||
- ne
|
||||
- no
|
||||
- ny
|
||||
- or
|
||||
- fa
|
||||
- pl
|
||||
- pt
|
||||
- pa
|
||||
- ro
|
||||
- ru
|
||||
- sm
|
||||
- gd
|
||||
- sr
|
||||
- st
|
||||
- sn
|
||||
- si
|
||||
- sk
|
||||
- sl
|
||||
- so
|
||||
- es
|
||||
- su
|
||||
- sw
|
||||
- sv
|
||||
- tl
|
||||
- tg
|
||||
- ta
|
||||
- tt
|
||||
- te
|
||||
- th
|
||||
- bo
|
||||
- tr
|
||||
- tk
|
||||
- ug
|
||||
- uk
|
||||
- ur
|
||||
- uz
|
||||
- vi
|
||||
- cy
|
||||
- wo
|
||||
- xh
|
||||
- yi
|
||||
- yo
|
||||
- zu
|
||||
pipeline_tag: sentence-similarity
|
||||
tags:
|
||||
- sentence-transformers
|
||||
- feature-extraction
|
||||
- sentence-similarity
|
||||
library_name: sentence-transformers
|
||||
license: apache-2.0
|
||||
---
|
||||
|
||||
# LaBSE
|
||||
This is a port of the [LaBSE](https://tfhub.dev/google/LaBSE/1) model to PyTorch. It can be used to map 109 languages to a shared vector space.
|
||||
|
||||
|
||||
## Usage (Sentence-Transformers)
|
||||
|
||||
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
||||
|
||||
```
|
||||
pip install -U sentence-transformers
|
||||
```
|
||||
|
||||
Then you can use the model like this:
|
||||
|
||||
```python
|
||||
from sentence_transformers import SentenceTransformer
|
||||
sentences = ["This is an example sentence", "Each sentence is converted"]
|
||||
|
||||
model = SentenceTransformer('sentence-transformers/LaBSE')
|
||||
embeddings = model.encode(sentences)
|
||||
print(embeddings)
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Full Model Architecture
|
||||
```
|
||||
SentenceTransformer(
|
||||
(0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel
|
||||
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
|
||||
(2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'})
|
||||
(3): Normalize()
|
||||
)
|
||||
```
|
||||
|
||||
## Citing & Authors
|
||||
|
||||
Have a look at [LaBSE](https://tfhub.dev/google/LaBSE/1) for the respective publication that describes LaBSE.
|
||||
|
||||
30
config.json
Normal file
30
config.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"_name_or_path": "old_models/LaBSE/0_Transformer",
|
||||
"architectures": [
|
||||
"BertModel"
|
||||
],
|
||||
"attention_probs_dropout_prob": 0.1,
|
||||
"directionality": "bidi",
|
||||
"gradient_checkpointing": false,
|
||||
"hidden_act": "gelu",
|
||||
"hidden_dropout_prob": 0.1,
|
||||
"hidden_size": 768,
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 3072,
|
||||
"layer_norm_eps": 1e-12,
|
||||
"max_position_embeddings": 512,
|
||||
"model_type": "bert",
|
||||
"num_attention_heads": 12,
|
||||
"num_hidden_layers": 12,
|
||||
"pad_token_id": 0,
|
||||
"pooler_fc_size": 768,
|
||||
"pooler_num_attention_heads": 12,
|
||||
"pooler_num_fc_layers": 3,
|
||||
"pooler_size_per_head": 128,
|
||||
"pooler_type": "first_token_transform",
|
||||
"position_embedding_type": "absolute",
|
||||
"transformers_version": "4.7.0",
|
||||
"type_vocab_size": 2,
|
||||
"use_cache": true,
|
||||
"vocab_size": 501153
|
||||
}
|
||||
7
config_sentence_transformers.json
Normal file
7
config_sentence_transformers.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"__version__": {
|
||||
"sentence_transformers": "2.0.0",
|
||||
"transformers": "4.7.0",
|
||||
"pytorch": "1.9.0+cu102"
|
||||
}
|
||||
}
|
||||
3
flax_model.msgpack
Normal file
3
flax_model.msgpack
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4cbe50771a6b147d2da0beb6da1d80908a706cec2e2e06a09873649ed183e884
|
||||
size 1883714625
|
||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:77d8e1f2dbab6eb5d3c261ce9d3dbf1e3c69e02938c95f934f94f42c22dfa31f
|
||||
size 1883734344
|
||||
26
modules.json
Normal file
26
modules.json
Normal file
@@ -0,0 +1,26 @@
|
||||
[
|
||||
{
|
||||
"idx": 0,
|
||||
"name": "0",
|
||||
"path": "",
|
||||
"type": "sentence_transformers.models.Transformer"
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"name": "1",
|
||||
"path": "1_Pooling",
|
||||
"type": "sentence_transformers.models.Pooling"
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"name": "2",
|
||||
"path": "2_Dense",
|
||||
"type": "sentence_transformers.models.Dense"
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"name": "3",
|
||||
"path": "3_Normalize",
|
||||
"type": "sentence_transformers.models.Normalize"
|
||||
}
|
||||
]
|
||||
3
onnx/model.onnx
Normal file
3
onnx/model.onnx
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2a48ae86b3ef337ea47916915386180fe97ecbb73f0797b6f6b5550bb05c4979
|
||||
size 1881623050
|
||||
3
pytorch_model.bin
Normal file
3
pytorch_model.bin
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c9e7daf739f87c2168a6d1baffdae5782eceb03eb6de61950284a925234c6865
|
||||
size 1883785969
|
||||
4
sentence_bert_config.json
Normal file
4
sentence_bert_config.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"max_seq_length": 256,
|
||||
"do_lower_case": false
|
||||
}
|
||||
1
special_tokens_map.json
Normal file
1
special_tokens_map.json
Normal file
@@ -0,0 +1 @@
|
||||
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
||||
3
tf_model.h5
Normal file
3
tf_model.h5
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e971d0404bba02ce8ab4568bc9625a74e6fbe99c7cdc927d5f3095597a70c55d
|
||||
size 1883974632
|
||||
1
tokenizer.json
Normal file
1
tokenizer.json
Normal file
File diff suppressed because one or more lines are too long
1
tokenizer_config.json
Normal file
1
tokenizer_config.json
Normal file
@@ -0,0 +1 @@
|
||||
{"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "special_tokens_map_file": "special_tokens_map.json", "full_tokenizer_file": null, "name_or_path": "old_models/LaBSE/0_Transformer", "do_basic_tokenize": true, "never_split": null}
|
||||
Reference in New Issue
Block a user