Do0rMaMu commited on
Commit
465d646
·
verified ·
1 Parent(s): 42559d9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -2
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.001,
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
- output = llm(prompt, max_tokens = item.max_tokens,temperature = item.temperature , top_p = item.top_p , repeat_penalty = item.repeat_penalty, top_k = item.top_k ,echo=True) # Update parameters as needed
 
 
 
 
 
 
 
 
 
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']