Turhan123 commited on
Commit
d17865e
·
verified ·
1 Parent(s): 6744d00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -14,7 +14,7 @@ SYSTEM = (
14
  "No macros, no calories, no conversational text, no markdown, only valid JSON."
15
  )
16
 
17
- llm = Llama(model_path=MODEL_PATH, n_ctx=2048, n_threads=os.cpu_count(), chat_format="chatml")
18
  app = FastAPI()
19
 
20
  class MealIn(BaseModel):
@@ -40,7 +40,7 @@ def parse(body: MealIn, authorization: str = Header(default="")):
40
  out = llm.create_chat_completion(
41
  messages=[{"role": "system", "content": SYSTEM},
42
  {"role": "user", "content": body.meal}],
43
- temperature=0, max_tokens=512,
44
  )
45
  parsed = extract_json(out["choices"][0]["message"]["content"])
46
  if parsed is None:
 
14
  "No macros, no calories, no conversational text, no markdown, only valid JSON."
15
  )
16
 
17
+ llm = Llama(model_path=MODEL_PATH, n_ctx=2048, n_threads=2, chat_format="chatml")
18
  app = FastAPI()
19
 
20
  class MealIn(BaseModel):
 
40
  out = llm.create_chat_completion(
41
  messages=[{"role": "system", "content": SYSTEM},
42
  {"role": "user", "content": body.meal}],
43
+ temperature=0, max_tokens=256, stop=["<|im_end|>"],
44
  )
45
  parsed = extract_json(out["choices"][0]["message"]["content"])
46
  if parsed is None: