Spaces:
Runtime error
Runtime error
Commit ·
2c34bf1
1
Parent(s): ee3ead4
Added repetition penalty
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ model = AutoModelForCausalLM.from_pretrained("SattwikAyyagari/codegen-350M-NL-Ja
|
|
| 7 |
|
| 8 |
def generate_code(nl_input: str):
|
| 9 |
inputs=tokenizer(f"### Instruction: \n{nl_input}\n\n### Response:\n",return_tensors="pt")
|
| 10 |
-
outputs=model.generate(**inputs,max_new_tokens=128)
|
| 11 |
decoded=tokenizer.decode(outputs[0],skip_special_tokens=True)
|
| 12 |
return decoded.split("### Response:\n")[-1]
|
| 13 |
|
|
|
|
| 7 |
|
| 8 |
def generate_code(nl_input: str):
|
| 9 |
inputs=tokenizer(f"### Instruction: \n{nl_input}\n\n### Response:\n",return_tensors="pt")
|
| 10 |
+
outputs=model.generate(**inputs,max_new_tokens=128,repetition_penalty=1.2)
|
| 11 |
decoded=tokenizer.decode(outputs[0],skip_special_tokens=True)
|
| 12 |
return decoded.split("### Response:\n")[-1]
|
| 13 |
|