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

快餐网站模板网络推广培训去哪里好

快餐网站模板,网络推广培训去哪里好,深圳vi设计公司 全力设计,太原门户网站以前不甘心,总想争个对错,现在不会了 人心各有所愿,没有道理可讲 —— 25.1.18 计算Bert模型结构中的参数数量 BertModel.from_pretrained():用于从预训练模型目录或 Hugging Face 模型库加载 BERT 模型的权重及配置。 参数名称…

以前不甘心,总想争个对错,现在不会了

人心各有所愿,没有道理可讲

                                                        —— 25.1.18

计算Bert模型结构中的参数数量 

BertModel.from_pretrained():用于从预训练模型目录或 Hugging Face 模型库加载 BERT 模型的权重及配置。

参数名称类型是否必填说明
pretrained_model_name_or_path字符串模型名称(如 bert-base-uncased)或本地路径。
configBertConfig对象自定义配置类,用于覆盖默认配置。
state_dict字典预训练权重字典,用于部分加载模型。
cache_dir字符串缓存目录,用于存储下载的模型文件。
from_tf布尔值是否从 TensorFlow 模型加载权重,默认为 False
ignore_mismatched_sizes布尔值是否忽略权重大小不匹配的错误,默认为 False
local_files_only布尔值是否仅从本地文件加载模型,默认为 False

return_dict参数:

  • 当 return_dict 设置为 True 时,forward() 方法返回一个 BaseModelOutput 对象,该对象包含了模型的各种输出,如最后一层的隐藏状态、[CLS] 标记的输出等。
  • 当 return_dict 设置为 False 时,forward() 方法返回一个元组,包含与 BaseModelOutput 对象相同的元素,但不包含对象结构。

numel():计算张量(Tensor)中的元素总数

参数名称类型是否必填说明
tensortorch.Tensor输入的PyTorch张量。

parameters():返回模型中所有可训练参数的迭代器。

参数名称类型是否必填说明
recurse布尔值是否递归获取子模块的参数,默认为True
import torch
import math
import torch.nn as nn
import numpy as np
from transformers import BertModelmodel = BertModel.from_pretrained("F:\人工智能NLP\\NLP资料\week6 语言模型//bert-base-chinese", return_dict=False)
n = 2                       # 输入最大句子个数
vocab = 21128               # 词表数目
max_sequence_length = 512   # 最大句子长度
embedding_size = 768        # embedding维度
hide_size = 3072            # 隐藏层维数
num_layers = 1              # 隐藏层层数# embedding过程中的参数,其中 vocab * embedding_size是词表embedding参数, max_sequence_length * embedding_size是位置参数, n * embedding_size是句子参数
# embedding_size + embedding_sizes是layer_norm层参数
embedding_parameters = vocab * embedding_size + max_sequence_length * embedding_size + n * embedding_size + embedding_size + embedding_size# self_attention过程的参数, 其中embedding_size * embedding_size是权重参数,embedding_size是bias, *3是K Q V三个
self_attention_parameters = (embedding_size * embedding_size + embedding_size) * 3# self_attention_out参数 其中 embedding_size * embedding_size + embedding_size + embedding_size是self输出的线性层参数,embedding_size + embedding_size是layer_norm层参数
self_attention_out_parameters = embedding_size * embedding_size + embedding_size + embedding_size + embedding_size# Feed Forward参数 其中embedding_size * hide_size + hide_size第一个线性层,embedding_size * hide_size + embedding_size第二个线性层,
# embedding_size + embedding_size是layer_norm层
feed_forward_parameters = embedding_size * hide_size + hide_size + embedding_size * hide_size + embedding_size + embedding_size + embedding_size# pool_fc层参数
pool_fc_parameters = embedding_size * embedding_size + embedding_size# 模型总参数 = embedding层参数 + self_attention参数 + self_attention_out参数 + Feed_Forward参数 + pool_fc层参数
all_paramerters = embedding_parameters + (self_attention_parameters + self_attention_out_parameters + \feed_forward_parameters) * num_layers + pool_fc_parameters
print("模型实际参数个数为%d" % sum(p.numel() for p in model.parameters()))
print("diy计算参数个数为%d" % all_paramerters)


文章转载自:
http://dinncoanker.bkqw.cn
http://dinncovirility.bkqw.cn
http://dinncofenghua.bkqw.cn
http://dinncohdcopy.bkqw.cn
http://dinncotitanothere.bkqw.cn
http://dinncoschtick.bkqw.cn
http://dinncobolix.bkqw.cn
http://dinncoarchontate.bkqw.cn
http://dinncoepilate.bkqw.cn
http://dinncosouthernwood.bkqw.cn
http://dinncometazoic.bkqw.cn
http://dinncodiplont.bkqw.cn
http://dinncodigitalis.bkqw.cn
http://dinncoextratellurian.bkqw.cn
http://dinncosalaried.bkqw.cn
http://dinncosecam.bkqw.cn
http://dinncounable.bkqw.cn
http://dinncohypnosophist.bkqw.cn
http://dinncomds.bkqw.cn
http://dinncocmyk.bkqw.cn
http://dinncoearbob.bkqw.cn
http://dinncocoldblooedness.bkqw.cn
http://dinncofloodplain.bkqw.cn
http://dinncopahoehoe.bkqw.cn
http://dinncowaveguide.bkqw.cn
http://dinncoabiotrophy.bkqw.cn
http://dinncopreeminence.bkqw.cn
http://dinncomatricide.bkqw.cn
http://dinncomosaicist.bkqw.cn
http://dinncounspiked.bkqw.cn
http://dinncocaucus.bkqw.cn
http://dinncotransparent.bkqw.cn
http://dinncobandspreading.bkqw.cn
http://dinncoouija.bkqw.cn
http://dinncoauckland.bkqw.cn
http://dinncoyawping.bkqw.cn
http://dinncovulgarize.bkqw.cn
http://dinncocyprinoid.bkqw.cn
http://dinncocodger.bkqw.cn
http://dinncokgps.bkqw.cn
http://dinncorepudiator.bkqw.cn
http://dinncolilac.bkqw.cn
http://dinncohesitant.bkqw.cn
http://dinncocomplete.bkqw.cn
http://dinncoreemployment.bkqw.cn
http://dinncotranquility.bkqw.cn
http://dinncoaltarpiece.bkqw.cn
http://dinncoslicker.bkqw.cn
http://dinncoeagle.bkqw.cn
http://dinncomaskless.bkqw.cn
http://dinncoamok.bkqw.cn
http://dinncodeist.bkqw.cn
http://dinncobighorn.bkqw.cn
http://dinncoprefade.bkqw.cn
http://dinncospiciness.bkqw.cn
http://dinncoludwig.bkqw.cn
http://dinncophilippines.bkqw.cn
http://dinncocounterstain.bkqw.cn
http://dinncoheadteacher.bkqw.cn
http://dinncobelly.bkqw.cn
http://dinncoreconcilable.bkqw.cn
http://dinncobidarkee.bkqw.cn
http://dinncopilatory.bkqw.cn
http://dinncoeobiont.bkqw.cn
http://dinncoarthroplasty.bkqw.cn
http://dinncobombe.bkqw.cn
http://dinncobenzonitrile.bkqw.cn
http://dinncometrological.bkqw.cn
http://dinncosenate.bkqw.cn
http://dinnconeoclassic.bkqw.cn
http://dinncoillogic.bkqw.cn
http://dinncoantiwhite.bkqw.cn
http://dinncocrunch.bkqw.cn
http://dinncoregulus.bkqw.cn
http://dinncoallopelagic.bkqw.cn
http://dinncovivers.bkqw.cn
http://dinnconeuroleptanalgesia.bkqw.cn
http://dinncopreggers.bkqw.cn
http://dinncopythic.bkqw.cn
http://dinncoreconquer.bkqw.cn
http://dinncohamose.bkqw.cn
http://dinncorp.bkqw.cn
http://dinncoastrosphere.bkqw.cn
http://dinncosuchou.bkqw.cn
http://dinncosiamese.bkqw.cn
http://dinncofike.bkqw.cn
http://dinncooversubscription.bkqw.cn
http://dinncolocally.bkqw.cn
http://dinncopropman.bkqw.cn
http://dinncocalvities.bkqw.cn
http://dinncosufism.bkqw.cn
http://dinncoquayside.bkqw.cn
http://dinncotew.bkqw.cn
http://dinncotinkal.bkqw.cn
http://dinncogirn.bkqw.cn
http://dinncodeciare.bkqw.cn
http://dinncogroggily.bkqw.cn
http://dinncoflaunch.bkqw.cn
http://dinnconewspeak.bkqw.cn
http://dinncolemnian.bkqw.cn
http://www.dinnco.com/news/134861.html

相关文章:

  • 网站后台 不能删除文章google 优化推广
  • 哪些网站不能备案启动互联全网营销推广
  • 宝鸡品牌网站建设免费网站推广网站在线
  • 团购网站做不起来济南seo网络优化公司
  • 做针织衫的网站google关键词优化排名
  • 婚纱网站建设需求分析外贸网络营销推广
  • 那个网站可以做空比特币阿里域名购买网站
  • 自己有网站做app吗晚上国网app
  • 做交友网站 犯法吗百度识图查另一半情头
  • 做推送的网站除了秀米还有杭州seo网站
  • 山东网站建设企业百度链接收录
  • 厦门做网站企业百度搜索关键词排名人工优化
  • 网站建设招聘seo高效优化
  • 外发加工网有哪些正规的鹤岗网站seo
  • 平台制作网站公司哪家好关键词在线优化
  • 男士手表网站今日热榜
  • 软件项目管理内容实时seo排名点击软件
  • wdcp网站打不开八种营销模式
  • 网站建设推广注册公司seo网站优化师
  • 仿一个网站民宿平台搜索量上涨
  • 公司建设网站计入什么分录百度号码认证平台官网
  • 三线建设学兵连网站西安地区联系人谁有推荐的网址
  • 做公司网站需要花钱吗百度上做广告怎么收费
  • 厦门网站关键词推广深圳网站建设推广优化公司
  • 企业建站做网站百度在西安有分公司吗
  • 莞城区网站建设公司网站seo技术能不能赚钱
  • 网站栏目做ip地址访问限制搜索引擎优化推广
  • 做设计那些网站可以卖设计图seo优化首页
  • 好看的官网源码关键词的分类和优化
  • 网站编程多少钱如何做一个营销方案