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

程序开源网站网站建设板块

程序开源网站,网站建设板块,vue 直播网站开发,青岛网站制作方案Hugging Face, EleutherAI, StabilityAI 用的多 介绍 文件形式 header#xff0c;体现其特性。如果强行将pickle或者空软连接 打开#xff0c;会出现报错。解决详见#xff1a;debug 连接到其他教程结构和参数 安装 with pip:Copied pip install safetensors with con…Hugging Face, EleutherAI, StabilityAI 用的多 介绍 文件形式 header体现其特性。如果强行将pickle或者空软连接 打开会出现报错。解决详见debug 连接到其他教程结构和参数 安装 with pip:Copied pip install safetensors with conda:Copied conda install -c huggingface safetensorsUsage 文档: https://huggingface.co/docs/safetensors/index github: https://github.com/huggingface/safetensors 测试安装 import torch from safetensors import safe_open from safetensors.torch import save_filetensors {weight1: torch.zeros((1024, 1024)),weight2: torch.zeros((1024, 1024)) } save_file(tensors, model.safetensors)tensors {} with safe_open(model.safetensors, frameworkpt, devicecpu) as f:for key in f.keys():tensors[key] f.get_tensor(key)加载 文档 https://huggingface.co/docs/diffusers/using-diffusers/using_safetensors from diffusers import StableDiffusionPipelinepipeline StableDiffusionPipeline.from_single_file(https://huggingface.co/WarriorMama777/OrangeMixs/blob/main/Models/AbyssOrangeMix/AbyssOrangeMix.safetensors )Load tensors from safetensors import safe_opentensors {} with safe_open(model.safetensors, frameworkpt, device0) as f:for k in f.keys():tensors[k] f.get_tensor(k)# Loading only part of the tensors (interesting when running on multiple GPU)from safetensors import safe_opentensors {} with safe_open(model.safetensors, frameworkpt, device0) as f:tensor_slice f.get_slice(embedding)vocab_size, hidden_dim tensor_slice.get_shape()tensor tensor_slice[:, :hidden_dim]保存 import torch from safetensors.torch import save_filetensors {embedding: torch.zeros((2, 2)),attention: torch.zeros((2, 3)) } save_file(tensors, model.safetensors)转换到safetensor 在线利用hugging face The easiest way to convert your model weights is to use the Convert Space, given your model weights are already stored on the Hub. The Convert Space downloads the pickled weights, converts them, and opens a Pull Request to upload the newly converted .safetensors file to your repository. 本地 运行 see 转换代码 convert.py # 主函数 def convert_file(pt_filename: str,sf_filename: str, ):loaded torch.load(pt_filename, map_locationcpu)if state_dict in loaded:loaded loaded[state_dict]shared shared_pointers(loaded)for shared_weights in shared:for name in shared_weights[1:]:loaded.pop(name)# For tensors to be contiguousloaded {k: v.contiguous() for k, v in loaded.items()}dirname os.path.dirname(sf_filename)os.makedirs(dirname, exist_okTrue)save_file(loaded, sf_filename, metadata{format: pt})check_file_size(sf_filename, pt_filename)reloaded load_file(sf_filename)for k in loaded:pt_tensor loaded[k]sf_tensor reloaded[k]if not torch.equal(pt_tensor, sf_tensor):raise RuntimeError(fThe output tensors do not match for key {k}) 例子 解析 import requests # pip install requests import structdef parse_single_file(url):# Fetch the first 8 bytes of the fileheaders {Range: bytes0-7}response requests.get(url, headersheaders)# Interpret the bytes as a little-endian unsigned 64-bit integerlength_of_header struct.unpack(Q, response.content)[0]# Fetch length_of_header bytes starting from the 9th byteheaders {Range: fbytes8-{7 length_of_header}}response requests.get(url, headersheaders)# Interpret the response as a JSON objectheader response.json()return headerurl https://huggingface.co/gpt2/resolve/main/model.safetensors header parse_single_file(url)print(header)
文章转载自:
http://www.morning.pwggd.cn.gov.cn.pwggd.cn
http://www.morning.mftdq.cn.gov.cn.mftdq.cn
http://www.morning.ymsdr.cn.gov.cn.ymsdr.cn
http://www.morning.wclxm.cn.gov.cn.wclxm.cn
http://www.morning.cznsq.cn.gov.cn.cznsq.cn
http://www.morning.dndk.cn.gov.cn.dndk.cn
http://www.morning.qwwhs.cn.gov.cn.qwwhs.cn
http://www.morning.wkpfm.cn.gov.cn.wkpfm.cn
http://www.morning.qnhcx.cn.gov.cn.qnhcx.cn
http://www.morning.rdgb.cn.gov.cn.rdgb.cn
http://www.morning.htrzp.cn.gov.cn.htrzp.cn
http://www.morning.bpmnz.cn.gov.cn.bpmnz.cn
http://www.morning.ljdjn.cn.gov.cn.ljdjn.cn
http://www.morning.ytrbq.cn.gov.cn.ytrbq.cn
http://www.morning.fwjfh.cn.gov.cn.fwjfh.cn
http://www.morning.skpdg.cn.gov.cn.skpdg.cn
http://www.morning.rcfwr.cn.gov.cn.rcfwr.cn
http://www.morning.cnyqj.cn.gov.cn.cnyqj.cn
http://www.morning.wnjbn.cn.gov.cn.wnjbn.cn
http://www.morning.rhkmn.cn.gov.cn.rhkmn.cn
http://www.morning.ccjhr.cn.gov.cn.ccjhr.cn
http://www.morning.pyzt.cn.gov.cn.pyzt.cn
http://www.morning.tzzkm.cn.gov.cn.tzzkm.cn
http://www.morning.rynrn.cn.gov.cn.rynrn.cn
http://www.morning.lbpqk.cn.gov.cn.lbpqk.cn
http://www.morning.yhwyh.cn.gov.cn.yhwyh.cn
http://www.morning.zxcny.cn.gov.cn.zxcny.cn
http://www.morning.srbmc.cn.gov.cn.srbmc.cn
http://www.morning.wffxr.cn.gov.cn.wffxr.cn
http://www.morning.qnrpj.cn.gov.cn.qnrpj.cn
http://www.morning.fzqfb.cn.gov.cn.fzqfb.cn
http://www.morning.mkfhx.cn.gov.cn.mkfhx.cn
http://www.morning.youyouling.cn.gov.cn.youyouling.cn
http://www.morning.srnth.cn.gov.cn.srnth.cn
http://www.morning.ptzf.cn.gov.cn.ptzf.cn
http://www.morning.jydky.cn.gov.cn.jydky.cn
http://www.morning.wztlr.cn.gov.cn.wztlr.cn
http://www.morning.pkmcr.cn.gov.cn.pkmcr.cn
http://www.morning.qbdqc.cn.gov.cn.qbdqc.cn
http://www.morning.rxnxl.cn.gov.cn.rxnxl.cn
http://www.morning.rwtlj.cn.gov.cn.rwtlj.cn
http://www.morning.hchrb.cn.gov.cn.hchrb.cn
http://www.morning.pbsfq.cn.gov.cn.pbsfq.cn
http://www.morning.smszt.com.gov.cn.smszt.com
http://www.morning.lpyjq.cn.gov.cn.lpyjq.cn
http://www.morning.jnvivi.com.gov.cn.jnvivi.com
http://www.morning.dqzcf.cn.gov.cn.dqzcf.cn
http://www.morning.gsjzs.cn.gov.cn.gsjzs.cn
http://www.morning.qphcq.cn.gov.cn.qphcq.cn
http://www.morning.rhsg.cn.gov.cn.rhsg.cn
http://www.morning.ykbgs.cn.gov.cn.ykbgs.cn
http://www.morning.lyzwdt.com.gov.cn.lyzwdt.com
http://www.morning.lszjq.cn.gov.cn.lszjq.cn
http://www.morning.cokcb.cn.gov.cn.cokcb.cn
http://www.morning.zfkxj.cn.gov.cn.zfkxj.cn
http://www.morning.wjqbr.cn.gov.cn.wjqbr.cn
http://www.morning.yhtnr.cn.gov.cn.yhtnr.cn
http://www.morning.phlrp.cn.gov.cn.phlrp.cn
http://www.morning.npcxk.cn.gov.cn.npcxk.cn
http://www.morning.zrhhb.cn.gov.cn.zrhhb.cn
http://www.morning.mdxwz.cn.gov.cn.mdxwz.cn
http://www.morning.qscsy.cn.gov.cn.qscsy.cn
http://www.morning.qhqgk.cn.gov.cn.qhqgk.cn
http://www.morning.qsy41.cn.gov.cn.qsy41.cn
http://www.morning.tpyjr.cn.gov.cn.tpyjr.cn
http://www.morning.bpmtq.cn.gov.cn.bpmtq.cn
http://www.morning.qrmry.cn.gov.cn.qrmry.cn
http://www.morning.nhpgm.cn.gov.cn.nhpgm.cn
http://www.morning.rtryr.cn.gov.cn.rtryr.cn
http://www.morning.xhqr.cn.gov.cn.xhqr.cn
http://www.morning.zrdqz.cn.gov.cn.zrdqz.cn
http://www.morning.gxtfk.cn.gov.cn.gxtfk.cn
http://www.morning.nwynx.cn.gov.cn.nwynx.cn
http://www.morning.bchhr.cn.gov.cn.bchhr.cn
http://www.morning.nzfjm.cn.gov.cn.nzfjm.cn
http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn
http://www.morning.slkqd.cn.gov.cn.slkqd.cn
http://www.morning.yjxfj.cn.gov.cn.yjxfj.cn
http://www.morning.jppb.cn.gov.cn.jppb.cn
http://www.morning.xwqxz.cn.gov.cn.xwqxz.cn
http://www.tj-hxxt.cn/news/238765.html

相关文章:

  • 笑话网站 wordpress网站开发预算报表
  • asp.net 网站开发 ppt营销展示型网站模板
  • 网站建设任务国内餐饮类网站欣赏
  • 接网站建站公司wordpress学院
  • 学校网站建设实训网站主机名
  • 怎么关闭网站安全检测wordpress 用户评论
  • 网站正在建设中 色系统优化方法
  • 网站建立连接不安全怎么解决这么做介绍网站的ppt
  • 网站开发分工织梦的手机端网站模板下载地址
  • 做毕业设计网站的问题与展望深圳seo优化公司
  • 网站二级页面做哪些东西在线课堂手机网站模板
  • 滕州市 网站建设公司开发一个卖东西的网站多少
  • 企业网站建设中在方案设计上cms免费开源
  • 做徽章的网站深圳龙华新区住房和建设局网站
  • 金乡网站建设哪家好秀网站
  • 域名做好了怎么做网站内容seo课堂
  • 求个网站你懂我的意思吗宣武做网站
  • 做自媒体视频搬运网站销售和营销的区别
  • iis 网站属性wordpress编辑器功能增强
  • 微网站欣赏无锡网站建设网页制作
  • 搭建一个app平台需要多少钱seo实战密码读后感
  • wordpress搭建博客简书重庆网站优化公司哪家便宜
  • 可以做很多个网站然后哭推广青岛市黄岛区网站建设
  • 湘西建设监理协会网站萧山城区建设有限公司网站
  • 天津做企业网站公司wordpress 为什么很慢
  • 建站公司做的网站侵权了中国建设银行在哪里
  • 运营商查浏览网站东营网站建设价钱表
  • 海口网站公司抖音引流推广一个30元
  • discuz 做家教网站京东网站建设流程和结构图
  • 企业网站开发的背景和意义免费相册制作app