Allen Park commited on
Commit
b5e9a85
·
1 Parent(s): 7d126a2

pass inputs.input_ids not just inputs

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import torch
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import gradio as gr
 
4
 
5
  PROMPT = """
6
  Given the following QUESTION, DOCUMENT and ANSWER you must analyze the provided answer and determine whether it is faithful to the contents of the DOCUMENT. The ANSWER must not offer new information beyond the context provided in the DOCUMENT. The ANSWER also must not contradict information provided in the DOCUMENT. Output your final verdict by strictly following this format: "PASS" if the answer is faithful to the DOCUMENT and "FAIL" if the answer is not faithful to the DOCUMENT. Show your reasoning.
@@ -29,7 +30,7 @@ def model_call(question, document, answer):
29
  tokenizer = AutoTokenizer.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct")
30
  model = AutoModelForCausalLM.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct", torch_dtype=torch.float16, device_map="auto")
31
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
32
- model.generate(inputs)
33
  generated_text = tokenizer.decode(inputs.input_ids[0])
34
  print(generated_text)
35
  return generated_text
 
1
  import torch
2
  from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import gradio as gr
4
+ import spaces
5
 
6
  PROMPT = """
7
  Given the following QUESTION, DOCUMENT and ANSWER you must analyze the provided answer and determine whether it is faithful to the contents of the DOCUMENT. The ANSWER must not offer new information beyond the context provided in the DOCUMENT. The ANSWER also must not contradict information provided in the DOCUMENT. Output your final verdict by strictly following this format: "PASS" if the answer is faithful to the DOCUMENT and "FAIL" if the answer is not faithful to the DOCUMENT. Show your reasoning.
 
30
  tokenizer = AutoTokenizer.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct")
31
  model = AutoModelForCausalLM.from_pretrained("PatronusAI/Llama-3-Patronus-Lynx-8B-Instruct", torch_dtype=torch.float16, device_map="auto")
32
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt")
33
+ model.generate(inputs.input_ids)
34
  generated_text = tokenizer.decode(inputs.input_ids[0])
35
  print(generated_text)
36
  return generated_text