Skip to content

Commit f105002

Browse files
christisgtensorflow-copybara
authored andcommitted
Add disable_host_compilation option to allow disabling host compilation after load.
PiperOrigin-RevId: 764103003
1 parent 5083127 commit f105002

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tensorflow_serving/servables/tensorflow/run_options_base.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ struct RunOptionsBase {
3636
// Requests with higher priority always get prioritized for latency over
3737
// requests with lower priority. 0 is the lowest latency priority.
3838
int32_t latency_priority = 0;
39+
40+
// If true, just-in-time host compilation is disabled, and then if the
41+
// specified graph is not compiled, request execution will return an error.
42+
// Supported only in TFRT servable. Ignored in non-TFRT servable.
43+
bool disable_host_compilation = false;
3944
};
4045

4146
} // namespace servables

tensorflow_serving/servables/tensorflow/tfrt_servable.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ TfrtSavedModelServable::GetTFRTSavedModelRunOptions(
9898
}
9999
options.validate_input_specs = config_.validate_input_specs();
100100
options.validate_input_specs_dry_run = config_.validate_input_specs_dry_run();
101+
if (run_options.disable_host_compilation) {
102+
options.disable_compilation = true;
103+
}
101104
return options;
102105
}
103106

0 commit comments

Comments
 (0)