AOAI evaluator fixes
This commit is contained in:
Родитель
4c2a6914bc
Коммит
79312bd48c
|
@ -1,4 +1,4 @@
|
|||
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu22.04:{{latest-image-tag}}
|
||||
FROM mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu22.04:latest
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN pip install -r /app/requirements.txt
|
||||
|
|
|
@ -8,6 +8,7 @@ import logging
|
|||
from collections import defaultdict
|
||||
import importlib
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
from promptflow.client import load_flow
|
||||
from azure.ai.evaluation import evaluate
|
||||
|
@ -101,6 +102,24 @@ def download_evaluators_and_update_local_path(evaluators):
|
|||
return evaluators
|
||||
|
||||
|
||||
def copy_evaluator_files(command_line_args):
|
||||
"""Copy the mounted evaluator files to the relative paths to enable read/write."""
|
||||
evaluators = json.loads(command_line_args["evaluators"])
|
||||
evaluator_name_id_map = json.loads(command_line_args.evaluator_name_id_map)
|
||||
for evaluator_name, evaluator_id in evaluator_name_id_map.items():
|
||||
dir_path = find_file_and_get_parent_dir(evaluator_id)
|
||||
if dir_path:
|
||||
shutil.copytree(dir_path, f"./{evaluator_name}")
|
||||
logger.info(f"Copying {dir_path} to ./{evaluator_name}")
|
||||
copied_dir = os.listdir(f"./{evaluator_name}")
|
||||
logger.info(f"Directory ./{evaluator_name} now contains: {copied_dir}")
|
||||
sys.path.append(os.path.abspath(f"./{evaluator_name}"))
|
||||
evaluators[evaluator_name]["local_path"] = os.path.abspath(f"./{evaluator_name}")
|
||||
else:
|
||||
logger.info(f"Directory for evaluator {evaluator_name} not found.")
|
||||
return evaluators
|
||||
|
||||
|
||||
def load_evaluators(input_evaluators):
|
||||
"""Initialize the evaluators using correct parameters and credentials for rai evaluators."""
|
||||
loaded_evaluators, loaded_evaluator_configs = {}, {}
|
||||
|
@ -150,8 +169,7 @@ rai_evaluators = [
|
|||
|
||||
def run(args):
|
||||
"""Entry point of model prediction script."""
|
||||
evaluators = json.loads(args["evaluators"])
|
||||
evaluators = download_evaluators_and_update_local_path(evaluators)
|
||||
evaluators = copy_evaluator_files(args)
|
||||
evaluators, evaluator_configs = load_evaluators(evaluators)
|
||||
run_evaluation(args, evaluators, evaluator_configs)
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
azure-ai-evaluation~=1.0.0b5
|
||||
azureml-mlflow=={{latest-pypi-version}}
|
||||
azure-ai-ml=={{latest-pypi-version}}
|
||||
|
||||
openai=={{latest-pypi-version}}
|
||||
opentelemetry-api=={{latest-pypi-version}}
|
||||
opentelemetry-sdk=={{latest-pypi-version}}
|
||||
azure-monitor-query=={{latest-pypi-version}}
|
||||
croniter=={{latest-pypi-version}}
|
||||
azure-monitor-opentelemetry=={{latest-pypi-version}}
|
||||
promptflow-azure=={{latest-pypi-version}}
|
||||
azure-identity=={{latest-pypi-version}}
|
||||
azure-ai-evaluation==1.0.0.b3
|
||||
azureml-mlflow==1.57.0
|
||||
azure-ai-ml==1.21.0
|
||||
|
||||
|
||||
openai==1.51.2
|
||||
opentelemetry-api==1.27.0
|
||||
opentelemetry-sdk==1.27.0
|
||||
azure-monitor-query==1.4.0
|
||||
croniter==3.0.3
|
||||
azure-monitor-opentelemetry==1.6.2
|
||||
promptflow-azure==1.16.1
|
||||
azure-identity==1.19.0
|
||||
|
|
Загрузка…
Ссылка в новой задаче