模型:

krlvi/sentence-t5-base-nlpl-code_search_net

英文

sentence-t5-base-nlpl-code_search_net

这是一个模型:它将句子和段落映射到一个768维度的密集向量空间,可用于聚类或语义搜索等任务。

它已经在 code_search_net 数据集上进行了训练

用法(Sentence-Transformers)

当您安装了 sentence-transformers 后,使用此模型变得很容易:

pip install -U sentence-transformers

然后,您可以像这样使用模型:

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)

评估结果

对于该模型的自动评估,请参见 Sentence Embeddings Benchmark: https://seb.sbert.net

训练

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

DataLoader :

torch.utils.data.dataloader.DataLoader 长度为58777,带有以下参数:

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

Loss :

sentence_transformers.losses.MultipleNegativesRankingLoss.MultipleNegativesRankingLoss 带有以下参数:

{'scale': 20.0, 'similarity_fct': 'cos_sim'}

fit() 方法的参数:

{
    "epochs": 4,
    "evaluation_steps": 0,
    "evaluator": "NoneType",
    "max_grad_norm": 1,
    "optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
    "optimizer_params": {
        "lr": 2e-05
    },
    "scheduler": "WarmupLinear",
    "steps_per_epoch": null,
    "warmup_steps": 100,
    "weight_decay": 0.01
}

完整模型架构

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: T5EncoderModel 
  (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})
  (2): Dense({'in_features': 768, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
  (3): Normalize()
)

引用和作者