From 61c1dd624f23b46ee272f2823951bb13537e6b8d Mon Sep 17 00:00:00 2001 From: dogemanttv <80775876+dogemanttv@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:07:37 -0600 Subject: [PATCH] Delete navi directory --- navi/README.md | 41 - navi/dr_transform/Cargo.toml | 32 - navi/dr_transform/src/all_config.rs | 49 - navi/dr_transform/src/converter.rs | 616 --------- navi/dr_transform/src/lib.rs | 6 - navi/dr_transform/src/util.rs | 32 - navi/navi/Cargo.toml | 81 -- navi/navi/build.rs | 13 - .../proto/kfserving/grpc_predict_v2.proto | 326 ----- .../tensorflow/core/example/example.proto | 306 ----- .../tensorflow/core/example/feature.proto | 110 -- .../framework/allocation_description.proto | 29 - .../tensorflow/core/framework/api_def.proto | 138 -- .../core/framework/attr_value.proto | 64 - .../core/framework/cost_graph.proto | 89 -- .../core/framework/dataset_metadata.proto | 10 - .../core/framework/dataset_options.proto | 196 --- .../core/framework/device_attributes.proto | 58 - .../tensorflow/core/framework/full_type.proto | 276 ---- .../tensorflow/core/framework/function.proto | 136 -- .../tensorflow/core/framework/graph.proto | 56 - .../core/framework/graph_transfer_info.proto | 71 - .../core/framework/kernel_def.proto | 48 - .../core/framework/log_memory.proto | 95 -- .../tensorflow/core/framework/model.proto | 134 -- .../tensorflow/core/framework/node_def.proto | 95 -- .../tensorflow/core/framework/op_def.proto | 193 --- .../core/framework/reader_base.proto | 18 - .../core/framework/resource_handle.proto | 45 - .../core/framework/step_stats.proto | 88 -- .../tensorflow/core/framework/summary.proto | 149 -- .../tensorflow/core/framework/tensor.proto | 96 -- .../core/framework/tensor_description.proto | 24 - .../core/framework/tensor_shape.proto | 46 - .../core/framework/tensor_slice.proto | 39 - .../tensorflow/core/framework/types.proto | 77 -- .../tensorflow/core/framework/variable.proto | 84 -- .../tensorflow/core/framework/versions.proto | 33 - .../tensorflow/core/protobuf/autotuning.proto | 106 -- .../core/protobuf/bfc_memory_map.proto | 47 - .../tensorflow/core/protobuf/cluster.proto | 84 -- .../protobuf/composite_tensor_variant.proto | 16 - .../tensorflow/core/protobuf/config.proto | 902 ------------ .../core/protobuf/control_flow.proto | 91 -- .../core/protobuf/conv_autotuning.proto | 33 - .../core/protobuf/coordination_config.proto | 32 - .../core/protobuf/coordination_service.proto | 256 ---- .../core/protobuf/critical_section.proto | 24 - .../core/protobuf/data_service.proto | 88 -- .../tensorflow/core/protobuf/debug.proto | 94 -- .../core/protobuf/debug_event.proto | 300 ---- .../core/protobuf/device_filters.proto | 73 - .../core/protobuf/device_properties.proto | 58 - .../distributed_runtime_payloads.proto | 24 - .../core/protobuf/eager_service.proto | 344 ----- .../core/protobuf/error_codes.proto | 152 --- .../core/protobuf/graph_debug_info.proto | 52 - .../tensorflow/core/protobuf/master.proto | 353 ----- .../core/protobuf/master_service.proto | 121 -- .../tensorflow/core/protobuf/meta_graph.proto | 342 ----- .../core/protobuf/named_tensor.proto | 25 - .../core/protobuf/queue_runner.proto | 30 - .../core/protobuf/remote_tensor_handle.proto | 34 - .../tensorflow/core/protobuf/replay_log.proto | 47 - .../core/protobuf/rewriter_config.proto | 223 --- .../core/protobuf/saved_model.proto | 23 - .../core/protobuf/saved_object_graph.proto | 251 ---- .../tensorflow/core/protobuf/saver.proto | 48 - .../core/protobuf/service_config.proto | 82 -- .../tensorflow/core/protobuf/snapshot.proto | 47 - .../tensorflow/core/protobuf/status.proto | 10 - .../tensorflow/core/protobuf/struct.proto | 160 --- .../core/protobuf/tensor_bundle.proto | 66 - .../core/protobuf/tensorflow_server.proto | 61 - .../protobuf/trackable_object_graph.proto | 80 -- .../core/protobuf/transport_options.proto | 10 - .../core/protobuf/verifier_config.proto | 27 - .../tensorflow/core/protobuf/worker.proto | 611 --------- .../core/protobuf/worker_service.proto | 90 -- .../apis/classification.proto | 48 - .../apis/get_model_metadata.proto | 30 - .../apis/get_model_status.proto | 68 - .../tensorflow_serving/apis/inference.proto | 59 - .../proto/tensorflow_serving/apis/input.proto | 82 -- .../tensorflow_serving/apis/logging.proto | 17 - .../proto/tensorflow_serving/apis/model.proto | 33 - .../apis/model_management.proto | 16 - .../apis/model_service.proto | 24 - .../tensorflow_serving/apis/predict.proto | 40 - .../apis/prediction_log.proto | 49 - .../apis/prediction_service.proto | 31 - .../tensorflow_serving/apis/regression.proto | 37 - .../apis/session_service.proto | 56 - .../tensorflow_serving/apis/status.proto | 17 - .../file_system_storage_path_source.proto | 88 -- .../config/log_collector_config.proto | 12 - .../config/logging_config.proto | 18 - .../config/model_server_config.proto | 85 -- navi/navi/scripts/run_onnx.sh | 9 - navi/navi/scripts/run_tf2.sh | 6 - navi/navi/src/batch.rs | 203 --- navi/navi/src/bin/navi.rs | 47 - navi/navi/src/bin/navi_onnx.rs | 24 - navi/navi/src/bin/navi_torch.rs | 19 - navi/navi/src/bootstrap.rs | 326 ----- navi/navi/src/cli_args.rs | 236 ---- navi/navi/src/cores/validator.rs | 22 - navi/navi/src/lib.rs | 215 --- navi/navi/src/metrics.rs | 297 ---- navi/navi/src/onnx_model.rs | 275 ---- navi/navi/src/predict_service.rs | 315 ----- navi/navi/src/tf_model.rs | 492 ------- navi/navi/src/torch_model.rs | 183 --- navi/segdense/Cargo.toml | 11 - navi/segdense/src/error.rs | 53 - navi/segdense/src/lib.rs | 4 - navi/segdense/src/main.rs | 22 - navi/segdense/src/mapper.rs | 45 - ...segdense_transform_spec_home_recap_2022.rs | 182 --- navi/segdense/src/util.rs | 154 --- navi/thrift_bpr_adapter/thrift/Cargo.toml | 8 - navi/thrift_bpr_adapter/thrift/src/data.rs | 1213 ----------------- navi/thrift_bpr_adapter/thrift/src/decoder.rs | 78 -- navi/thrift_bpr_adapter/thrift/src/lib.rs | 4 - navi/thrift_bpr_adapter/thrift/src/main.rs | 81 -- .../thrift/src/prediction_service.rs | 1067 --------------- navi/thrift_bpr_adapter/thrift/src/tensor.rs | 1146 ---------------- 127 files changed, 17063 deletions(-) delete mode 100644 navi/README.md delete mode 100644 navi/dr_transform/Cargo.toml delete mode 100644 navi/dr_transform/src/all_config.rs delete mode 100644 navi/dr_transform/src/converter.rs delete mode 100644 navi/dr_transform/src/lib.rs delete mode 100644 navi/dr_transform/src/util.rs delete mode 100644 navi/navi/Cargo.toml delete mode 100644 navi/navi/build.rs delete mode 100644 navi/navi/proto/kfserving/grpc_predict_v2.proto delete mode 100644 navi/navi/proto/tensorflow/core/example/example.proto delete mode 100644 navi/navi/proto/tensorflow/core/example/feature.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/allocation_description.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/api_def.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/attr_value.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/cost_graph.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/dataset_metadata.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/dataset_options.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/device_attributes.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/full_type.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/function.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/graph.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/graph_transfer_info.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/kernel_def.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/log_memory.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/model.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/node_def.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/op_def.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/reader_base.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/resource_handle.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/step_stats.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/summary.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/tensor.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/tensor_description.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/tensor_shape.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/tensor_slice.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/types.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/variable.proto delete mode 100644 navi/navi/proto/tensorflow/core/framework/versions.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/autotuning.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/bfc_memory_map.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/cluster.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/composite_tensor_variant.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/config.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/control_flow.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/conv_autotuning.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/coordination_config.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/coordination_service.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/critical_section.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/data_service.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/debug.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/debug_event.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/device_filters.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/device_properties.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/distributed_runtime_payloads.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/eager_service.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/error_codes.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/graph_debug_info.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/master.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/master_service.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/meta_graph.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/named_tensor.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/queue_runner.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/remote_tensor_handle.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/replay_log.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/rewriter_config.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/saved_model.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/saved_object_graph.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/saver.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/service_config.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/snapshot.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/status.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/struct.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/tensor_bundle.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/tensorflow_server.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/trackable_object_graph.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/transport_options.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/verifier_config.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/worker.proto delete mode 100644 navi/navi/proto/tensorflow/core/protobuf/worker_service.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/classification.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/get_model_metadata.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/get_model_status.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/inference.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/input.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/logging.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/model.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/model_management.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/model_service.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/predict.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/prediction_log.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/prediction_service.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/regression.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/session_service.proto delete mode 100644 navi/navi/proto/tensorflow_serving/apis/status.proto delete mode 100644 navi/navi/proto/tensorflow_serving/config/file_system_storage_path_source.proto delete mode 100644 navi/navi/proto/tensorflow_serving/config/log_collector_config.proto delete mode 100644 navi/navi/proto/tensorflow_serving/config/logging_config.proto delete mode 100644 navi/navi/proto/tensorflow_serving/config/model_server_config.proto delete mode 100644 navi/navi/scripts/run_onnx.sh delete mode 100644 navi/navi/scripts/run_tf2.sh delete mode 100644 navi/navi/src/batch.rs delete mode 100644 navi/navi/src/bin/navi.rs delete mode 100644 navi/navi/src/bin/navi_onnx.rs delete mode 100644 navi/navi/src/bin/navi_torch.rs delete mode 100644 navi/navi/src/bootstrap.rs delete mode 100644 navi/navi/src/cli_args.rs delete mode 100644 navi/navi/src/cores/validator.rs delete mode 100644 navi/navi/src/lib.rs delete mode 100644 navi/navi/src/metrics.rs delete mode 100644 navi/navi/src/onnx_model.rs delete mode 100644 navi/navi/src/predict_service.rs delete mode 100644 navi/navi/src/tf_model.rs delete mode 100644 navi/navi/src/torch_model.rs delete mode 100644 navi/segdense/Cargo.toml delete mode 100644 navi/segdense/src/error.rs delete mode 100644 navi/segdense/src/lib.rs delete mode 100644 navi/segdense/src/main.rs delete mode 100644 navi/segdense/src/mapper.rs delete mode 100644 navi/segdense/src/segdense_transform_spec_home_recap_2022.rs delete mode 100644 navi/segdense/src/util.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/Cargo.toml delete mode 100644 navi/thrift_bpr_adapter/thrift/src/data.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/src/decoder.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/src/lib.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/src/main.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/src/prediction_service.rs delete mode 100644 navi/thrift_bpr_adapter/thrift/src/tensor.rs diff --git a/navi/README.md b/navi/README.md deleted file mode 100644 index 4e7d325f7..000000000 --- a/navi/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Navi: High-Performance Machine Learning Serving Server in Rust - -Navi is a high-performance, versatile machine learning serving server implemented in Rust and tailored for production usage. It's designed to efficiently serve within the Twitter tech stack, offering top-notch performance while focusing on core features. - -## Key Features - -- **Minimalist Design Optimized for Production Use Cases**: Navi delivers ultra-high performance, stability, and availability, engineered to handle real-world application demands with a streamlined codebase. -- **gRPC API Compatibility with TensorFlow Serving**: Seamless integration with existing TensorFlow Serving clients via its gRPC API, enabling easy integration, smooth deployment, and scaling in production environments. -- **Plugin Architecture for Different Runtimes**: Navi's pluggable architecture supports various machine learning runtimes, providing adaptability and extensibility for diverse use cases. Out-of-the-box support is available for TensorFlow and Onnx Runtime, with PyTorch in an experimental state. - -## Current State - -While Navi's features may not be as comprehensive as its open-source counterparts, its performance-first mindset makes it highly efficient. -- Navi for TensorFlow is currently the most feature-complete, supporting multiple input tensors of different types (float, int, string, etc.). -- Navi for Onnx primarily supports one input tensor of type string, used in Twitter's home recommendation with a proprietary BatchPredictRequest format. -- Navi for Pytorch is compilable and runnable but not yet production-ready in terms of performance and stability. - -## Directory Structure - -- `navi`: The main code repository for Navi -- `dr_transform`: Twitter-specific converter that converts BatchPredictionRequest Thrift to ndarray -- `segdense`: Twitter-specific config to specify how to retrieve feature values from BatchPredictionRequest -- `thrift_bpr_adapter`: generated thrift code for BatchPredictionRequest - -## Content -We have included all *.rs source code files that make up the main Navi binaries for you to examine. However, we have not included the test and benchmark code, or various configuration files, due to data security concerns. - -## Run -In navi/navi, you can run the following commands: -- `scripts/run_tf2.sh` for [TensorFlow](https://www.tensorflow.org/) -- `scripts/run_onnx.sh` for [Onnx](https://onnx.ai/) - -Do note that you need to create a models directory and create some versions, preferably using epoch time, e.g., `1679693908377`. -so the models structure looks like: - models/ - -web_click - - 1809000 - - 1809010 - -## Build -You can adapt the above scripts to build using Cargo. diff --git a/navi/dr_transform/Cargo.toml b/navi/dr_transform/Cargo.toml deleted file mode 100644 index cff73375b..000000000 --- a/navi/dr_transform/Cargo.toml +++ /dev/null @@ -1,32 +0,0 @@ -[package] -name = "dr_transform" -version = "0.1.0" -edition = "2021" - -[dependencies] -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -json = "0.12.4" -bpr_thrift = { path = "../thrift_bpr_adapter/thrift/"} -segdense = { path = "../segdense/"} -thrift = "0.17.0" -ndarray = "0.15" -base64 = "0.20.0" -npyz = "0.7.2" -log = "0.4.17" -env_logger = "0.9.0" -prometheus = "0.13.1" -once_cell = "1.17.0" -rand = "0.8.5" -itertools = "0.10.5" -anyhow = "1.0.70" -[target.'cfg(not(target_os="linux"))'.dependencies] -ort = {git ="https://github.com/pykeio/ort.git", features=["profiling"], tag="v1.14.6"} -[target.'cfg(target_os="linux")'.dependencies] -ort = {git ="https://github.com/pykeio/ort.git", features=["profiling", "tensorrt", "cuda", "copy-dylibs"], tag="v1.14.6"} -[dev-dependencies] -criterion = "0.3.0" - -[[bench]] -name = "bpr_benchmark" -harness = false diff --git a/navi/dr_transform/src/all_config.rs b/navi/dr_transform/src/all_config.rs deleted file mode 100644 index d5c52c362..000000000 --- a/navi/dr_transform/src/all_config.rs +++ /dev/null @@ -1,49 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use serde_json::Error; - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct AllConfig { - #[serde(rename = "train_data")] - pub train_data: TrainData, -} - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct TrainData { - #[serde(rename = "seg_dense_schema")] - pub seg_dense_schema: SegDenseSchema, -} - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SegDenseSchema { - #[serde(rename = "renamed_features")] - pub renamed_features: RenamedFeatures, -} - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct RenamedFeatures { - pub continuous: String, - pub binary: String, - pub discrete: String, - #[serde(rename = "author_embedding")] - pub author_embedding: String, - #[serde(rename = "user_embedding")] - pub user_embedding: String, - #[serde(rename = "user_eng_embedding")] - pub user_eng_embedding: String, - #[serde(rename = "meta__author_id")] - pub meta_author_id: String, - #[serde(rename = "meta__user_id")] - pub meta_user_id: String, - #[serde(rename = "meta__tweet_id")] - pub meta_tweet_id: String, -} - -pub fn parse(json_str: &str) -> Result { - let all_config: AllConfig = serde_json::from_str(json_str)?; - Ok(all_config) -} diff --git a/navi/dr_transform/src/converter.rs b/navi/dr_transform/src/converter.rs deleted file mode 100644 index 3097aedc0..000000000 --- a/navi/dr_transform/src/converter.rs +++ /dev/null @@ -1,616 +0,0 @@ -use std::collections::BTreeSet; -use std::fmt::{self, Debug, Display}; -use std::fs; - -use crate::all_config; -use crate::all_config::AllConfig; -use anyhow::{bail, Context}; -use bpr_thrift::data::DataRecord; -use bpr_thrift::prediction_service::BatchPredictionRequest; -use bpr_thrift::tensor::GeneralTensor; -use log::debug; -use ndarray::Array2; -use once_cell::sync::OnceCell; -use ort::tensor::InputTensor; -use prometheus::{HistogramOpts, HistogramVec}; -use segdense::mapper::{FeatureMapper, MapReader}; -use segdense::segdense_transform_spec_home_recap_2022::{DensificationTransformSpec, Root}; -use segdense::util; -use thrift::protocol::{TBinaryInputProtocol, TSerializable}; -use thrift::transport::TBufferChannel; - -pub fn log_feature_match( - dr: &DataRecord, - seg_dense_config: &DensificationTransformSpec, - dr_type: String, -) { - // Note the following algorithm matches features from config using linear search. - // Also the record source is MinDataRecord. This includes only binary and continous features for now. - - for (feature_id, feature_value) in dr.continuous_features.as_ref().unwrap() { - debug!( - "{} - Continous Datarecord => Feature ID: {}, Feature value: {}", - dr_type, feature_id, feature_value - ); - for input_feature in &seg_dense_config.cont.input_features { - if input_feature.feature_id == *feature_id { - debug!("Matching input feature: {:?}", input_feature) - } - } - } - - for feature_id in dr.binary_features.as_ref().unwrap() { - debug!( - "{} - Binary Datarecord => Feature ID: {}", - dr_type, feature_id - ); - for input_feature in &seg_dense_config.binary.input_features { - if input_feature.feature_id == *feature_id { - debug!("Found input feature: {:?}", input_feature) - } - } - } -} - -pub fn log_feature_matches(drs: &Vec, seg_dense_config: &DensificationTransformSpec) { - for dr in drs { - log_feature_match(dr, seg_dense_config, String::from("individual")); - } -} - -pub trait Converter: Send + Sync + Debug + 'static + Display { - fn convert(&self, input: Vec>) -> (Vec, Vec); -} - -#[derive(Debug)] -#[allow(dead_code)] -pub struct BatchPredictionRequestToTorchTensorConverter { - all_config: AllConfig, - seg_dense_config: Root, - all_config_path: String, - seg_dense_config_path: String, - feature_mapper: FeatureMapper, - user_embedding_feature_id: i64, - user_eng_embedding_feature_id: i64, - author_embedding_feature_id: i64, - discrete_features_to_report: BTreeSet, - continuous_features_to_report: BTreeSet, - discrete_feature_metrics: &'static HistogramVec, - continuous_feature_metrics: &'static HistogramVec, -} - -impl Display for BatchPredictionRequestToTorchTensorConverter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "all_config_path: {}, seg_dense_config_path:{}", - self.all_config_path, self.seg_dense_config_path - ) - } -} - -impl BatchPredictionRequestToTorchTensorConverter { - pub fn new( - model_dir: &str, - model_version: &str, - reporting_feature_ids: Vec<(i64, &str)>, - register_metric_fn: Option, - ) -> anyhow::Result { - let all_config_path = format!("{}/{}/all_config.json", model_dir, model_version); - let seg_dense_config_path = format!( - "{}/{}/segdense_transform_spec_home_recap_2022.json", - model_dir, model_version - ); - let seg_dense_config = util::load_config(&seg_dense_config_path)?; - let all_config = all_config::parse( - &fs::read_to_string(&all_config_path) - .with_context(|| "error loading all_config.json - ")?, - )?; - - let feature_mapper = util::load_from_parsed_config(seg_dense_config.clone())?; - - let user_embedding_feature_id = Self::get_feature_id( - &all_config - .train_data - .seg_dense_schema - .renamed_features - .user_embedding, - &seg_dense_config, - ); - let user_eng_embedding_feature_id = Self::get_feature_id( - &all_config - .train_data - .seg_dense_schema - .renamed_features - .user_eng_embedding, - &seg_dense_config, - ); - let author_embedding_feature_id = Self::get_feature_id( - &all_config - .train_data - .seg_dense_schema - .renamed_features - .author_embedding, - &seg_dense_config, - ); - static METRICS: OnceCell<(HistogramVec, HistogramVec)> = OnceCell::new(); - let (discrete_feature_metrics, continuous_feature_metrics) = METRICS.get_or_init(|| { - let discrete = HistogramVec::new( - HistogramOpts::new(":navi:feature_id:discrete", "Discrete Feature ID values") - .buckets(Vec::from(&[ - 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, - 120.0, 130.0, 140.0, 150.0, 160.0, 170.0, 180.0, 190.0, 200.0, 250.0, - 300.0, 500.0, 1000.0, 10000.0, 100000.0, - ] as &'static [f64])), - &["feature_id"], - ) - .expect("metric cannot be created"); - let continuous = HistogramVec::new( - HistogramOpts::new( - ":navi:feature_id:continuous", - "continuous Feature ID values", - ) - .buckets(Vec::from(&[ - 0.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 110.0, 120.0, - 130.0, 140.0, 150.0, 160.0, 170.0, 180.0, 190.0, 200.0, 250.0, 300.0, 500.0, - 1000.0, 10000.0, 100000.0, - ] as &'static [f64])), - &["feature_id"], - ) - .expect("metric cannot be created"); - register_metric_fn.map(|r| { - r(&discrete); - r(&continuous); - }); - (discrete, continuous) - }); - - let mut discrete_features_to_report = BTreeSet::new(); - let mut continuous_features_to_report = BTreeSet::new(); - - for (feature_id, feature_type) in reporting_feature_ids.iter() { - match *feature_type { - "discrete" => discrete_features_to_report.insert(feature_id.clone()), - "continuous" => continuous_features_to_report.insert(feature_id.clone()), - _ => bail!( - "Invalid feature type {} for reporting metrics!", - feature_type - ), - }; - } - - Ok(BatchPredictionRequestToTorchTensorConverter { - all_config, - seg_dense_config, - all_config_path, - seg_dense_config_path, - feature_mapper, - user_embedding_feature_id, - user_eng_embedding_feature_id, - author_embedding_feature_id, - discrete_features_to_report, - continuous_features_to_report, - discrete_feature_metrics, - continuous_feature_metrics, - }) - } - - fn get_feature_id(feature_name: &str, seg_dense_config: &Root) -> i64 { - // given a feature name, we get the complex feature type id - for feature in &seg_dense_config.complex_feature_type_transform_spec { - if feature.full_feature_name == feature_name { - return feature.feature_id; - } - } - -1 - } - - fn parse_batch_prediction_request(bytes: Vec) -> BatchPredictionRequest { - // parse batch prediction request into a struct from byte array repr. - let mut bc = TBufferChannel::with_capacity(bytes.len(), 0); - bc.set_readable_bytes(&bytes); - let mut protocol = TBinaryInputProtocol::new(bc, true); - BatchPredictionRequest::read_from_in_protocol(&mut protocol).unwrap() - } - - fn get_embedding_tensors( - &self, - bprs: &[BatchPredictionRequest], - feature_id: i64, - batch_size: &[usize], - ) -> Array2 { - // given an embedding feature id, extract the float tensor array into tensors. - let cols: usize = 200; - let rows: usize = batch_size[batch_size.len() - 1]; - let total_size = rows * cols; - - let mut working_set = vec![0 as f32; total_size]; - let mut bpr_start = 0; - for (bpr, &bpr_end) in bprs.iter().zip(batch_size) { - if bpr.common_features.is_some() { - if bpr.common_features.as_ref().unwrap().tensors.is_some() { - if bpr - .common_features - .as_ref() - .unwrap() - .tensors - .as_ref() - .unwrap() - .contains_key(&feature_id) - { - let source_tensor = bpr - .common_features - .as_ref() - .unwrap() - .tensors - .as_ref() - .unwrap() - .get(&feature_id) - .unwrap(); - let tensor = match source_tensor { - GeneralTensor::FloatTensor(float_tensor) => - //Tensor::of_slice( - { - float_tensor - .floats - .iter() - .map(|x| x.into_inner() as f32) - .collect::>() - } - _ => vec![0 as f32; cols], - }; - - // since the tensor is found in common feature, add it in all batches - for row in bpr_start..bpr_end { - for col in 0..cols { - working_set[row * cols + col] = tensor[col]; - } - } - } - } - } - // find the feature in individual feature list and add to corresponding batch. - for (index, datarecord) in bpr.individual_features_list.iter().enumerate() { - if datarecord.tensors.is_some() - && datarecord - .tensors - .as_ref() - .unwrap() - .contains_key(&feature_id) - { - let source_tensor = datarecord - .tensors - .as_ref() - .unwrap() - .get(&feature_id) - .unwrap(); - let tensor = match source_tensor { - GeneralTensor::FloatTensor(float_tensor) => float_tensor - .floats - .iter() - .map(|x| x.into_inner() as f32) - .collect::>(), - _ => vec![0 as f32; cols], - }; - for col in 0..cols { - working_set[(bpr_start + index) * cols + col] = tensor[col]; - } - } - } - bpr_start = bpr_end; - } - Array2::::from_shape_vec([rows, cols], working_set).unwrap() - } - - // Todo : Refactor, create a generic version with different type and field accessors - // Example paramterize and then instiantiate the following - // (FLOAT --> FLOAT, DataRecord.continuous_feature) - // (BOOL --> INT64, DataRecord.binary_feature) - // (INT64 --> INT64, DataRecord.discrete_feature) - fn get_continuous(&self, bprs: &[BatchPredictionRequest], batch_ends: &[usize]) -> InputTensor { - // These need to be part of model schema - let rows: usize = batch_ends[batch_ends.len() - 1]; - let cols: usize = 5293; - let full_size: usize = rows * cols; - let default_val = f32::NAN; - - let mut tensor = vec![default_val; full_size]; - - let mut bpr_start = 0; - for (bpr, &bpr_end) in bprs.iter().zip(batch_ends) { - // Common features - if bpr.common_features.is_some() - && bpr - .common_features - .as_ref() - .unwrap() - .continuous_features - .is_some() - { - let common_features = bpr - .common_features - .as_ref() - .unwrap() - .continuous_features - .as_ref() - .unwrap(); - - for feature in common_features { - match self.feature_mapper.get(feature.0) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - if idx < cols { - // Set value in each row - for r in bpr_start..bpr_end { - let flat_index: usize = r * cols + idx; - tensor[flat_index] = feature.1.into_inner() as f32; - } - } - } - None => (), - } - if self.continuous_features_to_report.contains(feature.0) { - self.continuous_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(feature.1.into_inner()) - } else if self.discrete_features_to_report.contains(feature.0) { - self.discrete_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(feature.1.into_inner()) - } - } - } - - // Process the batch of datarecords - for r in bpr_start..bpr_end { - let dr: &DataRecord = - &bpr.individual_features_list[usize::try_from(r - bpr_start).unwrap()]; - if dr.continuous_features.is_some() { - for feature in dr.continuous_features.as_ref().unwrap() { - match self.feature_mapper.get(&feature.0) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - let flat_index: usize = r * cols + idx; - if flat_index < tensor.len() && idx < cols { - tensor[flat_index] = feature.1.into_inner() as f32; - } - } - None => (), - } - if self.continuous_features_to_report.contains(feature.0) { - self.continuous_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(feature.1.into_inner() as f64) - } else if self.discrete_features_to_report.contains(feature.0) { - self.discrete_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(feature.1.into_inner() as f64) - } - } - } - } - bpr_start = bpr_end; - } - - InputTensor::FloatTensor( - Array2::::from_shape_vec([rows, cols], tensor) - .unwrap() - .into_dyn(), - ) - } - - fn get_binary(&self, bprs: &[BatchPredictionRequest], batch_ends: &[usize]) -> InputTensor { - // These need to be part of model schema - let rows: usize = batch_ends[batch_ends.len() - 1]; - let cols: usize = 149; - let full_size: usize = rows * cols; - let default_val: i64 = 0; - - let mut v = vec![default_val; full_size]; - - let mut bpr_start = 0; - for (bpr, &bpr_end) in bprs.iter().zip(batch_ends) { - // Common features - if bpr.common_features.is_some() - && bpr - .common_features - .as_ref() - .unwrap() - .binary_features - .is_some() - { - let common_features = bpr - .common_features - .as_ref() - .unwrap() - .binary_features - .as_ref() - .unwrap(); - - for feature in common_features { - match self.feature_mapper.get(feature) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - if idx < cols { - // Set value in each row - for r in bpr_start..bpr_end { - let flat_index: usize = r * cols + idx; - v[flat_index] = 1; - } - } - } - None => (), - } - } - } - - // Process the batch of datarecords - for r in bpr_start..bpr_end { - let dr: &DataRecord = &bpr.individual_features_list[r - bpr_start]; - if dr.binary_features.is_some() { - for feature in dr.binary_features.as_ref().unwrap() { - match self.feature_mapper.get(&feature) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - let flat_index: usize = r * cols + idx; - v[flat_index] = 1; - } - None => (), - } - } - } - } - bpr_start = bpr_end; - } - InputTensor::Int64Tensor( - Array2::::from_shape_vec([rows, cols], v) - .unwrap() - .into_dyn(), - ) - } - - #[allow(dead_code)] - fn get_discrete(&self, bprs: &[BatchPredictionRequest], batch_ends: &[usize]) -> InputTensor { - // These need to be part of model schema - let rows: usize = batch_ends[batch_ends.len() - 1]; - let cols: usize = 320; - let full_size: usize = rows * cols; - let default_val: i64 = 0; - - let mut v = vec![default_val; full_size]; - - let mut bpr_start = 0; - for (bpr, &bpr_end) in bprs.iter().zip(batch_ends) { - // Common features - if bpr.common_features.is_some() - && bpr - .common_features - .as_ref() - .unwrap() - .discrete_features - .is_some() - { - let common_features = bpr - .common_features - .as_ref() - .unwrap() - .discrete_features - .as_ref() - .unwrap(); - - for feature in common_features { - match self.feature_mapper.get(feature.0) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - if idx < cols { - // Set value in each row - for r in bpr_start..bpr_end { - let flat_index: usize = r * cols + idx; - v[flat_index] = *feature.1; - } - } - } - None => (), - } - if self.discrete_features_to_report.contains(feature.0) { - self.discrete_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(*feature.1 as f64) - } - } - } - - // Process the batch of datarecords - for r in bpr_start..bpr_end { - let dr: &DataRecord = &bpr.individual_features_list[usize::try_from(r).unwrap()]; - if dr.discrete_features.is_some() { - for feature in dr.discrete_features.as_ref().unwrap() { - match self.feature_mapper.get(&feature.0) { - Some(f_info) => { - let idx = f_info.index_within_tensor as usize; - let flat_index: usize = r * cols + idx; - if flat_index < v.len() && idx < cols { - v[flat_index] = *feature.1; - } - } - None => (), - } - if self.discrete_features_to_report.contains(feature.0) { - self.discrete_feature_metrics - .with_label_values(&[feature.0.to_string().as_str()]) - .observe(*feature.1 as f64) - } - } - } - } - bpr_start = bpr_end; - } - InputTensor::Int64Tensor( - Array2::::from_shape_vec([rows, cols], v) - .unwrap() - .into_dyn(), - ) - } - - fn get_user_embedding( - &self, - bprs: &[BatchPredictionRequest], - batch_ends: &[usize], - ) -> InputTensor { - InputTensor::FloatTensor( - self.get_embedding_tensors(bprs, self.user_embedding_feature_id, batch_ends) - .into_dyn(), - ) - } - - fn get_eng_embedding( - &self, - bpr: &[BatchPredictionRequest], - batch_ends: &[usize], - ) -> InputTensor { - InputTensor::FloatTensor( - self.get_embedding_tensors(bpr, self.user_eng_embedding_feature_id, batch_ends) - .into_dyn(), - ) - } - - fn get_author_embedding( - &self, - bpr: &[BatchPredictionRequest], - batch_ends: &[usize], - ) -> InputTensor { - InputTensor::FloatTensor( - self.get_embedding_tensors(bpr, self.author_embedding_feature_id, batch_ends) - .into_dyn(), - ) - } -} - -impl Converter for BatchPredictionRequestToTorchTensorConverter { - fn convert(&self, batched_bytes: Vec>) -> (Vec, Vec) { - let bprs = batched_bytes - .into_iter() - .map(|bytes| { - BatchPredictionRequestToTorchTensorConverter::parse_batch_prediction_request(bytes) - }) - .collect::>(); - let batch_ends = bprs - .iter() - .map(|bpr| bpr.individual_features_list.len()) - .scan(0usize, |acc, e| { - //running total - *acc = *acc + e; - Some(*acc) - }) - .collect::>(); - - let t1 = self.get_continuous(&bprs, &batch_ends); - let t2 = self.get_binary(&bprs, &batch_ends); - //let _t3 = self.get_discrete(&bprs, &batch_ends); - let t4 = self.get_user_embedding(&bprs, &batch_ends); - let t5 = self.get_eng_embedding(&bprs, &batch_ends); - let t6 = self.get_author_embedding(&bprs, &batch_ends); - - (vec![t1, t2, t4, t5, t6], batch_ends) - } -} diff --git a/navi/dr_transform/src/lib.rs b/navi/dr_transform/src/lib.rs deleted file mode 100644 index ea3b25a55..000000000 --- a/navi/dr_transform/src/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod all_config; -pub mod converter; -#[cfg(test)] -mod test; -pub mod util; -pub extern crate ort; diff --git a/navi/dr_transform/src/util.rs b/navi/dr_transform/src/util.rs deleted file mode 100644 index 83b99805a..000000000 --- a/navi/dr_transform/src/util.rs +++ /dev/null @@ -1,32 +0,0 @@ -use npyz::WriterBuilder; -use npyz::{AutoSerialize, WriteOptions}; -use std::io::BufWriter; -use std::{ - fs::File, - io::{self, BufRead}, -}; - -pub fn load_batch_prediction_request_base64(file_name: &str) -> Vec> { - let file = File::open(file_name).expect("could not read file"); - let mut result = vec![]; - for (mut line_count, line) in io::BufReader::new(file).lines().enumerate() { - line_count += 1; - match base64::decode(line.unwrap().trim()) { - Ok(payload) => result.push(payload), - Err(err) => println!("error decoding line {file_name}:{line_count} - {err}"), - } - } - println!("result len: {}", result.len()); - result -} - -pub fn save_to_npy(data: &[T], save_to: String) { - let mut writer = WriteOptions::new() - .default_dtype() - .shape(&[data.len() as u64, 1]) - .writer(BufWriter::new(File::create(save_to).unwrap())) - .begin_nd() - .unwrap(); - writer.extend(data.to_owned()).unwrap(); - writer.finish().unwrap(); -} diff --git a/navi/navi/Cargo.toml b/navi/navi/Cargo.toml deleted file mode 100644 index e355ea2a7..000000000 --- a/navi/navi/Cargo.toml +++ /dev/null @@ -1,81 +0,0 @@ -[package] -name = "navi" -version = "2.0.45" -edition = "2021" - -[[bin]] -name = "navi" -path = "src/bin/navi.rs" -required-features=["tf"] -[[bin]] -name = "navi_torch" -path = "src/bin/navi_torch.rs" -required-features=["torch"] -[[bin]] -name = "navi_onnx" -path = "src/bin/navi_onnx.rs" -required-features=["onnx"] -[[bin]] -name = "navi_onnx_test" -path = "src/bin/bin_tests/navi_onnx_test.rs" -[[bin]] -name = "navi_torch_test" -path = "src/bin/bin_tests/navi_torch_test.rs" -required-features=["torch"] - -[features] -default=[] -navi_console=[] -torch=["tch"] -onnx=[] -tf=["tensorflow"] -[dependencies] -itertools = "0.10.5" -anyhow = "1.0.57" -arrayvec = "0.7.2" -clap = { version = "4.0.32", features = ["derive"] } -console-subscriber = "0.1.6" -time = { version = "0.3.20", features = ["parsing"] } -env_logger = "0.10.0" -flamegraph = "0.6.1" -fnv = "1.0.7" -futures = { version = "0.3", default-features = false } -image = "0.24.5" -indexmap = "1.8.1" -lazy_static = "1.4" -libloading = "0.7" -log = "0.4.17" -ndarray-rand = "0.14.0" -prometheus = "0.13.1" -prost = "0.9" -prost-types = "0.9" -parking_lot = "0.12.1" -rand = "0.8.5" -rand_pcg = "0.3.1" -random = "0.12.2" -x509-parser = "0.15.0" -sha256 = "1.0.3" -tonic = { version = "0.6.2", features=['compression', 'tls'] } -tokio = { version = "1.17.0", features = ["macros", "rt-multi-thread", "fs", "process"] } -warp = "0.3" -npyz = "0.7.3" -base64 = "0.21.0" -histogram = "0.6.9" -tch = {version = "0.10.3", optional = true} -tensorflow = { version = "0.18.0", optional = true } -once_cell = {version = "1.17.1"} -ndarray = "0.15" -serde = "1.0.154" -serde_json = "1.0.94" -dr_transform = { path = "../dr_transform"} -[build-dependencies] -tonic-build = {version = "0.6.2", features=['prost', "compression"] } -[profile.release] -debug = true -[dev-dependencies] -ndarray-rand = "0.14.0" -tokio-test = "*" -assert_cmd = "2.0" -criterion = "0.4.0" - - diff --git a/navi/navi/build.rs b/navi/navi/build.rs deleted file mode 100644 index 8757a1823..000000000 --- a/navi/navi/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -fn main() -> Result<(), Box> { - //::compile_protos("proto/tensorflow_serving/apis/prediction_service.proto")?; - tonic_build::configure().compile( - &[ - "proto/tensorflow_serving/apis/prediction_service.proto", - "proto/tensorflow/core/protobuf/config.proto", - "proto/tensorflow_serving/apis/prediction_log.proto", - "proto/kfserving/grpc_predict_v2.proto", - ], - &["proto"], - )?; - Ok(()) -} diff --git a/navi/navi/proto/kfserving/grpc_predict_v2.proto b/navi/navi/proto/kfserving/grpc_predict_v2.proto deleted file mode 100644 index 6b2475a2e..000000000 --- a/navi/navi/proto/kfserving/grpc_predict_v2.proto +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright 2020 kubeflow.org. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; -package inference; - -// Inference Server GRPC endpoints. -service GRPCInferenceService -{ - // The ServerLive API indicates if the inference server is able to receive - // and respond to metadata and inference requests. - rpc ServerLive(ServerLiveRequest) returns (ServerLiveResponse) {} - - // The ServerReady API indicates if the server is ready for inferencing. - rpc ServerReady(ServerReadyRequest) returns (ServerReadyResponse) {} - - // The ModelReady API indicates if a specific model is ready for inferencing. - rpc ModelReady(ModelReadyRequest) returns (ModelReadyResponse) {} - - // The ServerMetadata API provides information about the server. Errors are - // indicated by the google.rpc.Status returned for the request. The OK code - // indicates success and other codes indicate failure. - rpc ServerMetadata(ServerMetadataRequest) returns (ServerMetadataResponse) {} - - // The per-model metadata API provides information about a model. Errors are - // indicated by the google.rpc.Status returned for the request. The OK code - // indicates success and other codes indicate failure. - rpc ModelMetadata(ModelMetadataRequest) returns (ModelMetadataResponse) {} - - // The ModelInfer API performs inference using the specified model. Errors are - // indicated by the google.rpc.Status returned for the request. The OK code - // indicates success and other codes indicate failure. - rpc ModelInfer(ModelInferRequest) returns (ModelInferResponse) {} -} - -message ServerLiveRequest {} - -message ServerLiveResponse -{ - // True if the inference server is live, false if not live. - bool live = 1; -} - -message ServerReadyRequest {} - -message ServerReadyResponse -{ - // True if the inference server is ready, false if not ready. - bool ready = 1; -} - -message ModelReadyRequest -{ - // The name of the model to check for readiness. - string name = 1; - - // The version of the model to check for readiness. If not given the - // server will choose a version based on the model and internal policy. - string version = 2; -} - -message ModelReadyResponse -{ - // True if the model is ready, false if not ready. - bool ready = 1; -} - -message ServerMetadataRequest {} - -message ServerMetadataResponse -{ - // The server name. - string name = 1; - - // The server version. - string version = 2; - - // The extensions supported by the server. - repeated string extensions = 3; -} - -message ModelMetadataRequest -{ - // The name of the model. - string name = 1; - - // The version of the model to check for readiness. If not given the - // server will choose a version based on the model and internal policy. - string version = 2; -} - -message ModelMetadataResponse -{ - // Metadata for a tensor. - message TensorMetadata - { - // The tensor name. - string name = 1; - - // The tensor data type. - string datatype = 2; - - // The tensor shape. A variable-size dimension is represented - // by a -1 value. - repeated int64 shape = 3; - } - - // The model name. - string name = 1; - - // The versions of the model available on the server. - repeated string versions = 2; - - // The model's platform. See Platforms. - string platform = 3; - - // The model's inputs. - repeated TensorMetadata inputs = 4; - - // The model's outputs. - repeated TensorMetadata outputs = 5; -} - -message ModelInferRequest -{ - // An input tensor for an inference request. - message InferInputTensor - { - // The tensor name. - string name = 1; - - // The tensor data type. - string datatype = 2; - - // The tensor shape. - repeated int64 shape = 3; - - // Optional inference input tensor parameters. - map parameters = 4; - - // The tensor contents using a data-type format. This field must - // not be specified if "raw" tensor contents are being used for - // the inference request. - InferTensorContents contents = 5; - } - - // An output tensor requested for an inference request. - message InferRequestedOutputTensor - { - // The tensor name. - string name = 1; - - // Optional requested output tensor parameters. - map parameters = 2; - } - - // The name of the model to use for inferencing. - string model_name = 1; - - // The version of the model to use for inference. If not given the - // server will choose a version based on the model and internal policy. - string model_version = 2; - - // Optional identifier for the request. If specified will be - // returned in the response. - string id = 3; - - // Optional inference parameters. - map parameters = 4; - - // The input tensors for the inference. - repeated InferInputTensor inputs = 5; - - // The requested output tensors for the inference. Optional, if not - // specified all outputs produced by the model will be returned. - repeated InferRequestedOutputTensor outputs = 6; - - // The data contained in an input tensor can be represented in "raw" - // bytes form or in the repeated type that matches the tensor's data - // type. To use the raw representation 'raw_input_contents' must be - // initialized with data for each tensor in the same order as - // 'inputs'. For each tensor, the size of this content must match - // what is expected by the tensor's shape and data type. The raw - // data must be the flattened, one-dimensional, row-major order of - // the tensor elements without any stride or padding between the - // elements. Note that the FP16 and BF16 data types must be represented as - // raw content as there is no specific data type for a 16-bit float type. - // - // If this field is specified then InferInputTensor::contents must - // not be specified for any input tensor. - repeated bytes raw_input_contents = 7; -} - -message ModelInferResponse -{ - // An output tensor returned for an inference request. - message InferOutputTensor - { - // The tensor name. - string name = 1; - - // The tensor data type. - string datatype = 2; - - // The tensor shape. - repeated int64 shape = 3; - - // Optional output tensor parameters. - map parameters = 4; - - // The tensor contents using a data-type format. This field must - // not be specified if "raw" tensor contents are being used for - // the inference response. - InferTensorContents contents = 5; - } - - // The name of the model used for inference. - string model_name = 1; - - // The version of the model used for inference. - string model_version = 2; - - // The id of the inference request if one was specified. - string id = 3; - - // Optional inference response parameters. - map parameters = 4; - - // The output tensors holding inference results. - repeated InferOutputTensor outputs = 5; - - // The data contained in an output tensor can be represented in - // "raw" bytes form or in the repeated type that matches the - // tensor's data type. To use the raw representation 'raw_output_contents' - // must be initialized with data for each tensor in the same order as - // 'outputs'. For each tensor, the size of this content must match - // what is expected by the tensor's shape and data type. The raw - // data must be the flattened, one-dimensional, row-major order of - // the tensor elements without any stride or padding between the - // elements. Note that the FP16 and BF16 data types must be represented as - // raw content as there is no specific data type for a 16-bit float type. - // - // If this field is specified then InferOutputTensor::contents must - // not be specified for any output tensor. - repeated bytes raw_output_contents = 6; -} - -// An inference parameter value. The Parameters message describes a -// “name”/”value” pair, where the “name” is the name of the parameter -// and the “value” is a boolean, integer, or string corresponding to -// the parameter. -message InferParameter -{ - // The parameter value can be a string, an int64, a boolean - // or a message specific to a predefined parameter. - oneof parameter_choice - { - // A boolean parameter value. - bool bool_param = 1; - - // An int64 parameter value. - int64 int64_param = 2; - - // A string parameter value. - string string_param = 3; - } -} - -// The data contained in a tensor represented by the repeated type -// that matches the tensor's data type. Protobuf oneof is not used -// because oneofs cannot contain repeated fields. -message InferTensorContents -{ - // Representation for BOOL data type. The size must match what is - // expected by the tensor's shape. The contents must be the flattened, - // one-dimensional, row-major order of the tensor elements. - repeated bool bool_contents = 1; - - // Representation for INT8, INT16, and INT32 data types. The size - // must match what is expected by the tensor's shape. The contents - // must be the flattened, one-dimensional, row-major order of the - // tensor elements. - repeated int32 int_contents = 2; - - // Representation for INT64 data types. The size must match what - // is expected by the tensor's shape. The contents must be the - // flattened, one-dimensional, row-major order of the tensor elements. - repeated int64 int64_contents = 3; - - // Representation for UINT8, UINT16, and UINT32 data types. The size - // must match what is expected by the tensor's shape. The contents - // must be the flattened, one-dimensional, row-major order of the - // tensor elements. - repeated uint32 uint_contents = 4; - - // Representation for UINT64 data types. The size must match what - // is expected by the tensor's shape. The contents must be the - // flattened, one-dimensional, row-major order of the tensor elements. - repeated uint64 uint64_contents = 5; - - // Representation for FP32 data type. The size must match what is - // expected by the tensor's shape. The contents must be the flattened, - // one-dimensional, row-major order of the tensor elements. - repeated float fp32_contents = 6; - - // Representation for FP64 data type. The size must match what is - // expected by the tensor's shape. The contents must be the flattened, - // one-dimensional, row-major order of the tensor elements. - repeated double fp64_contents = 7; - - // Representation for BYTES data type. The size must match what is - // expected by the tensor's shape. The contents must be the flattened, - // one-dimensional, row-major order of the tensor elements. - repeated bytes bytes_contents = 8; -} diff --git a/navi/navi/proto/tensorflow/core/example/example.proto b/navi/navi/proto/tensorflow/core/example/example.proto deleted file mode 100644 index 0b49514e5..000000000 --- a/navi/navi/proto/tensorflow/core/example/example.proto +++ /dev/null @@ -1,306 +0,0 @@ -// Protocol messages for describing input data Examples for machine learning -// model training or inference. -syntax = "proto3"; - -package tensorflow; - -import "tensorflow/core/example/feature.proto"; - -option cc_enable_arenas = true; -option java_outer_classname = "ExampleProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.example"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example"; - -// LINT.IfChange -// An Example is a mostly-normalized data format for storing data for -// training and inference. It contains a key-value store (features); where -// each key (string) maps to a Feature message (which is oneof packed BytesList, -// FloatList, or Int64List). This flexible and compact format allows the -// storage of large amounts of typed data, but requires that the data shape -// and use be determined by the configuration files and parsers that are used to -// read and write this format. That is, the Example is mostly *not* a -// self-describing format. In TensorFlow, Examples are read in row-major -// format, so any configuration that describes data with rank-2 or above -// should keep this in mind. For example, to store an M x N matrix of Bytes, -// the BytesList must contain M*N bytes, with M rows of N contiguous values -// each. That is, the BytesList value must store the matrix as: -// .... row 0 .... .... row 1 .... // ........... // ... row M-1 .... -// -// An Example for a movie recommendation application: -// features { -// feature { -// key: "age" -// value { float_list { -// value: 29.0 -// }} -// } -// feature { -// key: "movie" -// value { bytes_list { -// value: "The Shawshank Redemption" -// value: "Fight Club" -// }} -// } -// feature { -// key: "movie_ratings" -// value { float_list { -// value: 9.0 -// value: 9.7 -// }} -// } -// feature { -// key: "suggestion" -// value { bytes_list { -// value: "Inception" -// }} -// } -// # Note that this feature exists to be used as a label in training. -// # E.g., if training a logistic regression model to predict purchase -// # probability in our learning tool we would set the label feature to -// # "suggestion_purchased". -// feature { -// key: "suggestion_purchased" -// value { float_list { -// value: 1.0 -// }} -// } -// # Similar to "suggestion_purchased" above this feature exists to be used -// # as a label in training. -// # E.g., if training a linear regression model to predict purchase -// # price in our learning tool we would set the label feature to -// # "purchase_price". -// feature { -// key: "purchase_price" -// value { float_list { -// value: 9.99 -// }} -// } -// } -// -// A conformant Example data set obeys the following conventions: -// - If a Feature K exists in one example with data type T, it must be of -// type T in all other examples when present. It may be omitted. -// - The number of instances of Feature K list data may vary across examples, -// depending on the requirements of the model. -// - If a Feature K doesn't exist in an example, a K-specific default will be -// used, if configured. -// - If a Feature K exists in an example but contains no items, the intent -// is considered to be an empty tensor and no default will be used. - -message Example { - Features features = 1; -} - -// A SequenceExample is an Example representing one or more sequences, and -// some context. The context contains features which apply to the entire -// example. The feature_lists contain a key, value map where each key is -// associated with a repeated set of Features (a FeatureList). -// A FeatureList thus represents the values of a feature identified by its key -// over time / frames. -// -// Below is a SequenceExample for a movie recommendation application recording a -// sequence of ratings by a user. The time-independent features ("locale", -// "age", "favorites") describing the user are part of the context. The sequence -// of movies the user rated are part of the feature_lists. For each movie in the -// sequence we have information on its name and actors and the user's rating. -// This information is recorded in three separate feature_list(s). -// In the example below there are only two movies. All three feature_list(s), -// namely "movie_ratings", "movie_names", and "actors" have a feature value for -// both movies. Note, that "actors" is itself a bytes_list with multiple -// strings per movie. -// -// context: { -// feature: { -// key : "locale" -// value: { -// bytes_list: { -// value: [ "pt_BR" ] -// } -// } -// } -// feature: { -// key : "age" -// value: { -// float_list: { -// value: [ 19.0 ] -// } -// } -// } -// feature: { -// key : "favorites" -// value: { -// bytes_list: { -// value: [ "Majesty Rose", "Savannah Outen", "One Direction" ] -// } -// } -// } -// } -// feature_lists: { -// feature_list: { -// key : "movie_ratings" -// value: { -// feature: { -// float_list: { -// value: [ 4.5 ] -// } -// } -// feature: { -// float_list: { -// value: [ 5.0 ] -// } -// } -// } -// } -// feature_list: { -// key : "movie_names" -// value: { -// feature: { -// bytes_list: { -// value: [ "The Shawshank Redemption" ] -// } -// } -// feature: { -// bytes_list: { -// value: [ "Fight Club" ] -// } -// } -// } -// } -// feature_list: { -// key : "actors" -// value: { -// feature: { -// bytes_list: { -// value: [ "Tim Robbins", "Morgan Freeman" ] -// } -// } -// feature: { -// bytes_list: { -// value: [ "Brad Pitt", "Edward Norton", "Helena Bonham Carter" ] -// } -// } -// } -// } -// } -// -// A conformant SequenceExample data set obeys the following conventions: -// -// Context: -// - All conformant context features K must obey the same conventions as -// a conformant Example's features (see above). -// Feature lists: -// - A FeatureList L may be missing in an example; it is up to the -// parser configuration to determine if this is allowed or considered -// an empty list (zero length). -// - If a FeatureList L exists, it may be empty (zero length). -// - If a FeatureList L is non-empty, all features within the FeatureList -// must have the same data type T. Even across SequenceExamples, the type T -// of the FeatureList identified by the same key must be the same. An entry -// without any values may serve as an empty feature. -// - If a FeatureList L is non-empty, it is up to the parser configuration -// to determine if all features within the FeatureList must -// have the same size. The same holds for this FeatureList across multiple -// examples. -// - For sequence modeling, e.g.: -// http://colah.github.io/posts/2015-08-Understanding-LSTMs/ -// https://github.com/tensorflow/nmt -// the feature lists represent a sequence of frames. -// In this scenario, all FeatureLists in a SequenceExample have the same -// number of Feature messages, so that the ith element in each FeatureList -// is part of the ith frame (or time step). -// Examples of conformant and non-conformant examples' FeatureLists: -// -// Conformant FeatureLists: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// -// Non-conformant FeatureLists (mismatched types): -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { int64_list: { value: [ 5 ] } } } -// } } -// -// Conditionally conformant FeatureLists, the parser configuration determines -// if the feature sizes must match: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0, 6.0 ] } } } -// } } -// -// Conformant pair of SequenceExample -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// and: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } -// feature: { float_list: { value: [ 2.0 ] } } } -// } } -// -// Conformant pair of SequenceExample -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// and: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { } -// } } -// -// Conditionally conformant pair of SequenceExample, the parser configuration -// determines if the second feature_lists is consistent (zero-length) or -// invalid (missing "movie_ratings"): -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// and: -// feature_lists: { } -// -// Non-conformant pair of SequenceExample (mismatched types) -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// and: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { int64_list: { value: [ 4 ] } } -// feature: { int64_list: { value: [ 5 ] } } -// feature: { int64_list: { value: [ 2 ] } } } -// } } -// -// Conditionally conformant pair of SequenceExample; the parser configuration -// determines if the feature sizes must match: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.5 ] } } -// feature: { float_list: { value: [ 5.0 ] } } } -// } } -// and: -// feature_lists: { feature_list: { -// key: "movie_ratings" -// value: { feature: { float_list: { value: [ 4.0 ] } } -// feature: { float_list: { value: [ 5.0, 3.0 ] } } -// } } - -message SequenceExample { - Features context = 1; - FeatureLists feature_lists = 2; -} -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/python/training/training.py) diff --git a/navi/navi/proto/tensorflow/core/example/feature.proto b/navi/navi/proto/tensorflow/core/example/feature.proto deleted file mode 100644 index e532747f3..000000000 --- a/navi/navi/proto/tensorflow/core/example/feature.proto +++ /dev/null @@ -1,110 +0,0 @@ -// Protocol messages for describing features for machine learning model -// training or inference. -// -// There are three base Feature types: -// - bytes -// - float -// - int64 -// -// A Feature contains Lists which may hold zero or more values. These -// lists are the base values BytesList, FloatList, Int64List. -// -// Features are organized into categories by name. The Features message -// contains the mapping from name to Feature. -// -// Example Features for a movie recommendation application: -// feature { -// key: "age" -// value { float_list { -// value: 29.0 -// }} -// } -// feature { -// key: "movie" -// value { bytes_list { -// value: "The Shawshank Redemption" -// value: "Fight Club" -// }} -// } -// feature { -// key: "movie_ratings" -// value { float_list { -// value: 9.0 -// value: 9.7 -// }} -// } -// feature { -// key: "suggestion" -// value { bytes_list { -// value: "Inception" -// }} -// } -// feature { -// key: "suggestion_purchased" -// value { int64_list { -// value: 1 -// }} -// } -// feature { -// key: "purchase_price" -// value { float_list { -// value: 9.99 -// }} -// } -// - -syntax = "proto3"; - -package tensorflow; - -option cc_enable_arenas = true; -option java_outer_classname = "FeatureProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.example"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/example"; - -// LINT.IfChange -// Containers to hold repeated fundamental values. -message BytesList { - repeated bytes value = 1; -} -message FloatList { - repeated float value = 1 [packed = true]; -} -message Int64List { - repeated int64 value = 1 [packed = true]; -} - -// Containers for non-sequential data. -message Feature { - // Each feature can be exactly one kind. - oneof kind { - BytesList bytes_list = 1; - FloatList float_list = 2; - Int64List int64_list = 3; - } -} - -message Features { - // Map from feature name to feature. - map feature = 1; -} - -// Containers for sequential data. -// -// A FeatureList contains lists of Features. These may hold zero or more -// Feature values. -// -// FeatureLists are organized into categories by name. The FeatureLists message -// contains the mapping from name to FeatureList. -// -message FeatureList { - repeated Feature feature = 1; -} - -message FeatureLists { - // Map from feature name to feature list. - map feature_list = 1; -} -// LINT.ThenChange( -// https://www.tensorflow.org/code/tensorflow/python/training/training.py) diff --git a/navi/navi/proto/tensorflow/core/framework/allocation_description.proto b/navi/navi/proto/tensorflow/core/framework/allocation_description.proto deleted file mode 100644 index f18caa40b..000000000 --- a/navi/navi/proto/tensorflow/core/framework/allocation_description.proto +++ /dev/null @@ -1,29 +0,0 @@ -syntax = "proto3"; - -package tensorflow; - -option cc_enable_arenas = true; -option java_outer_classname = "AllocationDescriptionProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/allocation_description_go_proto"; - -message AllocationDescription { - // Total number of bytes requested - int64 requested_bytes = 1; - - // Total number of bytes allocated if known - int64 allocated_bytes = 2; - - // Name of the allocator used - string allocator_name = 3; - - // Identifier of the allocated buffer if known - int64 allocation_id = 4; - - // Set if this tensor only has one remaining reference - bool has_single_reference = 5; - - // Address of the allocation. - uint64 ptr = 6; -} diff --git a/navi/navi/proto/tensorflow/core/framework/api_def.proto b/navi/navi/proto/tensorflow/core/framework/api_def.proto deleted file mode 100644 index 1823ce64f..000000000 --- a/navi/navi/proto/tensorflow/core/framework/api_def.proto +++ /dev/null @@ -1,138 +0,0 @@ -// Defines the text format for including per-op API definition and -// overrides for client language op code generators. - -syntax = "proto3"; - -package tensorflow; - -import "tensorflow/core/framework/attr_value.proto"; - -option cc_enable_arenas = true; -option java_outer_classname = "ApiDefProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/api_def_go_proto"; - -// Used to specify and override the default API & behavior in the -// generated code for client languages, from what you would get from -// the OpDef alone. There will be a set of ApiDefs that are common -// to all client languages, and another set per client language. -// The per-client-language ApiDefs will inherit values from the -// common ApiDefs which it can either replace or modify. -// -// We separate the API definition from the OpDef so we can evolve the -// API while remaining backwards compatible when interpreting old -// graphs. Overrides go in an "api_def.pbtxt" file with a text-format -// ApiDefs message. -// -// WARNING: Be *very* careful changing the API for any existing op -- -// you can change the semantics of existing code. These changes may -// need to wait until a major release of TensorFlow to avoid breaking -// our compatibility promises. -message ApiDef { - // Name of the op (in the OpDef) to specify the API for. - string graph_op_name = 1; - // If this op is deprecated, set deprecation message to the message - // that should be logged when this op is used. - // The message should indicate alternative op to use, if any. - string deprecation_message = 12; - // Major version when the op will be deleted. For e.g. set this - // value to 2 if op API should be removed in TensorFlow 2.0 and - // deprecated in versions before that. - int32 deprecation_version = 13; - - enum Visibility { - // Normally this is "VISIBLE" unless you are inheriting a - // different value from another ApiDef. - DEFAULT_VISIBILITY = 0; - // Publicly visible in the API. - VISIBLE = 1; - // Do not include this op in the generated API. If visibility is - // set to 'SKIP', other fields are ignored for this op. - SKIP = 2; - // Hide this op by putting it into an internal namespace (or whatever - // is appropriate in the target language). - HIDDEN = 3; - } - Visibility visibility = 2; - - // If you specify any endpoint, this will replace all of the - // inherited endpoints. The first endpoint should be the - // "canonical" endpoint, and should not be deprecated (unless all - // endpoints are deprecated). - message Endpoint { - // Name should be either like "CamelCaseName" or - // "Package.CamelCaseName". Client-language-specific ApiDefs may - // use a snake_case convention instead of CamelCase. - string name = 1; - - // Set if this endpoint is deprecated. If set to true, a message suggesting - // to use a non-deprecated endpoint instead will be printed. If all - // endpoints are deprecated, set deprecation_message in ApiDef instead. - bool deprecated = 3; - - // Major version when an endpoint will be deleted. For e.g. set this - // value to 2 if endpoint should be removed in TensorFlow 2.0 and - // deprecated in versions before that. - int32 deprecation_version = 4; - } - repeated Endpoint endpoint = 3; - - message Arg { - string name = 1; - - // Change the name used to access this arg in the API from what - // is used in the GraphDef. Note that these names in `backticks` - // will also be replaced in the summary & description fields. - string rename_to = 2; - - // Note: this will replace any inherited arg doc. There is no - // current way of modifying arg descriptions (other than replacing - // them entirely) as can be done with op descriptions. - string description = 3; - } - repeated Arg in_arg = 4; - repeated Arg out_arg = 5; - // List of original in_arg names to specify new argument order. - // Length of arg_order should be either empty to keep current order - // or match size of in_arg. - repeated string arg_order = 11; - - // Description of the graph-construction-time configuration of this - // Op. That is to say, this describes the attr fields that will - // be specified in the NodeDef. - message Attr { - string name = 1; - - // Change the name used to access this attr in the API from what - // is used in the GraphDef. Note that these names in `backticks` - // will also be replaced in the summary & description fields. - string rename_to = 2; - - // Specify a new default value to use for this attr. This default - // will be used when creating new graphs, as opposed to the - // default in the OpDef, which will be used when interpreting old - // GraphDefs. - AttrValue default_value = 3; - - // Note: this will replace any inherited attr doc, there is no current - // way of modifying attr descriptions as can be done with op descriptions. - string description = 4; - } - repeated Attr attr = 6; - - // One-line human-readable description of what the Op does. - string summary = 7; - - // Additional, longer human-readable description of what the Op does. - string description = 8; - - // Modify an existing/inherited description by adding text to the beginning - // or end. - string description_prefix = 9; - string description_suffix = 10; -} - -message ApiDefs { - repeated ApiDef op = 1; -} diff --git a/navi/navi/proto/tensorflow/core/framework/attr_value.proto b/navi/navi/proto/tensorflow/core/framework/attr_value.proto deleted file mode 100644 index 2e913130d..000000000 --- a/navi/navi/proto/tensorflow/core/framework/attr_value.proto +++ /dev/null @@ -1,64 +0,0 @@ -syntax = "proto3"; - -package tensorflow; - -import "tensorflow/core/framework/tensor.proto"; -import "tensorflow/core/framework/tensor_shape.proto"; -import "tensorflow/core/framework/types.proto"; - -option cc_enable_arenas = true; -option java_outer_classname = "AttrValueProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/attr_value_go_proto"; - -// Protocol buffer representing the value for an attr used to configure an Op. -// Comment indicates the corresponding attr type. Only the field matching the -// attr type may be filled. -message AttrValue { - // LINT.IfChange - message ListValue { - repeated bytes s = 2; // "list(string)" - repeated int64 i = 3 [packed = true]; // "list(int)" - repeated float f = 4 [packed = true]; // "list(float)" - repeated bool b = 5 [packed = true]; // "list(bool)" - repeated DataType type = 6 [packed = true]; // "list(type)" - repeated TensorShapeProto shape = 7; // "list(shape)" - repeated TensorProto tensor = 8; // "list(tensor)" - repeated NameAttrList func = 9; // "list(attr)" - } - // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) - - oneof value { - bytes s = 2; // "string" - int64 i = 3; // "int" - float f = 4; // "float" - bool b = 5; // "bool" - DataType type = 6; // "type" - TensorShapeProto shape = 7; // "shape" - TensorProto tensor = 8; // "tensor" - ListValue list = 1; // any "list(...)" - - // "func" represents a function. func.name is a function's name or - // a primitive op's name. func.attr.first is the name of an attr - // defined for that function. func.attr.second is the value for - // that attr in the instantiation. - NameAttrList func = 10; - - // This is a placeholder only used in nodes defined inside a - // function. It indicates the attr value will be supplied when - // the function is instantiated. For example, let us suppose a - // node "N" in function "FN". "N" has an attr "A" with value - // placeholder = "foo". When FN is instantiated with attr "foo" - // set to "bar", the instantiated node N's attr A will have been - // given the value "bar". - string placeholder = 9; - } -} - -// A list of attr names and their values. The whole list is attached -// with a string name. E.g., MatMul[T=float]. -message NameAttrList { - string name = 1; - map attr = 2; -} diff --git a/navi/navi/proto/tensorflow/core/framework/cost_graph.proto b/navi/navi/proto/tensorflow/core/framework/cost_graph.proto deleted file mode 100644 index 42c9e23cf..000000000 --- a/navi/navi/proto/tensorflow/core/framework/cost_graph.proto +++ /dev/null @@ -1,89 +0,0 @@ -syntax = "proto3"; - -package tensorflow; - -import "tensorflow/core/framework/tensor_shape.proto"; -import "tensorflow/core/framework/types.proto"; - -option cc_enable_arenas = true; -option java_outer_classname = "CostGraphProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/cost_graph_go_proto"; - -message CostGraphDef { - message Node { - // The name of the node. Names are globally unique. - string name = 1; - - // The device of the node. Can be empty if the node is mapped to the - // default partition or partitioning hasn't been run yet. - string device = 2; - - // The id of the node. Node ids are only unique inside a partition. - int32 id = 3; - - // Inputs of this node. They must be executed before this node can be - // executed. An input is a particular output of another node, specified - // by the node id and the output index. - message InputInfo { - int32 preceding_node = 1; - int32 preceding_port = 2; - } - repeated InputInfo input_info = 4; - - // Outputs of this node. - message OutputInfo { - int64 size = 1; - // If >= 0, the output is an alias of an input. Note that an alias input - // may itself be an alias. The algorithm will therefore need to follow - // those pointers. - int64 alias_input_port = 2; - TensorShapeProto shape = 3; - DataType dtype = 4; - } - repeated OutputInfo output_info = 5; - - // Temporary memory used by this node. - int64 temporary_memory_size = 6; - - // Persistent memory used by this node. - int64 persistent_memory_size = 12; - - int64 host_temp_memory_size = 10 [deprecated = true]; - int64 device_temp_memory_size = 11 [deprecated = true]; - int64 device_persistent_memory_size = 16 [deprecated = true]; - - // Estimate of the computational cost of this node, in microseconds. - int64 compute_cost = 9; - - // Analytical estimate of the computational cost of this node, in - // microseconds. - int64 compute_time = 14; - - // Analytical estimate of the memory access cost of this node, in - // microseconds. - int64 memory_time = 15; - - // If true, the output is permanent: it can't be discarded, because this - // node is part of the "final output". Nodes may depend on final nodes. - bool is_final = 7; - - // Ids of the control inputs for this node. - repeated int32 control_input = 8; - - // Are the costs inaccurate? - bool inaccurate = 17; - } - repeated Node node = 1; - - // Total cost of this graph, typically used for balancing decisions. - message AggregatedCost { - // Aggregated cost value. - float cost = 1; - - // Aggregated cost dimension (e.g. 'memory', 'compute', 'network'). - string dimension = 2; - } - repeated AggregatedCost cost = 2; -} diff --git a/navi/navi/proto/tensorflow/core/framework/dataset_metadata.proto b/navi/navi/proto/tensorflow/core/framework/dataset_metadata.proto deleted file mode 100644 index 0e667dd48..000000000 --- a/navi/navi/proto/tensorflow/core/framework/dataset_metadata.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package tensorflow.data; - -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/dataset_metadata_go_proto"; - -// next: 2 -message Metadata { - bytes name = 1; -} diff --git a/navi/navi/proto/tensorflow/core/framework/dataset_options.proto b/navi/navi/proto/tensorflow/core/framework/dataset_options.proto deleted file mode 100644 index 3919d51c1..000000000 --- a/navi/navi/proto/tensorflow/core/framework/dataset_options.proto +++ /dev/null @@ -1,196 +0,0 @@ -syntax = "proto3"; - -package tensorflow.data; - -import "tensorflow/core/framework/model.proto"; - -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/dataset_options_go_proto"; - -// Represents the type of auto-sharding we enable. -enum AutoShardPolicy { - // AUTO: Attempts FILE-based sharding, falling back to DATA-based sharding. - AUTO = 0; - // FILE: Shards by input files (i.e. each worker will get a set of files to - // process). When this option is selected, make sure that there is at least as - // many files as workers. If there are fewer input files than workers, a - // runtime error will be raised. - FILE = 1; - // DATA: Shards by elements produced by the dataset. Each worker will process - // the whole dataset and discard the portion that is not for itself. Note that - // for this mode to correctly partitions the dataset elements, the dataset - // needs to produce elements in a deterministic order. - DATA = 2; - // HINT: Looks for the presence of `shard(SHARD_HINT, ...)` which is treated - // as a placeholder to replace with `shard(num_workers, worker_index)`. - HINT = 3; - // OFF: No sharding will be performed. - OFF = -1; -} - -// next: 5 -message AutotuneOptions { - // Whether to automatically tune performance knobs. - oneof optional_enabled { - bool enabled = 1; - } - // When autotuning is enabled (through autotune), determines the CPU budget to - // use. Values greater than the number of schedulable CPU cores are allowed - // but may result in CPU contention. - oneof optional_cpu_budget { - int32 cpu_budget = 2; - } - // When autotuning is enabled (through autotune), determines the RAM budget to - // use. Values greater than the available RAM in bytes may result in OOM. If - // 0, defaults to half of the available RAM in bytes. - oneof optional_ram_budget { - int64 ram_budget = 3; - } - - // When autotuning is enabled (through autotune), determines the algorithm to - // use. If not explicitly set by user, autotuning will follow HILL_CLIMB - // algorithm but has more flexibility to tune parameters more aggressively, - // in which case the behavior is implementation specific and may change over - // time. - oneof optional_autotune_algorithm { - model.AutotuneAlgorithm autotune_algorithm = 4; - } -} - -// next: 2 -message CardinalityOptions { - enum ComputeLevel { - CARDINALITY_COMPUTE_UNSPECIFIED = 0; - // Cardinality will only be computed if it can be determined in a cheap - // manner (ie. without reading from file sources). If the cardinality would - // be nontrivial to compute, Cardinality() will return UNKNOWN_CARDINALITY. - CARDINALITY_COMPUTE_LOW = 1; - // Moderate effort will be made to determine cardinality, such as reading - // index data from source files. If significant work is needed to compute - // cardinality (e.g. reading entire source file contents or executing user - // defined functions), Cardinality() will return UNKNOWN_CARDINALITY. - CARDINALITY_COMPUTE_MODERATE = 2; - } - ComputeLevel compute_level = 1; -} - -// next: 3 -message DistributeOptions { - AutoShardPolicy auto_shard_policy = 1; - // The number of devices attached to this input pipeline. - oneof optional_num_devices { - int32 num_devices = 2; - } -} - -// next: 18 -message OptimizationOptions { - // Whether to apply default graph optimizations. If False, only graph - // optimizations that have been explicitly enabled will be applied. - oneof optional_apply_default_optimizations { - bool apply_default_optimizations = 1; - } - reserved 2; - reserved 3; - reserved 4; - reserved 5; - // Whether to fuse filter transformations. - oneof optional_filter_fusion { - bool filter_fusion = 6; - } - // NOTE: field id 7 deleted in June 2021. - reserved 7; - // NOTE: field id 8 deleted in June 2021. - reserved 8; - // Whether to fuse map and batch transformations. - oneof optional_map_and_batch_fusion { - bool map_and_batch_fusion = 9; - } - // Whether to fuse map and filter transformations. - oneof optional_map_and_filter_fusion { - bool map_and_filter_fusion = 10; - } - // Whether to fuse map transformations. - oneof optional_map_fusion { - bool map_fusion = 11; - } - // Whether to parallelize stateless map transformations. - oneof optional_map_parallelization { - bool map_parallelization = 12; - } - - // NOTE: field id 13 deleted in June 2021. - reserved 13; - - // Whether to eliminate no-op transformations. - oneof optional_noop_elimination { - bool noop_elimination = 14; - } - // Whether to parallelize copying of batch elements. This optimization is - // highly experimental and can cause performance degradation (e.g. when the - // parallelization overhead exceeds the benefits of performing the data copies - // in parallel). You should only enable this optimization if a) your input - // pipeline is bottlenecked on batching and b) you have validated that this - // optimization improves performance. - oneof optional_parallel_batch { - bool parallel_batch = 15; - } - // Field id 16 was removed in 06/2021. - reserved 16; - // Whether to fuse shuffle and repeat transformations. - oneof optional_shuffle_and_repeat_fusion { - bool shuffle_and_repeat_fusion = 17; - } -} - -// next: 3 -message ThreadingOptions { - // If set, it overrides the maximum degree of intra-op parallelism. - oneof optional_max_intra_op_parallelism { - int32 max_intra_op_parallelism = 1; - } - // If set, the dataset will use a private threadpool of the given size. - oneof optional_private_threadpool_size { - int32 private_threadpool_size = 2; - } -} - -// Represents how to handle external state during serialization. -enum ExternalStatePolicy { - POLICY_WARN = 0; - POLICY_IGNORE = 1; - POLICY_FAIL = 2; -} - -// Message stored with Dataset objects to control how datasets are processed and -// optimized. -// -// next: 8 -message Options { - // Whether the outputs need to be produced in deterministic order. - oneof optional_deterministic { - bool deterministic = 1; - } - // The distribution strategy options associated with the dataset. - AutotuneOptions autotune_options = 7; - // The distribution strategy options associated with the dataset. - DistributeOptions distribute_options = 2; - // The optimization options associated with the dataset. - OptimizationOptions optimization_options = 3; - // Whether to introduce 'slack' in the last `prefetch` of the input pipeline, - // if it exists. This may reduce CPU contention with accelerator host-side - // activity at the start of a step. The slack frequency is determined by the - // number of devices attached to this input pipeline. - oneof optional_slack { - bool slack = 4; - } - // The threading options associated with the dataset. - ThreadingOptions threading_options = 5; - // This option can be used to override the default policy for how to handle - // external state when serializing a dataset or checkpointing its iterator. - // There are three settings available - IGNORE: External state is ignored - // without a warning; WARN: External state is ignored and a warning is logged; - // FAIL: External state results in an error. - oneof optional_external_state_policy { - ExternalStatePolicy external_state_policy = 6; - } -} diff --git a/navi/navi/proto/tensorflow/core/framework/device_attributes.proto b/navi/navi/proto/tensorflow/core/framework/device_attributes.proto deleted file mode 100644 index 5f568e255..000000000 --- a/navi/navi/proto/tensorflow/core/framework/device_attributes.proto +++ /dev/null @@ -1,58 +0,0 @@ -syntax = "proto3"; - -package tensorflow; - -option cc_enable_arenas = true; -option java_outer_classname = "DeviceAttributesProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/device_attributes_go_proto"; - -message InterconnectLink { - int32 device_id = 1; - string type = 2; - int32 strength = 3; -} - -message LocalLinks { - repeated InterconnectLink link = 1; -} - -message DeviceLocality { - // Optional bus locality of device. Default value of 0 means - // no specific locality. Specific localities are indexed from 1. - int32 bus_id = 1; - - // Optional NUMA locality of device. - int32 numa_node = 2; - - // Optional local interconnect links to other devices. - LocalLinks links = 3; -} - -message DeviceAttributes { - // Fully specified name of the device within a cluster. - string name = 1; - - // String representation of device_type. - string device_type = 2; - - // Memory capacity of device in bytes. - int64 memory_limit = 4; - - // Platform-specific data about device that may be useful - // for supporting efficient data transfers. - DeviceLocality locality = 5; - - // A device is assigned a global unique number each time it is - // initialized. "incarnation" should never be 0. - fixed64 incarnation = 6; - - // String representation of the physical device that this device maps to. - string physical_device_desc = 7; - - // A physical device ID for use in XLA DeviceAssignments, unique across - // clients in a multi-client setup. Set to -1 if unavailable, non-negative - // otherwise. - int64 xla_global_id = 8; -} diff --git a/navi/navi/proto/tensorflow/core/framework/full_type.proto b/navi/navi/proto/tensorflow/core/framework/full_type.proto deleted file mode 100644 index ddf05ec8f..000000000 --- a/navi/navi/proto/tensorflow/core/framework/full_type.proto +++ /dev/null @@ -1,276 +0,0 @@ -syntax = "proto3"; - -package tensorflow; - -option cc_enable_arenas = true; -option java_outer_classname = "FullTypeProtos"; -option java_multiple_files = true; -option java_package = "org.tensorflow.framework"; -option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework/full_type_go_proto"; - -// Experimental. Represents the complete type information of a TensorFlow value. -enum FullTypeId { - // The default represents an uninitialized values. - TFT_UNSET = 0; - - // Type symbols. Used to construct more complex type expressions like - // algebraic data types. - - // Type variables may serve as placeholder for any other type ID in type - // templates. - // - // Examples: - // TFT_DATASET[TFT_VAR["T"]] is a Dataset returning a type indicated by "T". - // TFT_TENSOR[TFT_VAR["T"]] is a Tensor of n element type indicated by "T". - // TFT_TENSOR[TFT_VAR["T"]], TFT_TENSOR[TFT_VAR["T"]] are two tensors of - // identical element types. - // TFT_TENSOR[TFT_VAR["P"]], TFT_TENSOR[TFT_VAR["Q"]] are two tensors of - // independent element types. - // - TFT_VAR = 1; - - // Wildcard type. Describes a parameter of unknown type. In TensorFlow, that - // can mean either a "Top" type (accepts any type), or a dynamically typed - // object whose type is unknown in context. - // Important: "unknown" does not necessarily mean undeterminable! - TFT_ANY = 2; - - // The algebraic product type. This is an algebraic type that may be used just - // for logical grouping. Not to confused with TFT_TUPLE which describes a - // concrete object of several elements. - // - // Example: - // TFT_DATASET[TFT_PRODUCT[TFT_TENSOR[TFT_INT32], TFT_TENSOR[TFT_FLOAT64]]] - // is a Dataset producing two tensors, an integer one and a float one. - // - TFT_PRODUCT = 3; - - // Represents a named field, with the name stored in the attribute. - // - // Parametrization: - // TFT_NAMED[]{} - // * is the type of the field - // * is the field name, as string (thpugh can theoretically be an int - // as well) - // - // Example: - // TFT_RECORD[ - // TFT_NAMED[TFT_TENSOR[TFT_INT32]]{'foo'}, - // TFT_NAMED[TFT_TENSOR[TFT_FLOAT32]]{'bar'}, - // ] - // is a structure with two fields, an int tensor "foo" and a float tensor - // "bar". - TFT_NAMED = 4; - - // Template definition. Expands the variables by repeating a template as - // arguments of container. - // - // Parametrization: - // TFT_FOR_EACH[,