if 'token_type_ids' in tokenized_output: # 兼容不需要 token_type_id 的模型, e.g. Roberta-Base
if 'token_type_ids' not in tokenized_output:
tokenized_output['token_type_ids'] = [encoded_inputs['token_type_ids']]
else:
tokenized_output['token_type_ids'].append(encoded_inputs['token_type_ids'])
大佬您好,看到units.py里的这段代码应该有一些问题,希望您看一下是否需要删除if 'token_type_ids' in tokenized_output:这行代码
if 'token_type_ids' in tokenized_output: # 兼容不需要 token_type_id 的模型, e.g. Roberta-Base if 'token_type_ids' not in tokenized_output: tokenized_output['token_type_ids'] = [encoded_inputs['token_type_ids']] else: tokenized_output['token_type_ids'].append(encoded_inputs['token_type_ids']) 大佬您好,看到units.py里的这段代码应该有一些问题,希望您看一下是否需要删除if 'token_type_ids' in tokenized_output:这行代码