Views
No views yet
| benchmark | base | this model |
|---|---|---|
| MBPP+ pass@1 | 39.7% | 68.3% |
| HumanEval+ pass@1 | 64.6% | 70.1% |
StoppingCriteria hook over HTTP — you must pass stop sequences on
every request, and cap max_tokens:1from openai import OpenAI
2
3client = OpenAI(base_url="https://<your-endpoint>.endpoints.huggingface.cloud/v1/", api_key="hf_...")
4
5resp = client.chat.completions.create(
6 model="tgi", # vLLM: use the served model name
7 messages=[{"role": "user", "content": "Write a Python function that ..."}],
8 max_tokens=1024, # hard ceiling — it will use all of it otherwise
9 temperature=0.2,
10 stop=["\n```\n", "\n```", "<|im_end|>", "<|endoftext|>"],
11)eos_token_id is [151645, 151643] (<|im_end|>, <|endoftext|>) so the server
halts on either if the model emits one — but do not rely on that alone, hence the
stop list above.transformers1from transformers import StoppingCriteria, StoppingCriteriaList
2class StopAfterCodeBlock(StoppingCriteria):
3 def __init__(self, tok, n): self.tok, self.n = tok, n
4 def __call__(self, ids, s, **k):
5 t = self.tok.decode(ids[0][self.n:], skip_special_tokens=True)
6 i = t.find("```"); nl = t.find("\n", i) if i>=0 else -1
7 return i>=0 and nl>=0 and "```" in t[nl+1:]
8# model.generate(**enc, max_new_tokens=1024,
9# stopping_criteria=StoppingCriteriaList([StopAfterCodeBlock(tok, enc.input_ids.shape[1])]))<|im_start|>role\n...<|im_end|>). The chat template
ships both inline in tokenizer_config.json (for TGI / vLLM / the HF inference
toolkit) and as chat_template.jinja (for transformers 5.x).torch_dtype,
top-level rope_theta) and the 5.x keys (dtype, rope_parameters), so it
loads correctly on either. Do not drop the 4.x keys — every current serving
stack reads those, and without rope_theta they silently fall back to 10000.0
(wrong RoPE base → degraded output).