diff --git a/scripts/b2_interference.py b/scripts/b2_interference.py index b48c8de..db82f05 100644 --- a/scripts/b2_interference.py +++ b/scripts/b2_interference.py @@ -51,6 +51,7 @@ async def _send( "max_tokens": max_tokens, "min_tokens": max_tokens, "temperature": 0, + "return_token_ids": True, "stream": True, "stream_options": {"include_usage": True}, } @@ -82,10 +83,15 @@ async def _send( if choices: now = time.time() token_ids = choices[0].get("token_ids") + delta = choices[0].get("text", "") if isinstance(token_ids, list) and token_ids: if ttft is None: ttft = now - t_dispatch token_times.extend([now] * len(token_ids)) + elif delta: + if ttft is None: + ttft = now - t_dispatch + token_times.append(now) usage = chunk.get("usage") if usage: n_output = usage.get("completion_tokens", n_output)