您现在的位置是:挑肥拣瘦网 > 热点
95%PyTorch库都会中招的bug!特斯拉AI总监都没能幸免
挑肥拣瘦网2026-11-14【热点】{固定数字1}人已围观
简介谷歌留痕外推【tg:seogoogle987】
本文经AI新媒体量子位(公众号ID:QbitAI)授权转载,转载请联系出处。
到底是怎样的一个bug,能让95%的Pytorch库中招,就连特斯拉AI总监深受困扰?
还别说,这个95bug虽小,但有够“狡猾”的。
这就是最近Reddit上热议的一个话题,是一位网友在使用再平常不过的Pytorch+Numpy组合时发现。
最主要的是,在代码能够跑通的情况下,它甚至还会影响模型的%P准确率!
除此之外,网友热议的另外一个点,竟然是:
而是它到底算不算一个bug?
这究竟是怎么一回事?
事情的起因是一位网友发现,在PyTorch中用NumPy来生成随机数时,受到数据预处理的限yT制,会多进程并行加载数据,但最后每个进程返回的随机数却是相同的。
他还举出例子证实了自己的说法。
如下是一个示例数据集,它会返回三个元素的随机向量。这里采用的批量大小分别为2,工作进程为4个。
然or后神奇的事情发生了:每个进程返回的随机数都是一样的。
这个结果会着实让人有点一头雾水,就好像数学应用题求小明走一段路程需要花费多少时间,而你却算出来了负数。
发现了问题后,这位网友还在GitHuchb上下载了超过10万个PyTorch库,用同样的方法产生随机数。
结果更加令人震惊:居然有超过95%的库都受到这个问题的困扰!
这其中不乏PyTorch的官方教程和OpenAI的代码,连特斯拉库都AI总监Karpathy也承认自己“被坑过”!
但有一说一,这个bug想要解决也不难:只需要在每个epoch都重新设置seed,或者用python内置的随机数生成器就可以避免这个问题。
到底是不是会中bug?
如果这个问题已经可以解决,为什么还会引起如此大的讨论呢?
因为网友们的重点已经上升到了“哲学”层面:
这到底是不是一个bug?
在Reddit上有人认为:这不是一个bug。
虽然这个问题非常常见招的,但它并不算是一个bug,而是一个在调试时不可以忽略的点。
就是这个观点,激起了千层浪花,许多人都认为他忽略了问题的关键所在。
这不是产生伪随机数的问题,也不是numpy的问题,问题的核心是在于PyTbuorch中的DataLoader的实现
对于包含随机转换的数据加载pipeline,这意味着每个worker都将选择“相同”的转换。
而现在NN中的许多数据加载pipeline,都使用某种类型的随机g!转换来进行数据增强,所以不重新初始化可能是一个预设。
另一位网友也表示这个bug其实是在预设程序下运行才出现的,应该向更多用户指出来。
并且95%以上的Pytorch库受此困扰,也绝不是危言特斯耸听。
有人就分享出了自己此前的惨痛经历:
我认识到这一点是之前跑了许多进程来创建数据集时,然而发现其中一半的数据是重复的,之后花了很长的时间才发现哪里出了问题。
也有用户补充说,如果 95% 以上拉A的用户使用时出现错误,那么代码就是错的。
顺便一提,这提供了Karpathy定律的另一个例子:即使你搞砸了一些非常基本代码,“neural nets want to work”。
你有踩过PyTorch的坑I总吗?
如上的bug并不是偶然,随着用PyTorch的人越来越多,被发现的bug也就越来越多,某乎上还有PyTorch的坑之总结,被浏览量高达49w。
其中从向量、函数到model.train监都(),无论是真bug还是自己出了bug,大家的血泪史还真的是各有千秋。
所以,关于PyTorch你可以分享的经验血泪史吗?
很赞哦!(4973)
热门文章
站长推荐
友情链接
- 标签: 康师傅
- https://www.yli.ro/catalogsearch/result/?q=谷歌留痕外推【tg:seogoogle987】,g6z
- https://www.libros.unam.mx/catalogsearch/result/?cat=37&dir=asc&format=20&lit=20&manufacturer=3230&mode=list&order=year_edition&q=谷歌留痕外推【tg:seogoogle987】,hbr
- https://www.remit.co.jp/pt/?action=CHECK&s=谷歌留痕外推【tg:seogoogle987】,R6W
- https://www.remit.co.jp/vi/?s=谷歌留痕外推【tg:seogoogle987】,VIP
- https://www.partilerdunyasi.com/index.php?route=product/search&tag=谷歌留痕外推【tg:seogoogle987】,vAK
- https://www.wilsonart.com/catalogsearch/result/?action=CHECK&q=谷歌留痕外推【tg:seogoogle987】,tEI
- https://www.tycoonstory.com/?s=谷歌留痕外推【tg:seogoogle987】,Jy6
- https://www.seforall.org/search?keywords=谷歌留痕外推【tg:seogoogle987】,k6B
- https://www.kingston.gov.uk/site-search/results/?q=谷歌留痕外推【tg:seogoogle987】,78c
- https://www.kaiyueleather.com/search/谷歌留痕外推【tg:seogoogle987】,REh
- https://www.lechzuers.com/de/search?cat=163&q=谷歌留痕外推【tg:seogoogle987】,cEO
- https://www.lee.com/search?q=谷歌留痕外推【tg:seogoogle987】,4UK
- https://www.world-architects.com/en/search?term=谷歌留痕外推【tg:seogoogle987】,h3h
- https://www.unclefossil.com/search/谷歌留痕外推【tg:seogoogle987】,FH3
- https://www.shopping.com/search.html?keyword=谷歌留痕外推【tg:seogoogle987】,T0t
- https://www.vfw.org/search-results?q=谷歌留痕外推【tg:seogoogle987】,VXg
- https://www.dba.dk/soeg/?soeg=谷歌留痕外推【tg:seogoogle987】0X2
- https://www.schenckprocess.com/search?q=谷歌留痕外推【tg:seogoogle987】,i73
- https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb=谷歌留痕外推【tg:seogoogle987】,yVQ
- https://www.ushmm.org/search/results.php?q=谷歌留痕外推【tg:seogoogle987】,4Sz
- https://www.shacknews.com/editorial-search?q=谷歌留痕外推【tg:seogoogle987】,5xd
- https://www.teamlab.art/es/?submit=谷歌留痕外推【tg:seogoogle987】,Czr
- https://www.terramania.nl/catalogsearch/result/index/?q=谷歌留痕外推【tg:seogoogle987】,U12
- https://www.temu.com/search_result.html?search_key=谷歌留痕外推【tg:seogoogle987】9jN
- https://www.lauben.com/en/?action=SEARCH&s=谷歌留痕外推【tg:seogoogle987】,m5A
- https://www.merchbar.com/search?q=谷歌留痕外推【tg:seogoogle987】,noK
- https://www.laoairlines.com/?action=QUERY&s=谷歌留痕外推【tg:seogoogle987】,7XZ
- https://www.losgatoschamber.com/list/search?action=SEARCH&q=谷歌留痕外推【tg:seogoogle987】,S3r
- https://www.xvideos.com/tags/谷歌留痕外推【tg:seogoogle987】,0DD
- https://www.revere.org/search?action=SEARCH&q=谷歌留痕外推【tg:seogoogle987】,x3a
- https://www.scivee.tv/?s=谷歌留痕外推【tg:seogoogle987】,j1m
- https://www.zalora.sg/catalog/?cat=112&q=谷歌留痕外推【tg:seogoogle987】,v3C
- https://xn--lgernevedlystskoven-lxb.dk/search/谷歌留痕外推【tg:seogoogle987】,GnR
- https://www.selfsufficientish.com/main/?s=谷歌留痕外推【tg:seogoogle987】,msm
- https://yscc1986.net/search/谷歌留痕外推【tg:seogoogle987】ooH
- https://www.abbreviations.com/谷歌留痕外推【tg:seogoogle987】7KV
- https://www.mygrandma.com/Items.aspx?search=谷歌留痕外推【tg:seogoogle987】,Uoi
- https://dict.naver.com/dict.search?dicQuery&query=谷歌留痕外推【tg:seogoogle987】Fat
- https://www.smics.com/tc/site/search?token=谷歌留痕外推【tg:seogoogle987】,pjx
- https://www.vocabulary.com/dictionary/谷歌留痕外推【tg:seogoogle987】,Mq3
- https://www.duksung.ac.kr/search/front/Search.jsp?qt=谷歌留痕外推【tg:seogoogle987】ImX
- https://www.repetto.jp/item/search?action=QUERY&q=谷歌留痕外推【tg:seogoogle987】,cfk
- https://www.ucycle.com/search/=谷歌留痕外推【tg:seogoogle987】,vJw
- https://5gaa.org/?token=6e2l7hjt2i26gzgctgwdrv7v0j6nxorq&s=谷歌留痕外推【tg:seogoogle987】PEE
- https://www.simcoemuskokahealth.org/SearchResults.aspx?SearchQuery=谷歌留痕外推【tg:seogoogle987】,p7s
- https://www.remit.co.jp/ne/?s=谷歌留痕外推【tg:seogoogle987】,I3e
- https://www.sic-info.org/en/?s=谷歌留痕外推【tg:seogoogle987】,uP7
- https://www.msrenewal.com/search/谷歌留痕外推【tg:seogoogle987】,pPK
- https://store.line.me/search/sticker/ja?q=谷歌留痕外推【tg:seogoogle987】t4t
- https://www.takachi-enclosure.com/search?eqYB=gnI31Ou&text=谷歌留痕外推【tg:seogoogle987】,H26







