EvilPsyCHo / Play-with-LLMs

Tutorial on training, evaluating LLM, as well as utilizing RAG, Agent, Chain to build entertaining applications with LLMs.分享如何训练、评估LLMs,如何基于RAG、Agent、Chain构建有趣的LLMs应用。
https://kky42.com/
MIT License
516 stars 82 forks source link

代码报错 #10

Closed shell-nlp closed 1 year ago

shell-nlp commented 1 year ago

result = tokenizer( prompt, truncation=True, max_length=max_len, padding=False, return_tensors=None, ) 为什么result的input 没有 bos 和 eos 标志 而且 result["attention_mask"].append(1) 报错 提示result["attention_mask"]为numpy类型 [[Fasle,.........True],[False,False,False...False]]

EvilPsyCHo commented 1 year ago

你提到的这些和本项目无关,huggingface tokenizer中,需要传入add_special_tokens才会自动添加bos, eos, tokenize后的结果,返回结果的具体信息等,建议看huggingface tokenizer 部分文档。