ZettaAI / zetta_utils

MIT License
10 stars 0 forks source link

fix/typing(layer_set): Allow layer set read_proc to return single layer #761

Open nkemnitz opened 2 months ago

nkemnitz commented 2 months ago

Allows combining two layers with a read_proc, e.g. https://github.com/ZettaAI/specs/blob/main/nico/inference/chen_s1/11_fine_align_pairwise.cue#L196-L223

Already worked before, just the static type checker would complain.

nkemnitz commented 2 months ago

Tests fail to unrelated zetta_utils/internal/segmentation/embedding/utils.py:117: error: Argument 1 to "_compute_affinity" has incompatible type "ndarray[Any, dtype[Any]]"; expected "Tensor" [arg-type]

supersergiy commented 2 months ago

I think Ideally we would want to handle it in a way that would still keep the return type of layer set's __getitem__ predictable. With this change, every time a user reads from a layer set in python they would have to assert the expected return type. Let me think about this a bit...

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (056e9ad) to head (dc38ed6).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #761 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 142 142 Lines 5877 5877 ========================================= Hits 5877 5877 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.