brianjjones opened PR #3977 from tf_runtime_linked
to main
:
Users will now be able to use either OpenVino or
Tensorflow for their backend.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones has marked PR #3977 as ready for review.
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Could both be made optional so you could include just one if necessary rather than forcing both?
bjorn3 submitted PR review.
bjorn3 created PR review comment:
Can this cause reading outside of dirs that the wasm module is given access to using a path like
../../../etc/passwd
? Wouldn't it be better to provide the model as a byte array just like for the openvino backend?
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
It looks like only the first builder array is used below?
abrown created PR review comment:
op_x, op_output,
abrown created PR review comment:
This doesn't look right:
input_1
andPredictions
seem like names for nodes in a specific model. This needs to work for any model, usingset_input
andset_output
to pass in the tensor data.
abrown created PR review comment:
backend.load(builders, target, &self.map_dir)?;
abrown created PR review comment:
if let Some(dir) = map_dir {
I think this would mean that
unmap
could go away below.
abrown created PR review comment:
This is limited to a single input and likely shouldn't be performed here. Perhaps
SessionRunArgs
should be stored on the context andadd_feed
called inset_input
?
abrown created PR review comment:
This looks like it should happen in
set_output
.
abrown created PR review comment:
let mut args = SessionRunArgs::new();
Here and elsewhere: it seems like there is some extra code in this file that could be removed. Maybe try running
cargo clippy
on this file to see what it advises?
abrown created PR review comment:
Unused... remove?
abrown created PR review comment:
To interface with the wasi-nn API, we must have an ordered set of outputs for the user to be able to index into. I see that SignatureDef::outputs() is available, but this does not provide a reliable order. In any case,
index
should be used here to retrieve one of the possibly-multiple outputs.
abrown created PR review comment:
Is this a constant for all models?
abrown created PR review comment:
The entire wasi-nn module can be turned on and off; @brianjjones has worked on https://github.com/tensorflow/rust/pull/354 to make sure this code path should work regardless of whether TF libraries are present on the system.
My concern here is that, until the
tensorflow
crate releases a new version with that PR's changes, we should fix this dependency to a specific commit to avoid any upstream issues.
abrown created PR review comment:
This seems incorrect: not all output tensors will be of f32 type.
abrown created PR review comment:
The saved model API does not appear to provide a way to use bytes; ideally it would, though, so maybe it is worthwhile opening an issue in the tensorflow repository.
But @bjorn3's comment is a good one in that it highlights whether this is indeed correct. It doesn't seem so: a) shouldn't a user be allowed to
--map-dirs guest/foo:host/bar
and then ask wasi-nn to load the model at directoryguest/foo/my/model
(translated tohost/bar/my/model
? b) if this is the case, then this code will need to learn how to prevent escapes like @bjorn3 mentions, e.g.,../../../etc/password
.I would propose that
map_dirs
be converted fromVec<(String, String)>
toVec<MappedDir>
so thatMappedDir
can be the one place to hold this logic.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
This should probably be a version released on crates.io.
abrown created PR review comment:
What I mean is that we should check
if builders.len() != 1
...
abrown created PR review comment:
self.map_dir = paths.clone();
I think it should just work to clone the entire vector. And we might as well just switch to using
Vec
as the struct type since one can detect the presence of mapped directories withis_empty()
; why re-wrap in anOption
?
abrown created PR review comment:
This seems to be information injected when the model was saved; I don't think it will always be
"serve"
?
abrown created PR review comment:
I'm not sure I understand why...
abrown updated PR #3977 from tf_runtime_linked
to main
.
abrown updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
abrown submitted PR review.
abrown submitted PR review.
abrown created PR review comment:
We should run the TF example here as well.
abrown created PR review comment:
Can this train image be reliably retrieved from the Internet? If so, that might be better than including it in tree (below).
abrown created PR review comment:
Looks like some updates are needed once a new version of the bindings crate is published... which is needed for CI to pass as well, I think.
abrown created PR review comment:
Isn't there already a crate to do this?
abrown created PR review comment:
We don't need to know about OpenVINO here and I think the
--features wasi-nn
is enabled by default so it is probably not necessary.
abrown created PR review comment:
It's unclear to me why we can't just fetch the output as a
&[u8]
and thencopy_from_slice
down below. This code does two copies!
abrown created PR review comment:
It's unclear to me why
copy_from_slice
has been replaced by all of these match cases?
abrown created PR review comment:
I think this custom comma-delimited parsing should be removed like we talked about.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
brianjjones updated PR #3977 from tf_runtime_linked
to main
.
Last updated: Dec 23 2024 at 13:07 UTC