Allen Park commited on
Commit
bc3ac0f
·
1 Parent(s): 0108e87

add print statements for debugging

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -69,7 +69,9 @@ HEADER = """
69
  def model_call(question, document, answer):
70
  device = next(model.parameters()).device
71
  NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
 
72
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt").to(device)
 
73
  input_ids = inputs.input_ids
74
  attention_mask = inputs.attention_mask
75
  generate_kwargs = dict(
@@ -78,8 +80,10 @@ def model_call(question, document, answer):
78
  attention_mask=attention_mask,
79
  pad_token_id=tokenizer.eos_token_id,
80
  )
 
81
  with torch.no_grad():
82
  outputs = model.generate(**generate_kwargs)
 
83
  generated_text = tokenizer.decode(outputs[0])
84
  print(generated_text)
85
  return generated_text
 
69
  def model_call(question, document, answer):
70
  device = next(model.parameters()).device
71
  NEW_FORMAT = PROMPT.format(question=question, document=document, answer=answer)
72
+ print("ENTIRE NEW_FORMAT", NEW_FORMAT)
73
  inputs = tokenizer(NEW_FORMAT, return_tensors="pt").to(device)
74
+ print("INPUTS", inputs)
75
  input_ids = inputs.input_ids
76
  attention_mask = inputs.attention_mask
77
  generate_kwargs = dict(
 
80
  attention_mask=attention_mask,
81
  pad_token_id=tokenizer.eos_token_id,
82
  )
83
+ print("GENERATE_KWARGS", generate_kwargs)
84
  with torch.no_grad():
85
  outputs = model.generate(**generate_kwargs)
86
+ print("OUTPUTS", outputs)
87
  generated_text = tokenizer.decode(outputs[0])
88
  print(generated_text)
89
  return generated_text