add handling of optional param (#3608)
This commit is contained in:
Родитель
ebebef47cd
Коммит
95ea1b81fe
|
@ -56,6 +56,7 @@ def initialize_evaluators(command_line_args):
|
||||||
"""Initialize the evaluators using correct parameters and credentials for rai evaluators."""
|
"""Initialize the evaluators using correct parameters and credentials for rai evaluators."""
|
||||||
evaluators = {}
|
evaluators = {}
|
||||||
evaluators_o = json.loads(command_line_args.evaluators)
|
evaluators_o = json.loads(command_line_args.evaluators)
|
||||||
|
rai_evaluators = json.loads(command_line_args.rai_evaluators)
|
||||||
for evaluator_name, evaluator in evaluators_o.items():
|
for evaluator_name, evaluator in evaluators_o.items():
|
||||||
init_params = evaluator["InitParams"]
|
init_params = evaluator["InitParams"]
|
||||||
update_value_in_dict(init_params, "AZURE_OPENAI_API_KEY", lambda x: os.environ[x.upper()])
|
update_value_in_dict(init_params, "AZURE_OPENAI_API_KEY", lambda x: os.environ[x.upper()])
|
||||||
|
@ -122,11 +123,9 @@ parser.add_argument("--eval_data", type=str)
|
||||||
parser.add_argument("--eval_output", type=str)
|
parser.add_argument("--eval_output", type=str)
|
||||||
parser.add_argument("--evaluators", type=str)
|
parser.add_argument("--evaluators", type=str)
|
||||||
parser.add_argument("--evaluator_name_id_map", type=str)
|
parser.add_argument("--evaluator_name_id_map", type=str)
|
||||||
|
parser.add_argument("--rai_evaluators", type=str, help="Comma-separated list of RAI evaluators", required=False)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
rai_evaluators = ['Sexual-Content-Evaluator', 'Hate-and-Unfairness-Evaluator',
|
|
||||||
'Violent-Content-Evaluator', 'Self-Harm-Related-Content-Evaluator',
|
|
||||||
'Groundedness-Pro-Evaluator', 'Protected-Material-Evaluator', 'Indirect-Attack-Evaluator']
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
copy_evaluator_files(args)
|
copy_evaluator_files(args)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
azure-ai-evaluation~=1.0.0b5
|
azure-ai-evaluation==1.0.0b5
|
||||||
azureml-mlflow=={{latest-pypi-version}}
|
azureml-mlflow=={{latest-pypi-version}}
|
||||||
azure-ai-ml=={{latest-pypi-version}}
|
azure-ai-ml=={{latest-pypi-version}}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче