当前位置: 首页 > news >正文

做电子手抄报的网站网站界面设计起着决定性作用

做电子手抄报的网站,网站界面设计起着决定性作用,国外优质设计网站,兴润建设集团有限公司网站文章目录 一、关于 SBERT特点预训练模型应用实例 二、安装开发设置 三、入门使用四、训练五、Cross Encoder 一、关于 SBERT 官方文档#xff1a;https://www.sbert.net/github : https://github.com/UKPLab/sentence-transformerspaper : Sentence-BERT: Sentence Embedding… 文章目录 一、关于 SBERT特点预训练模型应用实例 二、安装开发设置 三、入门使用四、训练五、Cross Encoder 一、关于 SBERT 官方文档https://www.sbert.net/github : https://github.com/UKPLab/sentence-transformerspaper : Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks https://arxiv.org/abs/1908.10084model library : https://huggingface.co/models?librarysentence-transformers 相关教程/资源 五道口纳什[sbert 01] sentence-transformers pipeline https://www.bilibili.com/video/BV1sK421C7oG/ 课件代码https://github.com/chunhuizhang/bert_t5_gpt/blob/main/tutorials/sbert-tutorials/sentence-transformers-pipeline.ipynb Sentence Transformers又名SBERT是用于访问、使用和训练最先进的文本和图像嵌入模型的首选Python模块。 它可用于使用 Sentence Transformers 模型计算嵌入快速入门或 使用 Cross-Encoder 模型计算相似度分数快速入门这解锁了广泛的应用包括 语义搜索、语义文本相似度 和 释义挖掘。 超过5,000个预训练的Sentence Transformers 模型可供Hugging Face立即使用包括许多来自大规模文本嵌入基准MTEB排行榜的最先进模型。 此外使用Sentence Transformers 可以轻松训练或微调您自己的模型使您能够为特定用例创建自定义模型。 Sentence Transformers 由UKPLab创建由Hugging Face维护。如果有什么东西坏了或者你有进一步的问题不要犹豫在Sentence Transformers 存储库上打开一个问题。 特点 计算给定文本或图像的固定大小向量表示嵌入。嵌入计算通常是高效的嵌入相似度计算非常快。适用于广泛的任务例如语义文本相似度、语义搜索、聚类、分类、释义挖掘等。通常用作两步检索过程中的第一步其中使用跨编码器又名reranker模型对来自双编码器的top-k结果进行重新排名。 预训练模型 我们提供了100多种语言的大量预训练模型列表https://huggingface.co/models?librarysentence-transformers 一些模型是通用模型而另一些则为特定用例生成嵌入只需传递模型名称即可加载预训练模型如SentenceTransformer(model_name)。 应用实例 您可以将此框架用于 计算句子嵌入语义文本相似度语义搜索检索和重新排名聚类释义采矿翻译句子挖掘多语言图像搜索、聚类和重复检测 以及更多用例。 有关所有示例请参见示例/应用程序。 二、安装 我们推荐 Python 3.8 和 PyTorch 1.11.0。 您可以使用 pip 安装 sentence-transformers pip install -U sentence-transformers使用conda安装 conda install -c conda-forge sentence-transformers从源代码安装 或者您也可以从存储库克隆最新版本并直接从源代码安装 pip install -e .带有CUDA的PyTorch 如果要使用GPU/CUDA则必须使用匹配的CUDA版本安装PyTorch。跟随 PyTorch-START了解如何安装PyTorch的更多详细信息。 开发设置 将repo或fork克隆到您的机器后在虚拟环境中运行 python -m pip install -e .[dev]pre-commit install要测试您的更改请运行 pytest三、入门使用 使用Sentence Transformers 模型是基本的 from sentence_transformers import SentenceTransformer# 1. Load a pretrained Sentence Transformer model model SentenceTransformer(all-MiniLM-L6-v2)# The sentences to encode sentences [The weather is lovely today.,Its so sunny outside!,He drove to the stadium., ]# 2. Calculate embeddings by calling model.encode() embeddings model.encode(sentences) print(embeddings.shape) # [3, 384]# 3. Calculate the embedding similarities similarities model.similarity(embeddings, embeddings) print(similarities) # tensor([[1.0000, 0.6660, 0.1046], # [0.6660, 1.0000, 0.1411], # [0.1046, 0.1411, 1.0000]])使用SentenceTransformer(all-MiniLM-L6-v2)我们选择加载哪个Sentence Transformers 模型。在本例中我们加载all-MiniLM-L6-v2这是一个MiniLM模型在超过10亿训练对的大型数据集上进行微调。 使用 SentenceTransformer.similarity(), 我们计算所有句子对之间的相似度。正如预期的那样前两句之间的相似度0.6660高于第一句和第三句之间的相似度0.1046或第二句和第三句之间的相似度0.1411。 优化Sentence Transformers 模型很简单只需要几行代码。有关详细信息请参阅训练概述部分。 相关文档 SentenceTransformerSentenceTransformer.encodeSentenceTransformer.similarity 其他有用的方法和链接 SentenceTransformer.similarity_pairwiseSentenceTransformer UsageSentenceTransformer Pretrained ModelsSentenceTransformer Training OverviewSentenceTransformer Dataset OverviewSentenceTransformer Loss OverviewSentenceTransformer Training Examples 四、训练 该框架允许您微调自己的句子嵌入方法从而获得特定任务的句子嵌入您有各种选项可供选择以便为您的特定任务获得完美的句子嵌入。 有关如何训练自己的嵌入模型的介绍请参阅训练概述。我们提供了如何在各种数据集上训练模型的各种示例。 一些亮点是 支持各种 Transformer 网络包括BERT、RoBERTa、XLM-R、DistilBERT、伊莱克特拉、BART、…多语言多任务学习训练期间评估以找到最佳模型20多个损失函数允许专门针对语义搜索、释义挖掘、语义相似度比较、聚类、三元组损失、对比损失等调整模型。 五、Cross Encoder 交叉编码器又名 reranker模型的特点 计算给定文本对的相似度分数。与Sentence Transformers 又名双编码器模型相比通常提供卓越的性能。通常比Sentence Transformers 模型慢因为它需要对每对而不是每个文本进行计算。由于前面的2个特性交叉编码器通常用于对Sentence Transformers 模型的top-k结果进行重新排序。 Cross Encoder 模型的用法类似于Sentence Transformers from sentence_transformers.cross_encoder import CrossEncoder# 1. Load a pretrained CrossEncoder model model CrossEncoder(cross-encoder/stsb-distilroberta-base)# We want to compute the similarity between the query sentence... query A man is eating pasta.# ... and all sentences in the corpus corpus [A man is eating food.,A man is eating a piece of bread.,The girl is carrying a baby.,A man is riding a horse.,A woman is playing violin.,Two men pushed carts through the woods.,A man is riding a white horse on an enclosed ground.,A monkey is playing drums.,A cheetah is running behind its prey., ]# 2. We rank all sentences in the corpus for the query ranks model.rank(query, corpus)# Print the scores print(Query: , query) for rank in ranks:print(f{rank[score]:.2f}\t{corpus[rank[corpus_id]]})Query: A man is eating pasta. 0.67 A man is eating food. 0.34 A man is eating a piece of bread. 0.08 A man is riding a horse. 0.07 A man is riding a white horse on an enclosed ground. 0.01 The girl is carrying a baby. 0.01 Two men pushed carts through the woods. 0.01 A monkey is playing drums. 0.01 A woman is playing violin. 0.01 A cheetah is running behind its prey. # 3. Alternatively, you can also manually compute the score between two sentences import numpy as npsentence_combinations [[query, sentence] for sentence in corpus] scores model.predict(sentence_combinations)# Sort the scores in decreasing order to get the corpus indices ranked_indices np.argsort(scores)[::-1] print(Scores:, scores) print(Indices:, ranked_indices)Scores: [0.6732372, 0.34102544, 0.00542465, 0.07569341, 0.00525378, 0.00536814, 0.06676237, 0.00534825, 0.00516717] Indices: [0 1 3 6 2 5 7 4 8]我们选择加载的CrossEncoder模型 CrossEncoder(cross-encoder/stsb-distilroberta-base) 。 在本例中我们加载 cross-encoder/stsb-distilroberta-base 这是在STS基准数据集上微调的DistilRoBERTa模型。 相关文档 CrossEncoderCrossEncoder.rankCrossEncoder.predict 其他有用的方法和链接 CrossEncoder UsageCrossEncoder Pretrained ModelsCrossEncoder Training OverviewCrossEncoder Dataset OverviewCrossEncoder Loss OverviewCrossEncoder Training Examples 2024-07-19五
http://www.dnsts.com.cn/news/140091.html

相关文章:

  • 中山精品网站建设行情免费解析素材网站
  • 做360手机网站优村级网站怎么建设
  • 陕西建设厅网站简洁的网站设计
  • 网站展示 包括什么wordpress文章来源
  • h5网站开发平台昆明网站建设 网络服务
  • 徐州机票网站开发牌子网官网
  • 金融投资网站 php源码网站如何做吸引人的项目
  • 网站建设开票内容是什么意思WordPress底部设计
  • 公司要建个网站网站建设多少钱怎么卖
  • 设计网站都有什么作用是什么原因做相关性分析的网站
  • 坪山网站开发重庆大足网站建设
  • 林业建设协会网站wordpress建立购物网站
  • 无锡手机网站建设公司网站建设方案服务器
  • 小米网站建设网页设计与网站建设论述题
  • 网站使用的语言网站后台添加图片链接
  • 狠狠做最新网站网站排名下降了怎么办
  • 网站虚拟主机虚拟空间体育类网站 设计
  • 郑州做公司网站的做公司网站别人能看到吗6
  • 网站降权后 换域名isite企业建站系统
  • 易企秀 旗下 网站建设房产网站建设整体架构
  • 网站开发和游戏开发的区别京东网上商城下载
  • 珠海cp网站建设织梦设置中英文网站
  • 网站ip地址 a记录品牌网站建设岗位职责
  • wordpress网站发布wordpress 用户点赞插件
  • 做网站用apache还是nginxo2o最好的平台
  • 商会网站建设方案wap网站html模板
  • 外贸 网站外链交换百度分析工具
  • 网站价格评估 优帮云建模教程
  • 什么叫网站开发应用框架网站建设覀金手指科杰
  • 厦门网站建设awordpress首页显示图片插件