SattwikAyyagari commited on
Commit
8529dbe
·
1 Parent(s): be1bad8

Updated prompt for document generation with correct indentation again

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -83,6 +83,7 @@ def generate_code(task_type: str, nl_input: str):
83
  elif task_type=="Generate Documentation":
84
  # prompt= f"### Instruction:\n\nGenerate documentation for the following code:\n\n{nl_input}\n\n### Response:\n\n/**"
85
  prompt = f"### Instruction:\n\nWrite a documentation comment with @param and @return tags for the following method:\n\n{nl_input}\n\n### Response:\n\n/**"
 
86
  output=model.generate(**inputs,max_new_tokens=200, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.eos_token_id)
87
  response = tokenizer.decode(output[0], skip_special_tokens=True).split("### Response:\n\n")[-1].strip()
88
  if not response.startswith("/**"):
 
83
  elif task_type=="Generate Documentation":
84
  # prompt= f"### Instruction:\n\nGenerate documentation for the following code:\n\n{nl_input}\n\n### Response:\n\n/**"
85
  prompt = f"### Instruction:\n\nWrite a documentation comment with @param and @return tags for the following method:\n\n{nl_input}\n\n### Response:\n\n/**"
86
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
87
  output=model.generate(**inputs,max_new_tokens=200, eos_token_id=tokenizer.eos_token_id, pad_token_id=tokenizer.eos_token_id)
88
  response = tokenizer.decode(output[0], skip_special_tokens=True).split("### Response:\n\n")[-1].strip()
89
  if not response.startswith("/**"):