bojone / bert4keras

keras implement of transformers for humans
https://kexue.fm/archives/6915
Apache License 2.0
5.34k stars 923 forks source link

'Tokenizer' object has no attribute '_token_pad_id' #517

Open Jwinre opened 1 year ago

Jwinre commented 1 year ago

提问时请尽可能提供如下信息:

基本信息

核心代码

# 请在此处贴上你的核心代码。
# 请尽量只保留关键部分,不要无脑贴全部代码。

输出信息

Traceback (most recent call last): File "D:/pycharm_pro/PyCharm 2023.1/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "D:\pycharm_pro\PyCharm 2023.1\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:\AAA\Bert\bert4keras-master\pretraining\data_utils.py", line 379, in tokenizer, word_segment, sequence_length=sequence_length File "E:\AAA\Bert\bert4keras-master\pretraining\data_utils.py", line 158, in init super(TrainingDatasetRoBERTa, self).init(tokenizer, sequence_length) File "E:\AAA\Bert\bert4keras-master\pretraining\data_utils.py", line 22, in init self.token_pad_id = tokenizer._token_pad_id AttributeError: 'Tokenizer' object has no attribute '_token_pad_id'



### 自我尝试
不管什么问题,请先尝试自行解决,“万般努力”之下仍然无法解决再来提问。此处请贴上你的努力过程。
已经确认词表有[PAD],换了几个模型和词表还是这样报错,求助大神们
bojone commented 1 year ago

加载的是什么词表

Jwinre commented 1 year ago

加载的是什么词表

转换过的albert模型中的词表,是想微调albert,谢谢!