From c89cf14d96bd40254561595e524e095d2a34e74b Mon Sep 17 00:00:00 2001 From: rfast Date: Tue, 24 Oct 2023 13:22:12 -0500 Subject: [PATCH] more crap --- .devcontainer/Dockerfile | 1 + .gitignore | 3 +- .vscode/launch.json | 8 +- Cargo.lock | 172 +++++++++++++++++++++++------- examples/pytorch-resnet/README.md | 2 + ferrix-cli/src/main.rs | 23 ++-- ferrix-model-api/Cargo.toml | 2 +- ferrix-model-api/src/internal.rs | 19 +--- ferrix-model-api/src/lib.rs | 2 +- ferrix-model-candle/src/lib.rs | 2 +- ferrix-model-onnx/src/lib.rs | 2 +- ferrix-model-pytorch/src/lib.rs | 4 +- ferrix-protos/Cargo.toml | 9 +- ferrix-python-hooks/Cargo.toml | 4 +- ferrix-python-hooks/src/lib.rs | 6 +- ferrix-python/Cargo.toml | 2 +- ferrix-python/pyproject.toml | 1 + ferrix-server/Cargo.toml | 6 +- ferrix-server/src/inference.rs | 9 +- ferrix-server/src/lib.rs | 4 +- 20 files changed, 188 insertions(+), 93 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 149b892..f06faf9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1 +1,2 @@ FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/rust:1-1-bullseye +RUN apt-get update && apt-get install -y python3 diff --git a/.gitignore b/.gitignore index 212de44..2f791d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -.DS_Store \ No newline at end of file +.DS_Store +.idea diff --git a/.vscode/launch.json b/.vscode/launch.json index c8707b5..945d9eb 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -140,15 +140,15 @@ { "type": "lldb", "request": "launch", - "name": "Debug executable 'ferrix'", + "name": "Debug executable 'ferrix-cli'", "cargo": { "args": [ "build", - "--bin=ferrix", - "--package=ferrix" + "--bin=ferrix-cli", + "--package=ferrix-cli" ], "filter": { - "name": "ferrix", + "name": "ferrix-cli", "kind": "bin" } }, diff --git a/Cargo.lock b/Cargo.lock index a3e5de4..83a7923 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,6 +73,28 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.32", +] + [[package]] name = "async-trait" version = "0.1.73" @@ -634,14 +656,13 @@ name = "ferrix-protos" version = "0.1.0" dependencies = [ "axum", - "prost", - "prost-build", + "prost 0.12.1", + "prost-build 0.12.1", "protoc-bin-vendored", - "pyo3", "serde", "tokio", "tonic", - "tonic-build", + "tonic-build 0.10.2", ] [[package]] @@ -671,13 +692,13 @@ dependencies = [ "ferrix-model-api", "ferrix-protos", "ferrix-python-hooks", - "prost", - "prost-build", + "prost 0.12.1", + "prost-build 0.12.1", "protoc-bin-vendored", "serde", "tokio", "tonic", - "tonic-build", + "tonic-build 0.9.2", ] [[package]] @@ -959,9 +980,9 @@ dependencies = [ [[package]] name = "indoc" -version = "1.0.9" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" [[package]] name = "inout" @@ -1192,9 +1213,9 @@ dependencies = [ [[package]] name = "numpy" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "437213adf41bbccf4aeae535fbfcdad0f6fed241e1ae182ebe97fa1f3ce19389" +checksum = "bef41cbb417ea83b30525259e30ccef6af39b31c240bda578889494c5392d331" dependencies = [ "libc", "ndarray", @@ -1353,6 +1374,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.32", +] + [[package]] name = "proc-macro2" version = "1.0.66" @@ -1369,7 +1400,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.11.9", +] + +[[package]] +name = "prost" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +dependencies = [ + "bytes", + "prost-derive 0.12.1", ] [[package]] @@ -1385,15 +1426,37 @@ dependencies = [ "log", "multimap", "petgraph", - "prettyplease", - "prost", - "prost-types", + "prettyplease 0.1.25", + "prost 0.11.9", + "prost-types 0.11.9", "regex", "syn 1.0.109", "tempfile", "which", ] +[[package]] +name = "prost-build" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" +dependencies = [ + "bytes", + "heck", + "itertools", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease 0.2.15", + "prost 0.12.1", + "prost-types 0.12.1", + "regex", + "syn 2.0.32", + "tempfile", + "which", +] + [[package]] name = "prost-derive" version = "0.11.9" @@ -1407,13 +1470,35 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "prost-derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 2.0.32", +] + [[package]] name = "prost-types" version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "prost", + "prost 0.11.9", +] + +[[package]] +name = "prost-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" +dependencies = [ + "prost 0.12.1", ] [[package]] @@ -1468,9 +1553,9 @@ checksum = "9653c3ed92974e34c5a6e0a510864dab979760481714c172e0a34e437cb98804" [[package]] name = "pyo3" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb88ae05f306b4bfcde40ac4a51dc0b05936a9207a4b75b798c7729c4258a59" +checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b" dependencies = [ "cfg-if", "indoc", @@ -1485,9 +1570,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "554db24f0b3c180a9c0b1268f91287ab3f17c162e15b54caaae5a6b3773396b0" +checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5" dependencies = [ "once_cell", "target-lexicon", @@ -1495,9 +1580,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922ede8759e8600ad4da3195ae41259654b9c55da4f7eec84a0ccc7d067a70a4" +checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b" dependencies = [ "libc", "pyo3-build-config", @@ -1505,25 +1590,26 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a5caec6a1dd355964a841fcbeeb1b89fe4146c87295573f94228911af3cc5a2" +checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 1.0.109", + "syn 2.0.32", ] [[package]] name = "pyo3-macros-backend" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b78ccbb160db1556cdb6fd96c50334c5d4ec44dc5e0a968d0a1208fa0efa8b" +checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424" dependencies = [ + "heck", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.32", ] [[package]] @@ -2121,16 +2207,15 @@ dependencies = [ [[package]] name = "tonic" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ + "async-stream", "async-trait", "axum", "base64", "bytes", - "futures-core", - "futures-util", "h2", "http", "http-body", @@ -2138,7 +2223,7 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost", + "prost 0.12.1", "tokio", "tokio-stream", "tower", @@ -2153,13 +2238,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" dependencies = [ - "prettyplease", + "prettyplease 0.1.25", "proc-macro2", - "prost-build", + "prost-build 0.11.9", "quote", "syn 1.0.109", ] +[[package]] +name = "tonic-build" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +dependencies = [ + "prettyplease 0.2.15", + "proc-macro2", + "prost-build 0.12.1", + "quote", + "syn 2.0.32", +] + [[package]] name = "torch-sys" version = "0.14.0" @@ -2281,9 +2379,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unindent" -version = "0.1.11" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "untrusted" diff --git a/examples/pytorch-resnet/README.md b/examples/pytorch-resnet/README.md index 717297b..f2f29e3 100644 --- a/examples/pytorch-resnet/README.md +++ b/examples/pytorch-resnet/README.md @@ -1,5 +1,7 @@ # PyTorch Resnet Example +This doesn't work yet + To run: ``` diff --git a/ferrix-cli/src/main.rs b/ferrix-cli/src/main.rs index 9636677..03a9116 100644 --- a/ferrix-cli/src/main.rs +++ b/ferrix-cli/src/main.rs @@ -1,6 +1,6 @@ use clap::Parser; -use ferrix_model_api::{Model, ModelConfig}; +use ferrix_model_api::ModelConfig; use ferrix_model_pytorch::*; use ferrix_server::inference::{Inference, InferenceConfig}; use ferrix_server::GrpcInferenceServiceImpl; @@ -16,9 +16,9 @@ struct Config { #[arg(short, long, default_value = "./ferrix.toml")] model_config: String, - /// Path to Ferrix model configuration - #[arg(short, long, default_value = "./handler.py")] - handler: String, + /// Path to Ferrix transformer Python file + #[arg(short, long, default_value = "/workspaces/ferrix/examples/pytorch-resnet/handler.py")] + transformer: String, } #[tokio::main] @@ -26,19 +26,24 @@ async fn main() { let config = Config::parse(); let model_config = toml::from_str::( r#" - base_path: blah.pt + base_path = "/workspaces/ferrix/ferrix-model-pytorch/resource/model.pt" + model_name = "Blah" "#, ) .unwrap(); - let handler_path = if std::path::Path::new(&config.handler).exists() { - Some(config.handler) + let handler_path = if std::path::Path::new(&config.transformer).exists() { + Some(config.transformer) } else { None }; let model = PyTorchModel::new(model_config); let boxed_model = Box::new(model); - let inference = Inference::new(InferenceConfig { handler_path }, boxed_model); + let mut inference = Inference::new(InferenceConfig { handler_path }, boxed_model); + let _ = inference.load(); let service = GrpcInferenceServiceImpl::with_model(inference); - let _ = ferrix_server::serve(config.port, service).await; + match ferrix_server::serve(config.port, service).await { + Ok(()) => println!("Ferrix started"), + Err(err) => println!("Error! {}", err.to_string()) + } } diff --git a/ferrix-model-api/Cargo.toml b/ferrix-model-api/Cargo.toml index 580735d..6a9694b 100644 --- a/ferrix-model-api/Cargo.toml +++ b/ferrix-model-api/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] anyhow = "1.0.75" ferrix-protos = { path = "../ferrix-protos" } -pyo3 = "0.19.1" +pyo3 = "0.20.0" serde = "1.0.188" thiserror = "1.0.43" toml = "0.8.2" diff --git a/ferrix-model-api/src/internal.rs b/ferrix-model-api/src/internal.rs index f0882a2..0bbae49 100644 --- a/ferrix-model-api/src/internal.rs +++ b/ferrix-model-api/src/internal.rs @@ -219,8 +219,7 @@ impl InputTensor { .map(|(key, value)| (key.to_string(), Parameter::from_proto(value))) .collect::>(), data: TensorData::from_proto( - request.datatype.clone(), - request.contents.as_ref().unwrap(), + request.contents.as_ref().unwrap() ), } } @@ -291,7 +290,6 @@ impl OutputTensor { .map(|(key, value)| (key.to_string(), Parameter::from_proto(value))) .collect::>(), data: TensorData::from_proto( - response.datatype.clone(), response.contents.as_ref().unwrap(), ), } @@ -371,7 +369,7 @@ impl TensorData { } } - fn from_proto(datatype: String, contents: &InferTensorContents) -> Self { + fn from_proto(contents: &InferTensorContents) -> Self { let data = contents.clone(); TensorData { bool_contents: data.bool_contents.clone(), @@ -385,19 +383,6 @@ impl TensorData { } } - fn to_proto(self) -> InferTensorContents { - let mut contents = InferTensorContents::default(); - - contents.bool_contents = self.bool_contents.clone(); - contents.bytes_contents = self.bytes_contents.clone(); - contents.fp32_contents = self.fp32_contents.clone(); - contents.fp64_contents = self.fp64_contents.clone(); - contents.int_contents = self.int_contents.clone(); - contents.int64_contents = self.int64_contents.clone(); - - contents - } - pub fn from_bytes(datatype: String, bytes: &[u8]) -> Self { let mut data = TensorData::default(); diff --git a/ferrix-model-api/src/lib.rs b/ferrix-model-api/src/lib.rs index 1b6b1f5..91de41a 100644 --- a/ferrix-model-api/src/lib.rs +++ b/ferrix-model-api/src/lib.rs @@ -9,7 +9,7 @@ pub mod python; pub trait Model: Send + Sync { fn load(&mut self) -> ModelResult<()>; fn loaded(&self) -> bool; - fn predict(&self, request: InferRequest) -> ModelResult; + fn predict(&self, request: &InferRequest) -> ModelResult; } #[derive(Deserialize)] diff --git a/ferrix-model-candle/src/lib.rs b/ferrix-model-candle/src/lib.rs index b8625f0..0fac795 100644 --- a/ferrix-model-candle/src/lib.rs +++ b/ferrix-model-candle/src/lib.rs @@ -27,7 +27,7 @@ impl Model for CandleModel { fn predict( &self, - request: InferRequest, + request: &InferRequest, ) -> ferrix_model_api::ModelResult { let tensor: CandleTensor = request .inputs diff --git a/ferrix-model-onnx/src/lib.rs b/ferrix-model-onnx/src/lib.rs index ba5ff5b..9be11b6 100644 --- a/ferrix-model-onnx/src/lib.rs +++ b/ferrix-model-onnx/src/lib.rs @@ -20,7 +20,7 @@ impl Model for OnnxModel { fn predict( &self, - request: ferrix_model_api::internal::InferRequest, + request: &ferrix_model_api::internal::InferRequest, ) -> ferrix_model_api::ModelResult { let environment = Environment::builder() .with_name("GPT-2") diff --git a/ferrix-model-pytorch/src/lib.rs b/ferrix-model-pytorch/src/lib.rs index 180bbe3..69fbc59 100644 --- a/ferrix-model-pytorch/src/lib.rs +++ b/ferrix-model-pytorch/src/lib.rs @@ -47,7 +47,7 @@ impl Model for PyTorchModel { return self.module.take(SeqCst).is_some(); } - fn predict(&self, request: InferRequest) -> ModelResult { + fn predict(&self, request: &InferRequest) -> ModelResult { let pt_tensors: Vec = request .inputs .iter() @@ -175,7 +175,7 @@ mod tests { data: tensor_data, }], }; - let result = model.predict(request); + let result = model.predict(&request); match result { Ok(response) => assert!(response.outputs.first().is_some()), diff --git a/ferrix-protos/Cargo.toml b/ferrix-protos/Cargo.toml index 8755c53..20d07f8 100644 --- a/ferrix-protos/Cargo.toml +++ b/ferrix-protos/Cargo.toml @@ -4,14 +4,13 @@ version = "0.1.0" edition = "2021" [dependencies] -prost = "0.11.9" -tonic = "0.9.2" +prost = "0.12.1" +tonic = "0.10.2" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } axum = "0.6.18" serde = { version = "1.0.164", features = ["derive"] } -pyo3 = "0.19.1" [build-dependencies] -prost-build = "0.11.9" +prost-build = "0.12.1" protoc-bin-vendored = "3.0.0" -tonic-build = "0.9.2" +tonic-build = "0.10.2" diff --git a/ferrix-python-hooks/Cargo.toml b/ferrix-python-hooks/Cargo.toml index 48f40b6..bfb5e0a 100644 --- a/ferrix-python-hooks/Cargo.toml +++ b/ferrix-python-hooks/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -pyo3 = "0.19.1" +pyo3 = "0.20.0" ferrix-model-api = { path = "../ferrix-model-api" } ferrix-protos = { path = "../ferrix-protos" } -numpy = "0.19.0" +numpy = "0.20.0" once_cell = "1.18.0" diff --git a/ferrix-python-hooks/src/lib.rs b/ferrix-python-hooks/src/lib.rs index ed16a9c..9be5d72 100644 --- a/ferrix-python-hooks/src/lib.rs +++ b/ferrix-python-hooks/src/lib.rs @@ -48,7 +48,11 @@ pub fn eval(code: String) { pyo3::append_to_inittab!(ferrix); pyo3::prepare_freethreaded_python(); - Python::with_gil(|py| py.run(&code, None, None).unwrap()) + Python::with_gil(|py| { + println!("Python version: {}", py.version()); + + py.run(&code, None, None).unwrap() + }) } pub fn preprocess(input: InferRequest) -> PyResult { diff --git a/ferrix-python/Cargo.toml b/ferrix-python/Cargo.toml index 9834e49..522bd52 100644 --- a/ferrix-python/Cargo.toml +++ b/ferrix-python/Cargo.toml @@ -11,4 +11,4 @@ name = "ferrix" crate-type = ["cdylib"] [dependencies] -pyo3 = "0.19.0" +pyo3 = "0.20.0" diff --git a/ferrix-python/pyproject.toml b/ferrix-python/pyproject.toml index 5a323d9..1c77bb8 100644 --- a/ferrix-python/pyproject.toml +++ b/ferrix-python/pyproject.toml @@ -14,3 +14,4 @@ classifiers = [ [tool.maturin] python-source = "python" features = ["pyo3/extension-module"] +bindings = "bin" \ No newline at end of file diff --git a/ferrix-server/Cargo.toml b/ferrix-server/Cargo.toml index d062711..c8a9053 100644 --- a/ferrix-server/Cargo.toml +++ b/ferrix-server/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -prost = "0.11.9" -tonic = "0.9.2" +prost = "0.12.1" +tonic = "0.10.2" tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } axum = "0.6.18" serde = { version = "1.0.164", features = ["derive"] } @@ -15,6 +15,6 @@ ferrix-python-hooks = { path = "../ferrix-python-hooks" } async-trait = "0.1.73" [build-dependencies] -prost-build = "0.11.9" +prost-build = "0.12.1" protoc-bin-vendored = "3.0.0" tonic-build = "0.9.2" diff --git a/ferrix-server/src/inference.rs b/ferrix-server/src/inference.rs index b8342b2..b8a41d3 100644 --- a/ferrix-server/src/inference.rs +++ b/ferrix-server/src/inference.rs @@ -1,9 +1,6 @@ -use async_trait::async_trait; use ferrix_model_api::{Model, ModelResult, internal::{InferRequest, InferResponse}}; use ferrix_python_hooks::{eval, postprocess, preprocess}; -use std::future::Future; - pub struct Inference { hooks_enabled: bool, model: Box, @@ -21,7 +18,9 @@ impl Inference { let handler_path = config.handler_path.unwrap(); let code = std::fs::read_to_string(handler_path).unwrap(); + println!("BuTt"); eval(code); + println!("SnaKe"); } Inference { @@ -30,7 +29,7 @@ impl Inference { } } - pub fn load(&mut self) -> ferrix_model_api::ModelResult<()> { + pub fn load(&mut self) -> ModelResult<()> { self.model.load() } @@ -47,7 +46,7 @@ impl Inference { false => request, }; - let response = self.model.predict(input)?; + let response = self.model.predict(&input)?; let output = match self.hooks_enabled { true => postprocess(response)?, diff --git a/ferrix-server/src/lib.rs b/ferrix-server/src/lib.rs index f6c413a..00223bc 100644 --- a/ferrix-server/src/lib.rs +++ b/ferrix-server/src/lib.rs @@ -96,13 +96,13 @@ impl GrpcInferenceService for GrpcInferenceServiceImpl { } } -pub async fn serve( +pub async fn serve( port: i16, service: GrpcInferenceServiceImpl, ) -> Result<(), Box> { let addr = format!("[::1]:{}", port).parse().unwrap(); - println!("GreeterServer listening on {}", addr); + println!("Ferrix listening on {}", addr); Server::builder() .add_service(GrpcInferenceServiceServer::new(service))