精度验证可以基于问答判断文本生成功能。prompt = ["Common sense questions and answers\n\nQuestion: What is the capital of France\nFactual answer:"]
inputs = tokenizer(prompt, return_tensors="pt", padding="max_length", max_length=SEQ_LEN_IN)
with torch.no_grad():
generate_ids = model.generate(inputs.input_ids.npu(), attention_mask=inputs.attention_mask.npu(), max_new_tokens=SEQ_LEN_OUT)
res = tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
for item in res:
print(item)