modelfoxdotdev / modelfox

ModelFox makes it easy to train, deploy, and monitor machine learning models.
Other
1.46k stars 63 forks source link

implement `Into<PredictInputValue>` for more types #27

Closed joelchen closed 2 years ago

joelchen commented 2 years ago

I am getting E0277 following the advanced Rust example (https://github.com/tangramdotdev/tangram/blob/main/languages/rust/examples/advanced/main.rs):

the trait bound `PredictInputValue: From<i32>` is not satisfied
the following implementations were found:
  <PredictInputValue as From<&str>>
  <PredictInputValue as From<f32>>
  <PredictInputValue as From<f64>>
  <PredictInputValue as From<std::string::String>>
required because of the requirements on the impl of `Into<PredictInputValue>` for `i32` rustc(E0277)

There is also mismatched types error at predict_one.

Screenshot 2021-08-14 at 4 34 49 AM
% rustc -Vv
rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: aarch64-apple-darwin
release: 1.54.0
nitsky commented 2 years ago

@joelchen thanks for opening this issue. At the moment, we have only added From<T> impls for PredictInputValue for f32, f64, &str, and String. We should add impls for more types, including i32, so I will change the title of this issue appropriately. To fix your example in the meantime, change the type of height to f32, and convert any i32 values to f32 before constructing an Input.

nitsky commented 2 years ago

With #47 merged this issue should now be resolved.