初始化项目,由ModelHub XC社区提供模型

Model: AIDA-UPM/MSTSb_paraphrase-xlm-r-multilingual-v1
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-05-14 14:07:36 +08:00
commit ffb60464b6
17 changed files with 226 additions and 0 deletions

17
.gitattributes vendored Normal file
View File

@@ -0,0 +1,17 @@
*.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
*.arrow filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text

7
1_Pooling/config.json Normal file
View File

@@ -0,0 +1,7 @@
{
"word_embedding_dimension": 768,
"pooling_mode_cls_token": false,
"pooling_mode_mean_tokens": true,
"pooling_mode_max_tokens": false,
"pooling_mode_mean_sqrt_len_tokens": false
}

126
README.md Normal file
View File

@@ -0,0 +1,126 @@
---
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers
---
# AIDA-UPM/MSTSb_paraphrase-xlm-r-multilingual-v1
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
<!--- Describe your model here -->
## 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('{MODEL_NAME}')
embeddings = model.encode(sentences)
print(embeddings)
```
## Usage (HuggingFace Transformers)
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
```python
from transformers import AutoTokenizer, AutoModel
import torch
#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
# Sentences we want sentence embeddings for
sentences = ['This is an example sentence', 'Each sentence is converted']
# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained('{MODEL_NAME}')
model = AutoModel.from_pretrained('{MODEL_NAME}')
# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
# Compute token embeddings
with torch.no_grad():
model_output = model(**encoded_input)
# Perform pooling. In this case, max pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
```
## Evaluation Results
<!--- Describe how your model was evaluated -->
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name={MODEL_NAME})
## Training
The model was trained with the parameters:
**DataLoader**:
`torch.utils.data.dataloader.DataLoader` of length 1438 with parameters:
```
{'batch_size': 64, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
```
**Loss**:
`sentence_transformers.losses.CosineSimilarityLoss.CosineSimilarityLoss`
Parameters of the fit()-Method:
```
{
"callback": null,
"epochs": 2,
"evaluation_steps": 1000,
"evaluator": "sentence_transformers.evaluation.EmbeddingSimilarityEvaluator.EmbeddingSimilarityEvaluator",
"max_grad_norm": 1,
"optimizer_class": "<class 'transformers.optimization.AdamW'>",
"optimizer_params": {
"lr": 4e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 288,
"weight_decay": 0.1
}
```
## Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
)
```
## Citing & Authors
<!--- Describe where people can find more information -->

27
config.json Normal file
View File

@@ -0,0 +1,27 @@
{
"_name_or_path": "/home/alvaro/.cache/torch/sentence_transformers/sentence-transformers_paraphrase-xlm-r-multilingual-v1/",
"architectures": [
"XLMRobertaModel"
],
"attention_probs_dropout_prob": 0.1,
"bos_token_id": 0,
"eos_token_id": 2,
"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-05,
"max_position_embeddings": 514,
"model_type": "xlm-roberta",
"num_attention_heads": 12,
"num_hidden_layers": 12,
"output_past": true,
"pad_token_id": 1,
"position_embedding_type": "absolute",
"transformers_version": "4.8.2",
"type_vocab_size": 1,
"use_cache": true,
"vocab_size": 250002
}

View File

@@ -0,0 +1,7 @@
{
"__version__": {
"sentence_transformers": "2.0.0",
"transformers": "4.7.0",
"pytorch": "1.9.0+cu102"
}
}

View File

@@ -0,0 +1,5 @@
epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
0,1000,0.8698979062504381,0.8697050566784639,0.8471411702109133,0.8559974333545152,0.8477306625109309,0.8560897909822983,0.8427280752097737,0.8473533364962419
0,-1,0.8728338921275307,0.8728230021490464,0.8501611706465514,0.8595411124739564,0.8500974251187509,0.859001190420056,0.8463491376045915,0.8509695175399761
1,1000,0.8733547670275807,0.8731083556093309,0.8494229933715415,0.8588611091114118,0.8501523023034365,0.8594095272867531,0.8463139210798977,0.851471145234941
1,-1,0.8736260681891976,0.8734391870341894,0.8490980551900695,0.8586627457311188,0.8497867943764744,0.8591076063468455,0.8459076768062497,0.8516528932006657
1 epoch steps cosine_pearson cosine_spearman euclidean_pearson euclidean_spearman manhattan_pearson manhattan_spearman dot_pearson dot_spearman
2 0 1000 0.8698979062504381 0.8697050566784639 0.8471411702109133 0.8559974333545152 0.8477306625109309 0.8560897909822983 0.8427280752097737 0.8473533364962419
3 0 -1 0.8728338921275307 0.8728230021490464 0.8501611706465514 0.8595411124739564 0.8500974251187509 0.859001190420056 0.8463491376045915 0.8509695175399761
4 1 1000 0.8733547670275807 0.8731083556093309 0.8494229933715415 0.8588611091114118 0.8501523023034365 0.8594095272867531 0.8463139210798977 0.851471145234941
5 1 -1 0.8736260681891976 0.8734391870341894 0.8490980551900695 0.8586627457311188 0.8497867943764744 0.8591076063468455 0.8459076768062497 0.8516528932006657

View File

@@ -0,0 +1,5 @@
epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
0,1000,0.8698979062504381,0.8697050566784639,0.8471411702109133,0.8559974333545152,0.8477306625109309,0.8560897909822983,0.8427280752097737,0.8473533364962419
0,-1,0.8728338921275307,0.8728230021490464,0.8501611706465514,0.8595411124739564,0.8500974251187509,0.859001190420056,0.8463491376045915,0.8509695175399761
1,1000,0.8733547670275807,0.8731083556093309,0.8494229933715415,0.8588611091114118,0.8501523023034365,0.8594095272867531,0.8463139210798977,0.851471145234941
1,-1,0.8736260681891976,0.8734391870341894,0.8490980551900695,0.8586627457311188,0.8497867943764744,0.8591076063468455,0.8459076768062497,0.8516528932006657
1 epoch steps cosine_pearson cosine_spearman euclidean_pearson euclidean_spearman manhattan_pearson manhattan_spearman dot_pearson dot_spearman
2 0 1000 0.8698979062504381 0.8697050566784639 0.8471411702109133 0.8559974333545152 0.8477306625109309 0.8560897909822983 0.8427280752097737 0.8473533364962419
3 0 -1 0.8728338921275307 0.8728230021490464 0.8501611706465514 0.8595411124739564 0.8500974251187509 0.859001190420056 0.8463491376045915 0.8509695175399761
4 1 1000 0.8733547670275807 0.8731083556093309 0.8494229933715415 0.8588611091114118 0.8501523023034365 0.8594095272867531 0.8463139210798977 0.851471145234941
5 1 -1 0.8736260681891976 0.8734391870341894 0.8490980551900695 0.8586627457311188 0.8497867943764744 0.8591076063468455 0.8459076768062497 0.8516528932006657

14
modules.json Normal file
View File

@@ -0,0 +1,14 @@
[
{
"idx": 0,
"name": "0",
"path": "",
"type": "sentence_transformers.models.Transformer"
},
{
"idx": 1,
"name": "1",
"path": "1_Pooling",
"type": "sentence_transformers.models.Pooling"
}
]

3
pytorch_model.bin Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a50db6760343a46aaf3d64517d23e26598a87f323890e619df7ca1b38e970992
size 1112259143

View File

@@ -0,0 +1,4 @@
{
"max_seq_length": 128,
"do_lower_case": false
}

3
sentencepiece.bpe.model Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
size 5069051

1
special_tokens_map.json Normal file
View File

@@ -0,0 +1 @@
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>"}

View File

@@ -0,0 +1,2 @@
epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
-1,-1,0.8270452650055763,0.8293381265875807,0.8056907985879193,0.8125910297015703,0.8069543636939532,0.8137716147365195,0.7911110291748672,0.7906985442485376
1 epoch steps cosine_pearson cosine_spearman euclidean_pearson euclidean_spearman manhattan_pearson manhattan_spearman dot_pearson dot_spearman
2 -1 -1 0.8270452650055763 0.8293381265875807 0.8056907985879193 0.8125910297015703 0.8069543636939532 0.8137716147365195 0.7911110291748672 0.7906985442485376

View File

@@ -0,0 +1,2 @@
epoch,steps,cosine_pearson,cosine_spearman,euclidean_pearson,euclidean_spearman,manhattan_pearson,manhattan_spearman,dot_pearson,dot_spearman
-1,-1,0.8270452650055763,0.8293381265875807,0.8056907985879193,0.8125910297015703,0.8069543636939532,0.8137716147365195,0.7911110291748672,0.7906985442485376
1 epoch steps cosine_pearson cosine_spearman euclidean_pearson euclidean_spearman manhattan_pearson manhattan_spearman dot_pearson dot_spearman
2 -1 -1 0.8270452650055763 0.8293381265875807 0.8056907985879193 0.8125910297015703 0.8069543636939532 0.8137716147365195 0.7911110291748672 0.7906985442485376

1
tokenizer.json Normal file

File diff suppressed because one or more lines are too long

1
tokenizer_config.json Normal file
View File

@@ -0,0 +1 @@
{"bos_token": "<s>", "eos_token": "</s>", "sep_token": "</s>", "cls_token": "<s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "model_max_length": 512, "special_tokens_map_file": "input_models/johngiorgi-declutr-small-all-paraphrase-multilingual/0_Transformer/special_tokens_map.json", "full_tokenizer_file": null, "name_or_path": "/home/alvaro/.cache/torch/sentence_transformers/sentence-transformers_paraphrase-xlm-r-multilingual-v1/", "sp_model_kwargs": {}, "tokenizer_class": "XLMRobertaTokenizer"}

1
train_arguments.json Normal file
View File

@@ -0,0 +1 @@
{"num_epochs": 2, "train_batch_size": 64, "evaluation_steps": 1000, "scheduler": "WarmupLinear", "warmup_steps": 288, "optimizer_params": {"lr": 4e-05}, "use_amp": true, "weight_decay": 0.1}