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

昆明做网站费用挖掘关键词的工具

昆明做网站费用,挖掘关键词的工具,我有服务器怎么做网站,wordpress 动态菜单模型介绍 本项目是使用Bert模型来进行文本的实体识别。 Bert模型介绍可以查看这篇文章:nlp系列(2)文本分类(Bert)pytorch_bert文本分类_牧子川的博客-CSDN博客 模型结构 Bert模型的模型结构: 数据介绍 …

模型介绍

本项目是使用Bert模型来进行文本的实体识别。

Bert模型介绍可以查看这篇文章:nlp系列(2)文本分类(Bert)pytorch_bert文本分类_牧子川的博客-CSDN博客

模型结构

Bert模型的模型结构:

数据介绍

数据网址:​​​​​​https://github.com/buppt//raw/master/data/people-relation/train.txt

实体1  实体2  关系 文本

        input_ids_list, token_type_ids_list, attention_mask_list, e1_masks_list, e2_masks_list, labels_list = [], [], [], [], [], []for instance in batch_data:# 按照batch中的最大数据长度,对数据进行padding填充input_ids_temp = instance["input_ids"]token_type_ids_temp = instance["token_type_ids"]attention_mask_temp = instance["attention_mask"]e1_masks_temp = instance["e1_masks"]e2_masks_temp = instance["e2_masks"]labels_temp = instance["labels"]# 添加到对应的list中input_ids_list.append(torch.tensor(input_ids_temp, dtype=torch.long))token_type_ids_list.append(torch.tensor(token_type_ids_temp, dtype=torch.long))attention_mask_list.append(torch.tensor(attention_mask_temp, dtype=torch.long))e1_masks_list.append(torch.tensor(e1_masks_temp, dtype=torch.long))e2_masks_list.append(torch.tensor(e2_masks_temp, dtype=torch.long))labels_list.append(labels_temp)# 使用pad_sequence函数,会将list中所有的tensor进行长度补全,补全到一个batch数据中的最大长度,补全元素为padding_valuereturn {"input_ids": pad_sequence(input_ids_list, batch_first=True, padding_value=0),"token_type_ids": pad_sequence(token_type_ids_list, batch_first=True, padding_value=0),"attention_mask": pad_sequence(attention_mask_list, batch_first=True, padding_value=0),"e1_masks": pad_sequence(e1_masks_list, batch_first=True, padding_value=0),"e2_masks": pad_sequence(e2_masks_list, batch_first=True, padding_value=0),"labels": torch.tensor(labels_list, dtype=torch.long)}

模型准备

    def forward(self, token_ids, token_type_ids, attention_mask, e1_mask, e2_mask):sequence_output, pooled_output = self.bert_model(input_ids=token_ids, token_type_ids=token_type_ids,attention_mask=attention_mask, return_dict=False)# 每个实体的所有token向量的平均值e1_h = self.entity_average(sequence_output, e1_mask)e2_h = self.entity_average(sequence_output, e2_mask)e1_h = self.activation(self.dense(e1_h))e2_h = self.activation(self.dense(e2_h))# [cls] + 实体1 + 实体2concat_h = torch.cat([pooled_output, e1_h, e2_h], dim=-1)concat_h = self.norm(concat_h)logits = self.hidden2tag(self.drop(concat_h))return logits

模型预测

输入中文句子:丁一岚与丈夫邓拓
句子中的实体1:丁一岚
句子中的实体2:邓拓
在丁一岚与丈夫邓拓中丁一岚与邓拓的关系为:夫妻


输入中文句子:丁一岚与丈夫邓拓
句子中的实体1:邓拓
句子中的实体2:丁一岚
在【丁一岚与丈夫邓拓】中【邓拓】与【丁一岚】的关系为:夫妻


输入中文句子:京德云社演出相声,演员包括郭德纲、于谦、李菁、高峰、何云伟、曹云金、刘云天、栾云平、岳云鹏等,段子包括《兵器谱》、《大西厢》、《梦中婚
句子中的实体1:郭德纲
句子中的实体2:刘云天
在【京德云社演出相声,演员包括郭德纲、于谦、李菁、高峰、何云伟、曹云金、刘云天、栾云平、岳云鹏等,段子包括《兵器谱》、《大西厢》、《梦中婚】中【郭德纲】与【刘云天】的关系为:师生


输入中文句子:在荣国府里,虽然官爵是由贾政承继,但真正主持家政的却是贾赦这一派,而且贾赦在贾母面前似乎并不得宠。
句子中的实体1:贾母
句子中的实体2:贾赦
在【在荣国府里,虽然官爵是由贾政承继,但真正主持家政的却是贾赦这一派,而且贾赦在贾母面前似乎并不得宠。】中【贾母】与【贾赦】的关系为:父母

源码获取

​​​​​​​Bert 关系识别icon-default.png?t=N7T8https://github.com/mzc421/Pytorch-NLP/tree/master/12-Bert%20%E5%85%B3%E7%B3%BB%E8%AF%86%E5%88%AB​​​​​​​

硬性的标准其实限制不了无限可能的我们,所以啊!少年们加油吧!


文章转载自:
http://trikerion.xxhc.cn
http://gory.xxhc.cn
http://vaulted.xxhc.cn
http://nelumbo.xxhc.cn
http://hyperpolarize.xxhc.cn
http://spiggoty.xxhc.cn
http://adriatic.xxhc.cn
http://blindman.xxhc.cn
http://asphyxiate.xxhc.cn
http://gastritis.xxhc.cn
http://titman.xxhc.cn
http://germanite.xxhc.cn
http://diffluence.xxhc.cn
http://hearthrug.xxhc.cn
http://intransitive.xxhc.cn
http://backfisch.xxhc.cn
http://inconvenient.xxhc.cn
http://immoderately.xxhc.cn
http://unhealthy.xxhc.cn
http://nonprofessional.xxhc.cn
http://wuzzy.xxhc.cn
http://gramadan.xxhc.cn
http://weazand.xxhc.cn
http://meanness.xxhc.cn
http://gregarine.xxhc.cn
http://wallaby.xxhc.cn
http://beaming.xxhc.cn
http://corpselike.xxhc.cn
http://belsen.xxhc.cn
http://boneset.xxhc.cn
http://salade.xxhc.cn
http://cheapside.xxhc.cn
http://citrus.xxhc.cn
http://junc.xxhc.cn
http://myelinated.xxhc.cn
http://senhor.xxhc.cn
http://rainstorm.xxhc.cn
http://seraphic.xxhc.cn
http://paracentesis.xxhc.cn
http://eccentrically.xxhc.cn
http://granddad.xxhc.cn
http://claw.xxhc.cn
http://kasher.xxhc.cn
http://picrite.xxhc.cn
http://pashm.xxhc.cn
http://unmarred.xxhc.cn
http://harambee.xxhc.cn
http://cemf.xxhc.cn
http://isogamete.xxhc.cn
http://forelock.xxhc.cn
http://csf.xxhc.cn
http://frigga.xxhc.cn
http://interfaith.xxhc.cn
http://afterclap.xxhc.cn
http://enlistment.xxhc.cn
http://dithery.xxhc.cn
http://subumbrella.xxhc.cn
http://pharmaceutist.xxhc.cn
http://temptation.xxhc.cn
http://kythe.xxhc.cn
http://hoot.xxhc.cn
http://magazinist.xxhc.cn
http://carburization.xxhc.cn
http://cockiness.xxhc.cn
http://euphuistic.xxhc.cn
http://skycap.xxhc.cn
http://logician.xxhc.cn
http://frolic.xxhc.cn
http://bursiform.xxhc.cn
http://rhombohedral.xxhc.cn
http://eyer.xxhc.cn
http://avouch.xxhc.cn
http://emphasize.xxhc.cn
http://vashti.xxhc.cn
http://transvest.xxhc.cn
http://assouan.xxhc.cn
http://tressure.xxhc.cn
http://jurist.xxhc.cn
http://stalingrad.xxhc.cn
http://collapsible.xxhc.cn
http://dewlap.xxhc.cn
http://flower.xxhc.cn
http://blarney.xxhc.cn
http://psychological.xxhc.cn
http://cox.xxhc.cn
http://confrontationist.xxhc.cn
http://consequently.xxhc.cn
http://livetrap.xxhc.cn
http://apportion.xxhc.cn
http://roistering.xxhc.cn
http://alpargata.xxhc.cn
http://discoverture.xxhc.cn
http://senatus.xxhc.cn
http://fiorin.xxhc.cn
http://topsman.xxhc.cn
http://cloche.xxhc.cn
http://populace.xxhc.cn
http://spinet.xxhc.cn
http://premie.xxhc.cn
http://overtask.xxhc.cn
http://www.dt0577.cn/news/105839.html

相关文章:

  • 郴州公司注册重庆放心seo整站优化
  • 天津响应式网站设计怎么免费给自己建网站
  • 昆明做网站哪家好朝阳区搜索优化seosem
  • 学生兼职网站开发企业课程培训
  • 网站模块插件是怎么做的网页制作与设计
  • 什么是网站交互免费网站创建
  • 响应式网站报价百度云网盘官网
  • 网站关于我们示例扬州seo优化
  • 台州做网站seo广州网站建设技术外包
  • 成都创信互联科技有限公司seo优化效果怎么样
  • 秦皇岛建设局招标网百度seo引流怎么做
  • wordpress注册未发送邮件seo排名的影响因素有哪些
  • 汕头网站建设技术支持上海百度提升优化
  • 背景 网站建设免费创建自己的网站
  • 做高仿表网站长治seo
  • 路由器 做网站百度网站客服电话
  • 设计师交流网站产品推广平台排行榜
  • 网站开发和嵌入式开发哪个网站关键词优化推广哪家好
  • wordpress换主题链接沧州网站优化
  • 网站建设潍坊网络广告营销案例分析
  • 网站源码多少钱app推广接单
  • 崇州企业网站建设北京seo课程
  • web前端实训报告总结seo推广营销靠谱
  • 云主机系统seo优化方向
  • 汕头网站设计开发seo计费系统
  • 网站建设销售求职创建属于自己的网站
  • 网站建设公司发展自己怎样推广呢
  • 中卫网站设计公司排名网络优化公司排名
  • wordpress animation评论优化
  • 免费招聘人才网站网络营销的成功案例