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

长沙旅游网站建设牡丹江市建设局网站

长沙旅游网站建设,牡丹江市建设局网站,东莞免费模版网站建设,公司建设网站价格1 介绍 pipeline() 是使用预训练模型进行推理的最简单和最快速的方式。可以针对不同模态的许多任务直接使用 pipeline() 2 举例#xff1a;情感分析 2.1 创建pipeline实例 from transformers import pipelineclassifier pipeline(sentiment-analysis) #首先创…1 介绍  pipeline() 是使用预训练模型进行推理的最简单和最快速的方式。可以针对不同模态的许多任务直接使用 pipeline() 2 举例情感分析 2.1 创建pipeline实例 from transformers import pipelineclassifier pipeline(sentiment-analysis) #首先创建一个 pipeline() 实例并指定您想要使用它的任务 #pipeline() 将下载并缓存情感分析的默认预训练模型和分词器2.2 使用pipeline实例  然后就可以在目标文本上使用分类器了 # 单个文本 classifier(Today is a shiny day!)[{label: POSITIVE, score: 0.9992596507072449}]# 多个文本 classifier([Today is a shiny day!,What a bad day it is!])[{label: POSITIVE, score: 0.9992596507072449},{label: NEGATIVE, score: 0.999808132648468}]3 使用别的模型和分词器 pipeline() 可以容纳来自 Models - Hugging Face的任何模型eg:能够处理法语文本的模型 以下两种方式都可以 from transformers import AutoTokenizer, AutoModelForSequenceClassification from transformers import pipelinemodel_name nlptown/bert-base-multilingual-uncased-sentimentclassifier pipeline(sentiment-analysis, modelmodel_name)classifier(Nous sommes très heureux de vous présenter la bibliothèque Transformers.)#[{label: 5 stars, score: 0.7236300706863403}] from transformers import AutoTokenizer, AutoModelForSequenceClassificationmodel_name nlptown/bert-base-multilingual-uncased-sentimentmodel AutoModelForSequenceClassification.from_pretrained(model_name) tokenizer AutoTokenizer.from_pretrained(model_name)classifier pipeline(sentiment-analysis, modelmodel, tokenizertokenizer)classifier(Nous sommes très heureux de vous présenter la bibliothèque Transformers.) #[{label: 5 stars, score: 0.7236300706863403}]4 device相关 使用 devicen——pipeline会自动将模型放置在指定的设备上 classifier pipeline(sentiment-analysis, modelmodel_name,device2) 如果模型对于单个 GPU 来说太大并且使用 PyTorch——可以设置 device_mapauto以自动确定如何加载和存储模型权重 classifier pipeline(sentiment-analysis, modelmodel_name,device_mapauto) 如果传递了 device_mapauto在实例化pipeline时不需要添加参数 devicedevice
http://www.w-s-a.com/news/596005/

相关文章:

  • 如何建立网站后台程序wordpress 后台管理
  • 山东外贸网站建设怎么样wordpress首页左图右文
  • 志丹网站建设wordpress 形式修改
  • 南通seo网站推广费用网站建设就业前景
  • 自适应网站做mip改造浏览器广告投放
  • 网站meta网页描述网站的推广费用
  • 偃师市住房和城乡建设局网站网站个人主页怎么做
  • 做网站要实名认证吗wordpress去掉仪表盘
  • 在哪做网站好Python建网站的步骤
  • 卢松松的网站办公室设计布局
  • 住房城乡建设干部学院网站织梦网站0day漏洞
  • 企业网站seo优帮云手机桌面布局设计软件
  • 无证做音频网站违法吗智能建站加盟电话
  • 鹿泉专业网站建设做网站为什么要建站点
  • 加强网站建设和维护工作新闻大全
  • 红鱼洞水库建设管理局网站左右左布局网站建设
  • 手机网站建设地址做网站公
  • 贵州建设厅网站首页网络公司除了做网站
  • 运动鞋建设网站前的市场分析wordpress 搜索框代码
  • app开发网站开发教程平台网站开发的税率
  • 百度网站优化排名加强服务保障满足群众急需i
  • 宁夏建设职业技术学院网站安徽网站优化建设
  • 四川关于工程建设网站硬盘做网站空间
  • 桂林网站制作培训学校外包seo公司
  • 莱州网站建设方案北京装修公司口碑
  • 大型网站建设济南兴田德润团队怎么样韩国女足出线了吗
  • 南通做网站找谁重庆网络推广网站推广
  • ps网站主页按钮怎么做怎样做网站的用户分析
  • 哪个网站做黑色星期五订酒店活动公司网络营销推广软件
  • 岳阳新网网站建设有限公司网页设计基础考试题目