support batch tests

This commit is contained in:
Adam Wilson
2025-08-19 20:09:34 -06:00
parent 3585f80414
commit cc124a91a3
12 changed files with 277 additions and 74 deletions
+7
View File
@@ -0,0 +1,7 @@
from enum import Enum
class ModelId(Enum):
APPLE_OPENELM_1_1B_INSTRUCT = "apple/OpenELM-1_1B-Instruct"
META_LLAMA_3_2_3B_INSTRUCT = "meta-llama/Llama-3.2-3B-Instruct"
MICROSOFT_PHI_3_MINI4K_INSTRUCT = "microsoft/Phi-3-mini-4k-instruct"
@@ -7,17 +7,30 @@ import time
from datetime import datetime
from typing import Any, Dict, List
from src.text_generation.common.model_id import ModelId
from src.text_generation.domain.text_generation_completion_result import TextGenerationCompletionResult
from src.text_generation.services.logging.abstract_test_run_logging_service import AbstractTestRunLoggingService
class TestRunLoggingService(AbstractTestRunLoggingService):
def __init__(self, test_id: int):
def __init__(
self,
test_id: int,
model_id: ModelId,
start: int,
end: int
):
self._lock = threading.Lock()
timestamp = calendar.timegm(time.gmtime())
self.log_file_path = f"./tests/logs/test_{test_id}/test_{test_id}_logs_{timestamp}.json"
base_path = os.environ.get('TEST_RUNS', '.')
self.log_file_path = os.path.join(base_path, str(f"test_{test_id}/{str(model_id.value).replace("/", "_")}/{start}_{end}/test_{str(test_id).lower()}_logs_{timestamp}.json").lower())
# Ensure directory structure exists
os.makedirs(os.path.dirname(self.log_file_path), exist_ok=True)
self._ensure_log_file_exists()
def _ensure_log_file_exists(self):
if not os.path.exists(self.log_file_path):
with open(self.log_file_path, 'w') as f: