报错信息 ‘ErnieTokenizer’ object is not subscriptable
代码信息
def conver_example(example,tokenizer):
tokenized=tokenizer(example["text"])
tokenized["label"]=[example["label"]]
return tokenized
from functools import partial
trans_func=partial(conver_example,tokenizer)
train_ds.map(trans_func)
train_ds[0]
解决办法
trans_func=partial(conver_example,tokenizer)改写为trans_func=partial(conver_example,tokenizer=tokenizer)