DavinciDreams commited on
Commit
443b747
·
1 Parent(s): 492f84f

Fix default temp=0.8, top_k=20, fix fallback tokenizer to 38 chars

Browse files
Files changed (1) hide show
  1. server.py +5 -5
server.py CHANGED
@@ -264,7 +264,7 @@ vocab_size = hp["vocab_size"]
264
 
265
  # Fallback tokenizer if vocab.json missing
266
  if tok is None:
267
- chars = sorted(set("abcdefghijklmnopqrstuvwxyz ."))
268
  tok = CharTokenizer(chars)
269
  print(f" Built fallback char vocab: {tok.vocab_size} chars")
270
 
@@ -335,8 +335,8 @@ class ChatRequest(BaseModel):
335
  model: Optional[str] = MODEL_ID
336
  messages: List[Message]
337
  max_tokens: Optional[int] = 200
338
- temperature: Optional[float] = 0.1
339
- top_k: Optional[int] = 8
340
  repetition_penalty: Optional[float] = 1.3
341
  n: Optional[int] = 1
342
  stream: Optional[bool] = False
@@ -386,8 +386,8 @@ def chat_completions(req: ChatRequest):
386
  ids = [0]
387
 
388
  max_tokens = max(1, min(req.max_tokens or 200, block_size))
389
- temperature = max(0.01, min(req.temperature or 0.1, 2.0))
390
- top_k = max(1, min(req.top_k or 8, tok.vocab_size))
391
  rep_penalty = max(1.0, min(req.repetition_penalty or 1.3, 3.0))
392
  n = max(1, min(req.n or 1, 4))
393
  completion_id = f"chatcmpl-{uuid.uuid4().hex[:8]}"
 
264
 
265
  # Fallback tokenizer if vocab.json missing
266
  if tok is None:
267
+ chars = [" ","!","\"","'","(",")",",","-",".",":",";","?","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
268
  tok = CharTokenizer(chars)
269
  print(f" Built fallback char vocab: {tok.vocab_size} chars")
270
 
 
335
  model: Optional[str] = MODEL_ID
336
  messages: List[Message]
337
  max_tokens: Optional[int] = 200
338
+ temperature: Optional[float] = 0.8
339
+ top_k: Optional[int] = 20
340
  repetition_penalty: Optional[float] = 1.3
341
  n: Optional[int] = 1
342
  stream: Optional[bool] = False
 
386
  ids = [0]
387
 
388
  max_tokens = max(1, min(req.max_tokens or 200, block_size))
389
+ temperature = max(0.01, min(req.temperature or 0.8, 2.0))
390
+ top_k = max(1, min(req.top_k or 20, tok.vocab_size))
391
  rep_penalty = max(1.0, min(req.repetition_penalty or 1.3, 3.0))
392
  n = max(1, min(req.n or 1, 4))
393
  completion_id = f"chatcmpl-{uuid.uuid4().hex[:8]}"