Handle missing streamed token metrics
This commit is contained in:
@@ -310,7 +310,7 @@ def stream_chat_completion(
|
||||
return StreamMetrics(
|
||||
ttft_ms=ttft_ms,
|
||||
tpot_ms=tpot_ms,
|
||||
completion_tokens=used_tokens if used_tokens > 0 else None,
|
||||
completion_tokens=used_tokens if used_tokens is not None and used_tokens > 0 else None,
|
||||
completion_tokens_source=completion_tokens_source,
|
||||
streamed_chunk_count=chunk_token_count,
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ import statistics
|
||||
import subprocess
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
from concurrent.futures import FIRST_COMPLETED, Future, ThreadPoolExecutor, wait
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
@@ -596,6 +597,7 @@ def run_trial(trial_spec_path: Path) -> dict[str, Any]:
|
||||
"best_request_count": None,
|
||||
"failure_stage": failure_stage,
|
||||
"failure_reason": str(exc),
|
||||
"failure_traceback": traceback.format_exc(),
|
||||
"probes": probe_history,
|
||||
}
|
||||
StudyStore.write_json(Path(trial.result_path), result)
|
||||
|
||||
Reference in New Issue
Block a user