Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions onnxruntime/contrib_ops/cpu/transformers/beam_search_impl_t5.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,13 @@ Status BeamSearchT5<T>::Execute(const FeedsFetchesManager& encoder_feeds_fetches
dumper->Print("decoder_feeds", i, true);
dumper->Print("", decoder_feeds[i]);
}
auto offset = decoder_subgraph_.GetFirstPastInputIndex() + 4 * decoder_subgraph_.num_layers;
dumper->Print("past_sequence_length", offset, true);
dumper->Print("", decoder_feeds[offset]);
dumper->Print("beam_width", offset + 1, true);
dumper->Print("", decoder_feeds[offset + 1]);
dumper->Print("cache_redir", offset + 2, true);
dumper->Print("", decoder_feeds[offset + 2]);
// auto offset = decoder_subgraph_.GetFirstPastInputIndex() + 4 * decoder_subgraph_.num_layers;
// dumper->Print("past_sequence_length", offset, true);
// dumper->Print("", decoder_feeds[offset]);
// dumper->Print("beam_width", offset + 1, true);
// dumper->Print("", decoder_feeds[offset + 1]);
// dumper->Print("past_sequence_length", offset + 2, true);
// dumper->Print("", decoder_feeds[offset + 2]);
#endif

#ifdef DEBUG_NODE_INPUTS_OUTPUTS
Expand Down
5 changes: 3 additions & 2 deletions onnxruntime/core/providers/openvino/ov_versions/capability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ GetCapability::GetCapability(const GraphViewer& graph_viewer_param, std::string
std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
std::vector<std::unique_ptr<ComputeCapability>> result;

if (graph_viewer_.Name() == "decoder subgraph" || graph_viewer_.Name() == "beam-search-test")
return result;
// Check if it is a subgraph
if (graph_viewer_.IsSubgraph() && graph_viewer_.Name() == "tf2onnx") {
if (graph_viewer_.IsSubgraph() && graph_viewer_.Name() == "tf2onnx")
return result;
}

// This is a list of initializers that nGraph considers as constants. Example weights, reshape shape etc.
std::unordered_set<std::string> ng_required_initializers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ std::vector<SupportedOp> supported_op_mode = {
{"InstanceNormalization", V_2023_0, {"VPUX"}},
{"HardSigmoid", V_2020_4, {"CPU", "GPU"}},
{"HardMax", V_2022_1, {"CPU", "GPU"}},
{"LayerNormalization", V_2023_0, {"CPU", "GPU"}},
{"LayerNormalization", V_2023_0, {"CPU", "GPU", "VPUX"}},
{"LeakyRelu", V_2020_4, {"CPU", "GPU"}},
{"LeakyRelu", V_2023_0, {"VPUX"}},
{"Less", V_2020_4, {"CPU", "GPU"}},
Expand Down
25 changes: 25 additions & 0 deletions onnxruntime/core/session/inference_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,31 @@ common::Status InferenceSession::Initialize() {

// Verify that there are no external initializers in the graph if external data is disabled.
onnxruntime::Graph& graph = model_->MainGraph();

#ifdef USE_OPENVINO
/// Move initializers from the MainGraph to subgraphs
std::unordered_set<std::string> initializer_names_to_preserve;
for (auto& node: graph.Nodes()) {

// Preserve implicitInputDefs in the subgraphs
for (auto& def : node.ImplicitInputDefs())
initializer_names_to_preserve.insert(def->Name());

for(auto& entry: node.GetAttributeNameToMutableSubgraphMap()) {
Graph *subgraph = entry.second;

for(const auto& parent_graph_initializer: graph.GetAllInitializedTensors()) {
if (initializer_names_to_preserve.find(parent_graph_initializer.first) != initializer_names_to_preserve.cend())
subgraph->AddInitializedTensor(*parent_graph_initializer.second);
}
}
}

// Now remove those initializers from the MainGraph
for(auto& name: initializer_names_to_preserve)
graph.RemoveInitializedTensor(name);
#endif

#ifdef DISABLE_EXTERNAL_INITIALIZERS
const InitializedTensorSet& initializers = graph.GetAllInitializedTensors();
for (const auto& it : initializers) {
Expand Down