31):
32 if config_file is None:
33 config_file = getMLCalibrationConfig(flags)
34
36 config = yaml.safe_load(f)
37
38 onnx_model_path = config["model"]["onnx_path"]
39 features = config["data"]["features"]
40 sorted_features = sorted(features.items(), key=lambda item: item[1]["position"])
41 transform_names = [
42 item[1]["preprocessing"]["processors"][0] for item in sorted_features
43 ]
44 transform_params = [
45 [float(x) for x in item[1]["preprocessing"]["parameters"]]
46 for item in sorted_features
47 ]
48
49 ca = ComponentAccumulator()
50 onnx_tool = ca.popToolsAndMerge(OnnxRuntimeInferenceToolCfg(flags, onnx_model_path))
51 CaloClusterMLCalibToolLite = CompFactory.CaloClusterMLCalibToolLite(name)
52 CaloClusterMLCalibToolLite.ORTInferenceTool = onnx_tool
53 CaloClusterMLCalibToolLite.PreprocessingTransformNames = transform_names
54 CaloClusterMLCalibToolLite.PreprocessingTransformParams = transform_params
55 ca.setPrivateTools(CaloClusterMLCalibToolLite)
56
57 return ca
static std::string FindCalibFile(const std::string &logical_file_name)