Spaces:
Build error
Build error
Update main.py
Browse files
main.py
CHANGED
@@ -16,7 +16,7 @@ class Validation(BaseModel):
|
|
16 |
user_prompt: str # User's input prompt
|
17 |
system_prompt: str # System's guiding prompt
|
18 |
max_tokens: int = 1024,
|
19 |
-
temperature: float = 0.
|
20 |
top_p: float = 0.9,
|
21 |
repeat_penalty: float = 1.1,
|
22 |
top_k: int = 40
|
@@ -33,7 +33,16 @@ async def generate_response(item: Validation):
|
|
33 |
{ item.user_prompt }<|eot_id|> \n <|start_header_id|>assistant<|end_header_id|>"""
|
34 |
|
35 |
# Call the Llama model to generate a response
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
# Extract and return the text from the response
|
39 |
return output['choices'][0]['text']
|
|
|
16 |
user_prompt: str # User's input prompt
|
17 |
system_prompt: str # System's guiding prompt
|
18 |
max_tokens: int = 1024,
|
19 |
+
temperature: float = 0.01,
|
20 |
top_p: float = 0.9,
|
21 |
repeat_penalty: float = 1.1,
|
22 |
top_k: int = 40
|
|
|
33 |
{ item.user_prompt }<|eot_id|> \n <|start_header_id|>assistant<|end_header_id|>"""
|
34 |
|
35 |
# Call the Llama model to generate a response
|
36 |
+
max_tokens = int(item.max_tokens)
|
37 |
+
temperature = float(item.temperature)
|
38 |
+
top_p = float(item.top_p)
|
39 |
+
repeat_penalty = float(item.repeat_penalty) # Explicitly cast to float
|
40 |
+
top_k = int(item.top_k)
|
41 |
+
|
42 |
+
# Call the Llama model to generate a response
|
43 |
+
output = llm(prompt, max_tokens=max_tokens, temperature=temperature, top_p=top_p,
|
44 |
+
repeat_penalty=repeat_penalty, top_k=top_k, echo=True)
|
45 |
+
|
46 |
|
47 |
# Extract and return the text from the response
|
48 |
return output['choices'][0]['text']
|