当前位置:   article > 正文

Flat-Lattice-Transformer 复现,附带数据集(Weibo、Resume、MSRA)_resume数据集参考文献

resume数据集参考文献

使用fastNLP(0.5.0)时报错:There is no usable gpu. set device as cpu or None.

在复现论文Flat-Lattice-Transformer的时候,按照源代码:https://github.com/LeeSureman/Flat-Lattice-Transformer 的要求安装fastNLP==0.5.0的版本,但是还是存在问题,当在CPU的机器上跑代码的时候会报以下错误:

ValueError: There is no usable gpu. set `device` as `cpu` or `None`.
  • 1

虽然已经配置了CPU:

parser.add_argument('--device', default='cpu')
  • 1

此时需要修改fastNLP的源码,
在此路径下:

C:\Users\lx\AppData\Local\Programs\Python\Python38\Lib\site-packages\fastNLP\core\utils.py
  • 1

将该目录下的.py文件226-228行改为:

        # if not torch.cuda.is_available() and (
        #         device != 'cpu' or (isinstance(device, torch.device) and device.type != 'cpu')):
        #     raise ValueError("There is no usable gpu. set `device` as `cpu` or `None`.")
        if not torch.cuda.is_available() and ((isinstance(device, str) and device != 'cpu') or
                                              (isinstance(device, torch.device) and device.type != 'cpu')):
            raise ValueError("There is no usable gpu. set `device` as `cpu` or `None`.")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

就ok了,但由于cpu还是跑不起来:

RuntimeError: [enforce fail at ..\c10\core\CPUAllocator.cpp:75] data. DefaultCPUAllocator: not enough memory: you tried to allocate 325140480 bytes. Buy new RAM!
  • 1

居然建议我换RAM。(还是老老实实在服务器上跑吧,本地只是验证该程序的可行性)

ps:
处理好的Weibo数据集:
链接:https://pan.baidu.com/s/1QfWukFze_modzz3vo9cWBw
提取码:hell

处理好的Resume数据集:
链接:https://pan.baidu.com/s/1p8YgbZgXdedHzfNpn5ntrg
提取码:hell

处理好的MSRA数据集:
链接:https://pan.baidu.com/s/1WrNf3CGqA3pFCnG-3AlTow
提取码:hell

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/175340
推荐阅读
相关标签
  

闽ICP备14008679号