Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,14 @@ model = AutoModelForCausalLM.from_pretrained(checkpoint, trust_remote_code=True)
|
|
20 |
def code_generation(gen_prompt, max_tokens, temperature=0.6, seed=42):
|
21 |
set_seed(seed)
|
22 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
23 |
-
generated_text = pipe(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
return generated_text
|
25 |
|
26 |
|
|
|
20 |
def code_generation(gen_prompt, max_tokens, temperature=0.6, seed=42):
|
21 |
set_seed(seed)
|
22 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
23 |
+
generated_text = pipe(
|
24 |
+
gen_prompt,
|
25 |
+
do_sample=True,
|
26 |
+
top_p=0.95,
|
27 |
+
temperature=temperature,
|
28 |
+
max_new_tokens=max_tokens,
|
29 |
+
eos_token_id=tokenizer.eos_token_id
|
30 |
+
)[0]['generated_text']
|
31 |
return generated_text
|
32 |
|
33 |
|