ATLAS Offline Software
SaltModelTriton.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef FLAVORTAGINFERENCE_SALTMODELTRITON_H
6 #define FLAVORTAGINFERENCE_SALTMODELTRITON_H
7 
16 
17 #include "grpc_client.h"
18 #include "grpc_service.pb.h"
19 
20 namespace Ort {
21  class Session;
22 }
23 
24 namespace tc = triton::client;
25 
26 namespace FlavorTagInference {
27 
29  {
30  public:
31  SaltModelTriton(const std::string& path_to_onnx
32  , const std::string& model_name
33  , float client_timeout
34  , int port
35  , const std::string& url
36  , bool useSSL);
37 
38  virtual InferenceOutput runInference(std::map<std::string, Inputs>& gnn_inputs) const override;
39 
40  virtual const SaltModelGraphConfig::GraphConfig getGraphConfig() const override;
41  virtual const OutputConfig& getOutputConfig() const override;
42  virtual SaltModelVersion getSaltModelVersion() const override;
43  virtual const std::string& getModelName() const override;
44 
45  private:
46  const nlohmann::json loadMetadata(const std::string& key, const Ort::Session* session) const;
47  const std::string determineModelType(const Ort::Session* session) const;
48  tc::InferenceServerGrpcClient* getClient() const;
49 
51 
52  size_t m_num_outputs;
53  std::string m_model_name;
54  std::string m_model_type;
56 
58 
59  std::unique_ptr<tc::InferOptions> m_options;
60  float m_clientTimeout{0.f};
61  int m_port{8001};
62  std::string m_url{};
63  bool m_useSSL{false};
64  }; // Class SaltModelnTriton
65 } // end of FlavorTagInference namespace
66 
67 #endif
68 
FlavorTagInference::SaltModelTriton::m_clientTimeout
float m_clientTimeout
Definition: SaltModelTriton.h:60
FlavorTagInference::SaltModelTriton::getOutputConfig
virtual const OutputConfig & getOutputConfig() const override
Definition: SaltModelTriton.cxx:198
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition: PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:27
Ort
Definition: SaltModelTriton.h:20
json
nlohmann::json json
Definition: HistogramDef.cxx:9
FlavorTagInference::SaltModelTriton::getSaltModelVersion
virtual SaltModelVersion getSaltModelVersion() const override
Definition: SaltModelTriton.cxx:202
FlavorTagInference::SaltModelTriton::determineModelType
const std::string determineModelType(const Ort::Session *session) const
Definition: SaltModelTriton.cxx:166
FlavorTagInference::SaltModelTriton
Definition: SaltModelTriton.h:29
FlavorTagInference::SaltModelTriton::m_output_nodes
OutputConfig m_output_nodes
Definition: SaltModelTriton.h:55
FlavorTagInference::ISaltModel
Definition: ISaltModel.h:45
python.oracle.Session
Session
Definition: oracle.py:76
physics_parameters.url
string url
Definition: physics_parameters.py:27
FlavorTagInference::SaltModelTriton::m_num_outputs
size_t m_num_outputs
Definition: SaltModelTriton.h:52
rerun_display.client
client
Definition: rerun_display.py:31
FlavorTagInference::SaltModelTriton::m_onnx_model_version
SaltModelVersion m_onnx_model_version
Definition: SaltModelTriton.h:57
FlavorTagInference::SaltModelTriton::getModelName
virtual const std::string & getModelName() const override
Definition: SaltModelTriton.cxx:206
FlavorTagInference::SaltModelTriton::getGraphConfig
virtual const SaltModelGraphConfig::GraphConfig getGraphConfig() const override
Definition: SaltModelTriton.cxx:194
FlavorTagInference::SaltModelTriton::loadMetadata
const nlohmann::json loadMetadata(const std::string &key, const Ort::Session *session) const
Definition: SaltModelTriton.cxx:159
FlavorTagInference::SaltModelTriton::m_useSSL
bool m_useSSL
Definition: SaltModelTriton.h:63
ISaltModel.h
FlavorTagInference::SaltModelTriton::m_url
std::string m_url
Definition: SaltModelTriton.h:62
FlavorTagInference::SaltModelTriton::m_metadata
nlohmann::json m_metadata
Definition: SaltModelTriton.h:50
FlavorTagInference::SaltModelVersion::UNKNOWN
@ UNKNOWN
FlavorTagInference::SaltModelTriton::runInference
virtual InferenceOutput runInference(std::map< std::string, Inputs > &gnn_inputs) const override
Definition: SaltModelTriton.cxx:211
columnar::final
CM final
Definition: ColumnAccessor.h:106
FlavorTagInference::SaltModelTriton::m_model_name
std::string m_model_name
Definition: SaltModelTriton.h:53
FlavorTagInference::InferenceOutput
Definition: ISaltModel.h:38
FlavorTagInference::OutputConfig
std::vector< SaltModelOutput > OutputConfig
Definition: ISaltModel.h:36
FlavorTagInference::SaltModelVersion
SaltModelVersion
Definition: ISaltModel.h:25
FlavorTagInference::SaltModelTriton::m_model_type
std::string m_model_type
Definition: SaltModelTriton.h:54
FlavorTagInference::SaltModelTriton::m_options
std::unique_ptr< tc::InferOptions > m_options
Definition: SaltModelTriton.h:59
FlavorTagInference::SaltModelTriton::getClient
tc::InferenceServerGrpcClient * getClient() const
Definition: SaltModelTriton.cxx:297
FlavorTagInference::SaltModelTriton::SaltModelTriton
SaltModelTriton(const std::string &path_to_onnx, const std::string &model_name, float client_timeout, int port, const std::string &url, bool useSSL)
Definition: SaltModelTriton.cxx:79
FlavorTagInference::SaltModelGraphConfig::GraphConfig
Definition: SaltModelGraphConfig.h:36
FlavorTagInference::SaltModelTriton::m_port
int m_port
Definition: SaltModelTriton.h:61
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37