bert中文分类(win10)报错: ResourceExhaustedError:OOM when allocating tensor of shape [21128,768] and type

报错: ResourceExhaustedError:OOM when allocating tensor of shape [21128,768] and type float

今天跑bert分类训练的时候遇到的bug

我的bert分类项目地址(有数据,本地win10可运行):https://github.com/yongzhuo/bert

我另外一个项目bert分类实例,可predict,很方便:https://github.com/yongzhuo/nlp_xiaojiang/tree/master/ClassificationText/bert

参考的是 小数据福音!BERT在极小数据下带来显著提升的开源实现

              这个网址: http://www.sohu.com/a/278070440_500659

过程:

1.按照它的方式处理数据,开始时候跑的是20万+的数据,报错OOM

2.首先是调小batch_size,直至2还是报错,哭。再调小max_seq_length=50,还是不行,哭

3.查了一些资料,

        1.ResourceExhaustedError (see above for traceback): OOM when allocating tensor

         地址:https://github.com/google-research/bert/issues/118

       2.ResourceExhaustedError:OOM when allocating tensor of shape [3840,4096] and type float (Out of memory Issue)

        地址:https://stackoverflow.com/questions/44971481/resourceexhaustederroroom-when-allocating-tensor-of-shape-3840-4096-and-type

        还是没有解决,但了解到是存储不够的原因了。

4.想把TPUEstimator改为Estimator,因为显卡存储不够,但内存是有16G的,改成CPU运行就好了;可惜水平不够,改不了

5.怎么办呢,让TPUEstimator运行cpu不就行了,于是增加

os.environ["CUDA_VISIBLE_DEVICES"] = "100"#没法取到显卡gpu,就走cpu了(猜测)

6.问题解决

我的bert分类项目地址(有数据,本地win10可运行):https://github.com/yongzhuo/bert

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 14
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值