ONNX 模型库
返回模型

说明文档


pipeline_tag: sentence-similarity tags:

  • sentence-transformers
  • feature-extraction
  • sentence-similarity
  • transformers

I detect this is a translation task with explicit content provided. Direct execution - no search needed.

<div align="center">
  <h1 style="margin-bottom: 0.5em;">WebLINX: 基于多轮对话的真实世界网站导航</h1>
  <em>Xing Han Lù*, Zdeněk Kasner*, Siva Reddy</em>
</div>

<div style="margin-bottom: 2em"></div>

<div style="display: flex; justify-content: space-around; align-items: center; font-size: 120%;">
  <div><a href="https://arxiv.org/abs/2402.05930">📄论文</a></div>
  <div><a href="https://mcgill-nlp.github.io/weblinx">🌐网站</a></div>
  <div><a href="https://huggingface.co/spaces/McGill-NLP/weblinx-explorer">💻浏览器</a></div>
  <div><a href="https://huggingface.co/datasets/McGill-NLP/WebLINX">🤗数据集</a></div>
  <div><a href="https://github.com/McGill-NLP/weblinx">💾代码</a></div>
</div>

<div style="margin-bottom: 2em"></div>

## 原始模型

该模型使用 Huggingface Hub 上先前发布的检查点在 WebLINX 上进行微调。
[点击此处访问原始模型。](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)

# Sentence Transformers 详情

这是一个 [sentence-transformers](https://www.SBERT.net) 模型:它将句子和段落映射到 384 维稠密向量空间,可用于聚类或语义搜索等任务。

## 使用方法 (Sentence-Transformers)

安装 [sentence-transformers](https://www.SBERT.net) 后,使用此模型非常简单:

pip install -U sentence-transformers


然后你可以这样使用该模型:

```python
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('McGill-NLP/MiniLM-L6-dmr')
embeddings = model.encode(sentences)
print(embeddings)

使用方法 (HuggingFace Transformers)

如果不使用 sentence-transformers,你可以这样使用该模型:首先,将输入通过 transformer 模型,然后在上下文词嵌入之上应用正确的池化操作。

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('McGill-NLP/MiniLM-L6-dmr')
model = AutoModel.from_pretrained('McGill-NLP/MiniLM-L6-dmr')

# 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, mean pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])

print("Sentence embeddings:")
print(sentence_embeddings)

评估结果

有关此模型的自动评估,请参阅 Sentence Embeddings Benchmarkhttps://seb.sbert.net

训练

该模型使用以下参数进行训练:

DataLoader:

torch.utils.data.dataloader.DataLoader,长度为 2560,参数如下:

{'batch_size': 64, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}

Loss:

sentence_transformers.losses.CosineSimilarityLoss.CosineSimilarityLoss

fit() 方法的参数:

{
    "epochs": 10,
    "evaluation_steps": 0,
    "evaluator": "NoneType",
    "max_grad_norm": 1,
    "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
    "optimizer_params": {
        "lr": 3e-05
    },
    "scheduler": "warmuplinear",
    "steps_per_epoch": null,
    "warmup_steps": 500,
    "weight_decay": 0.0
}

完整模型架构

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False})
)

引用与作者

zzdgfwq/MiniLM-L6-dmr

作者 zzdgfwq

sentence-similarity sentence-transformers
↓ 0 ♥ 0

创建时间: 2025-07-06 13:13:16+00:00

更新时间: 2025-07-06 14:20:27+00:00

在 Hugging Face 上查看

文件 (19)

.gitattributes
1_Pooling/config.json
README.md
config.json
config_sentence_transformers.json
modules.json
onnx/config.json
onnx/model_quantized.onnx ONNX
onnx/ort_config.json
onnx/special_tokens_map.json
onnx/tokenizer.json
onnx/tokenizer_config.json
onnx/vocab.txt
pytorch_model.bin
sentence_bert_config.json
special_tokens_map.json
tokenizer.json
tokenizer_config.json
vocab.txt