-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove interface model info #215
Conversation
- It is useful for tensors to contain the information of the spec id, that corresponds to the bioimage tensor spec, to be aware of valid shapes for both inputs and output
a242db4
to
fcf3cdb
Compare
fcf3cdb
to
127d162
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see ModelInfo
gone. I'm sure this will simplify future developments quite a bit. Also, awesome to see some green tests :)
I had a few comments. I guess in summary there is a lot of code that is concerned with validation of the spec. I have not checked the spec library, but is this where the spec is lacking and you implemented a hardened check?
I also appreciate small details, like adding parameter names which makes things so much easier to read.
- Use the class `Sample` to associate xr.DataArray with tensor id coming from the model - Do the checks only from the client side - Add checking about axes validity - Add tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is almost there - my only issue really is holding a reference to prediction pipeline in the model session, which is not really needed for shape validation.
4343a07
to
85a4c8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this looks good. Your changes improved readability for me and it's great that shapes of tensors will now be validated before feeding them through the network :)
tiktorch/converters.py
Outdated
return Sample({tensor.tensorId: pb_tensor_to_xarray(tensor) for tensor in pb_tensors}) | ||
|
||
@classmethod | ||
def from_xr_tensors(cls, tensor_ids: List[str], tensors_data: List[xr.DataArray]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def from_xr_tensors(cls, tensor_ids: List[str], tensors_data: List[xr.DataArray]): | |
def from_xr_tensors(cls, tensor_ids: List[str], tensors_data: List[xr.DataArray]) -> Sample: |
for completeness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I have to add pyright in the pre-commit hooks, so we can catch these as well. Thank you for point it out :)
… bio model client
85a4c8c
to
da79ae0
Compare
Nice! Thank you very much for the review @k-dominik. It was very insightful :) |
Following up the discussion #213 (review), we have decided that there is no need to maintain an additional abstract layer in tiktorch (
ModelInfo
) as a bioimage io interface, because tiktorch and ilastik are tightly coupled with bioimage spec and core.Thus, in this PR,
ModelInfo
was removed. The information provided by theModelInfo
, now is represented by the actual bioimage io interface, and more specifically thePredictionPipeline
that contains all the information needed for shapes, axes, names for input and output tensors.The
PredictionPipeline
as the new entity, is exposed both from the client and the server, when we initiate a model session process.Althoug the plan is to migrate to spec v5, spec v4 (#212 (comment)) with the concept of parameterized and explicit shape inputs, could be still useful as a baseline. Thus I have added some checks to validate the shapes of the incoming tensors based on the valid shapes provided by the v4 of
PredictionPipeline
. These checks will be also useful for the upcoming PR of checking GPU out-of-memory