一、simbert、simbertv2 介绍
话不多说,直接上链接:
苏神的科学空间:https://spaces.ac.cn/
simbert:https://spaces.ac.cn/archives/7427
simbertv2:https://spaces.ac.cn/archives/8454
苏神NB!
二、遇到报错的心路历程
最近重新搭了ubuntu20.04环境,换了30系列的显卡,由于30系列的显卡只支持CUDA11,所以安装了nvidia自己维护的tensorflow1.15,安装了bert4keras0.11.3,到github上看苏神的代码仓库说simbert当时的环境是bert4keras0.7.7,运行起来就出现如下错误:
AttributeError: type object 'AutoRegressiveDecoder' has no attribute 'set_rtype'
三、解决方案
后来我又搞了一个虚拟环境,装了 bert4keras0.7.7,发现 snippets.py 下的 AutoRegressiveDecoder 类进行了重写。我就索性直接把0.7.7版本里的这个类直接粘到新版本的 snippets.py 下 命名: AutoRegressiveDecoder_old ,然后直接引用,反正是能用了。
至于 simbertv2 ,直接用新版本的 bert4keras 就OK
2022-06-16更,只是换了函数名,直接把 set_rtype 改成 wraps 就好了