Skip to content
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

Enhance ScriptModelConfig to validate and infer missing configuration… #21

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

rhoadesScholar
Copy link
Member

… attributes

@rhoadesScholar rhoadesScholar self-assigned this Jan 30, 2025
@rhoadesScholar rhoadesScholar marked this pull request as ready for review January 30, 2025 23:10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i didn't get the point of the pyramid test if key not found check different key. i think the user should give a specific one key value altribute, if not evailable then he gets an error. we can't use this logic as we can never handle all the possible keys

Copy link
Member Author

@rhoadesScholar rhoadesScholar Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mzouink If we want a strict schema, can we use the one already employed by the cellmap-segmentation-challenge, which groups the input and output array info (shape/scale)?:

input_array_info = {
    "shape": <input shape>,
    "scale": <input voxel size>
}
target_array_info = {
    "shape": <model output shape>,
    "scale": <model output voxel size>
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that seems ok to me, since we haven't really decided on an enforced schema yet.

Copy link
Member Author

@rhoadesScholar rhoadesScholar Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or I can make it work for either your old way or the CSC schema?

In the initial PR I tried to make it as universal an adapter as reasonable, combining the conventions you had been using with CSC conventions. So I allowed split definitions or unified (input_array_info["shape"] vs. just read_shape), as well as "scale" vs. "voxel_size" keywords in *_array_info dicts. seems user friendly to me, but too loose for @mzouink it seems 🙃

@rhoadesScholar
Copy link
Member Author

rhoadesScholar commented Jan 31, 2025

I forced the ScriptModelConfig parsing to require 1 of 2 schemas or a mix of the two that yields the complete necessary description:

read_shape = ...
input_voxel_size = ...
output_voxel_size = ...

# below can optionally be inferred if a PyTorch model is supplied:
write_shape = ...
output_channels = ...
block_shape = ...
input_array_info = {
    "shape": <input shape>,
    "scale": <input voxel size>
}
target_array_info = {
    "shape": <model output shape>,
    "scale": <model output voxel size>
}

What do you say @mzouink / @davidackerman ?

@mzouink
Copy link
Member

mzouink commented Jan 31, 2025

good for me. feel free to go through config loader and the examples existing and change them to the new schema
Will be nice if you can add the schema to the docs

@rhoadesScholar
Copy link
Member Author

most of the examples require fly_organelles, but that's not an obviously installable requirement... I'm only going to change the model_setup04.py to the new schema since I think the others should be retired from main imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants