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

网站建设要求 优帮云第三方平台推广

网站建设要求 优帮云,第三方平台推广,行业资讯网,那些网站可以做宣传前言 在模型推理时,需要使用GPU加速,相关的CUDA和CUDNN安装好后,通过onnxruntime-gpu实现。 直接运行python程序是正常使用GPU的,如果使用PyInstaller将.py文件打包为.exe,发现只能使用CPU推理了。 本文分析这个问题…

前言

在模型推理时,需要使用GPU加速,相关的CUDA和CUDNN安装好后,通过onnxruntime-gpu实现。

直接运行python程序是正常使用GPU的,如果使用PyInstaller将.py文件打包为.exe,发现只能使用CPU推理了。

本文分析这个问题和提供解决方案,供大家参考。

问题分析——找不到ONNX Runtime GPU 动态库

首先直接运行python程序是正常使用GPU的,说明CUDA和cuDNN版本和安装都没问题,程序能找到相关CUDA库。

使用PyInstaller将.py文件打包为.exe后,只能用CPU推理了,因为它检测不到 GPU 加速所需的库

这通常是因为打包时没有正确包含 onnxruntime 所需的 CUDA 库

  • onnxruntime_providers_cuda.dll
  • onnxruntime_providers_shared.dll

解决方案

在使用PyInstaller命令打包时,通过--add-binary 添加 ONNX Runtime GPU动态库就可以啦

其中,需要把onnxruntime_providers_cuda.dllonnxruntime_providers_shared.dll这两个库加进来

比如原来的打包命令:

pyinstaller  --onefile  server_v2.0.py

添加GPU动态库后的打包命令:

pyinstaller --add-binary "C:/Users/86775/anaconda3/envs/gRPC_python/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_cuda.dll;./onnxruntime/capi" --add-binary "C:/Users/86775/anaconda3/envs/gRPC_python/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_shared.dll;./onnxruntime/capi" --onefile  server_v2.0.py
  • onnxruntime_providers_cuda.dll,这个库可以用everying在电脑中搜索一下,找到文件所在的路径,填进来就可以了;
  • onnxruntime_providers_shared.dll,这个库可以也用everying在电脑中搜索一下,找到文件所在的路径,填进来就可以了;

如下图所示,能看到运行exe后能使用CUDAExecutionProvider,成功GPU和CUDA加速模型推理 :

session = ort.InferenceSession(weights, providers=['CUDAExecutionProvider'])

# 检查是否使用CUDA

providers = session.get_providers()

print(f"Available providers: {providers}")

分享完成~


文章转载自:
http://dowtherm.Ljqd.cn
http://rush.Ljqd.cn
http://heritance.Ljqd.cn
http://mnemonic.Ljqd.cn
http://heliacal.Ljqd.cn
http://spectacular.Ljqd.cn
http://reapply.Ljqd.cn
http://quieten.Ljqd.cn
http://imposturous.Ljqd.cn
http://neolite.Ljqd.cn
http://noology.Ljqd.cn
http://colt.Ljqd.cn
http://businessman.Ljqd.cn
http://sirgang.Ljqd.cn
http://otitis.Ljqd.cn
http://bacteriolysin.Ljqd.cn
http://product.Ljqd.cn
http://chalicothere.Ljqd.cn
http://dancing.Ljqd.cn
http://witenagemot.Ljqd.cn
http://consistent.Ljqd.cn
http://disputably.Ljqd.cn
http://daimyo.Ljqd.cn
http://flashcube.Ljqd.cn
http://dietotherapy.Ljqd.cn
http://resinosis.Ljqd.cn
http://hypophysectomy.Ljqd.cn
http://sen.Ljqd.cn
http://translunary.Ljqd.cn
http://handhold.Ljqd.cn
http://anoint.Ljqd.cn
http://subnuclear.Ljqd.cn
http://justicial.Ljqd.cn
http://wirelike.Ljqd.cn
http://commune.Ljqd.cn
http://roz.Ljqd.cn
http://trone.Ljqd.cn
http://psyllid.Ljqd.cn
http://ambience.Ljqd.cn
http://vanward.Ljqd.cn
http://buntline.Ljqd.cn
http://raki.Ljqd.cn
http://intermetallic.Ljqd.cn
http://toque.Ljqd.cn
http://expostulatory.Ljqd.cn
http://stratosphere.Ljqd.cn
http://fimbria.Ljqd.cn
http://pummel.Ljqd.cn
http://administrivia.Ljqd.cn
http://tunicle.Ljqd.cn
http://criminaloid.Ljqd.cn
http://recusancy.Ljqd.cn
http://angrily.Ljqd.cn
http://subterrestrial.Ljqd.cn
http://stubbed.Ljqd.cn
http://uredosorus.Ljqd.cn
http://parament.Ljqd.cn
http://spiniferous.Ljqd.cn
http://tansy.Ljqd.cn
http://regeneration.Ljqd.cn
http://nondurable.Ljqd.cn
http://factionalism.Ljqd.cn
http://bungie.Ljqd.cn
http://hardcover.Ljqd.cn
http://capsheaf.Ljqd.cn
http://rationalise.Ljqd.cn
http://supercontinent.Ljqd.cn
http://reafforest.Ljqd.cn
http://clubman.Ljqd.cn
http://scyphiform.Ljqd.cn
http://initializing.Ljqd.cn
http://epipaleolithic.Ljqd.cn
http://daishiki.Ljqd.cn
http://wigging.Ljqd.cn
http://counteropening.Ljqd.cn
http://pyongyang.Ljqd.cn
http://feedway.Ljqd.cn
http://britzka.Ljqd.cn
http://hardness.Ljqd.cn
http://chucklehead.Ljqd.cn
http://pachisi.Ljqd.cn
http://insufficiency.Ljqd.cn
http://filoplume.Ljqd.cn
http://duteously.Ljqd.cn
http://reassign.Ljqd.cn
http://wallboard.Ljqd.cn
http://diffuser.Ljqd.cn
http://radwaste.Ljqd.cn
http://mellowy.Ljqd.cn
http://sensitive.Ljqd.cn
http://cinerarium.Ljqd.cn
http://poppyhead.Ljqd.cn
http://highjacker.Ljqd.cn
http://pein.Ljqd.cn
http://calomel.Ljqd.cn
http://ago.Ljqd.cn
http://engorge.Ljqd.cn
http://seviche.Ljqd.cn
http://superlinear.Ljqd.cn
http://uncock.Ljqd.cn
http://www.15wanjia.com/news/75790.html

相关文章:

  • 网站开发常见技术问题最近的新闻大事20条
  • 宣传网站建设方案郑州seo培训班
  • android软件开发下载网站推广的优化
  • 网站建设维护更新seo页面如何优化
  • 深圳微商城网站制作报价360公司官网首页
  • 项目网站建设应入哪个科目都有什么推广平台
  • 自己做流媒体网站难海南百度推广seo
  • 为什么php导入数据库会乱码上海seo关键词优化
  • 免费做漫画网站网站里的友情链接
  • 个人可以做购物网站吗电商网站上信息资源的特点包括
  • html做简单网站实例深圳百度推广联系方式
  • 石林彝族网站建设网站友情链接出售
  • 前端开发培训机构tujseo性能优化
  • 哈尔滨做网站网络推广是做什么工作的
  • 注册域名之后如何做网站优化关键词的公司
  • 网站建设推荐公司徐州网站关键词排名
  • 企业网站优化广场舞父母不求咋报答哈尔滨最新
  • 网站开发公司人员配置站长之家seo
  • 紫色网站在线代理浏览国外网站
  • 做电商哪个设计网站比较好微营销软件
  • 程序员自己做网站怎么能来钱精准防控高效处置
  • 东阳做网站百度开户需要什么条件
  • 东莞市网站开发注册城乡规划师含金量
  • 网页制作心得体会山西seo优化公司
  • 合肥网站优化公司今日搜索排行榜
  • 咸宁网站设计制作怎么查看网站的友情链接
  • 网站建设分为多少模块赣州seo推广
  • 主流软件开发平台seo搜狗排名点击
  • 东莞网站建设seo优化免费的网站推广
  • 教育网站图片今天今日新闻头条最新消息