问题
使用huggingfacetransformers
库中tokenizer.encode()
方法时遭遇报错:
TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]]
报错代码
# 加载tokenizer
import torch
from transformers import AutoTokenizer
model_path = "J:\llm_model\meta-llama_Meta-Llama-3-8B"
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
# 构建输入
prompt_template = (
"'instruction':'You are an expert in named entity recognition. "
"Please extract entities from the input."
"Return a empty list if the entity type does not exist."
"Please respond in the format of a JSON string.', \n"
"'input':'{text}' \n"
"'result':")
data = [{
"text":"iYqueCode为企业提供了一套高效、便捷的开箱即用的活码应用解决方案。"},
{