Spaces:
Runtime error
Runtime error
Commit ·
bcf6ede
1
Parent(s): 8529dbe
Updated prompt for document generation with multi line indentation
Browse files
app.py
CHANGED
|
@@ -81,8 +81,8 @@ def generate_code(task_type: str, nl_input: str):
|
|
| 81 |
output= _clean_csharp_output(response)
|
| 82 |
return format_code(output, language="cs")
|
| 83 |
elif task_type=="Generate Documentation":
|
| 84 |
-
|
| 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()
|
|
|
|
| 81 |
output= _clean_csharp_output(response)
|
| 82 |
return format_code(output, language="cs")
|
| 83 |
elif task_type=="Generate Documentation":
|
| 84 |
+
prompt = f"### Instruction:\n\nWrite a multi-line Javadoc comment with each tag on a new line, with @param and @return tags for the following method:\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()
|