Skip to content

Conversation

jdeschamps
Copy link
Member

@jdeschamps jdeschamps commented Apr 24, 2024

Issue

PyTorchModelAdaptor passes a sha256 keyword to the callable responsible for instantiating the model:

If the callable is an ArchitectureFromLibraryDescr, then an error will be raised since there is no kwargs in the function signature:

def _(node: ArchitectureFromLibraryDescr) -> Callable[..., Any]:

Fix

Add kwargs to the function signature (and that of other callables).

node: ArchitectureFromLibraryDescr, **kwargs: Unpack[HashKwargs]

SIde note

The pre-commit hooks forced me to fix an import, is it due to me not having the right version of the specs?

from bioimageio.spec._internal.io import HashKwargs, download

@jdeschamps jdeschamps requested a review from FynnBe April 25, 2024 10:50
@FynnBe
Copy link
Member

FynnBe commented Apr 25, 2024

The pre-commit hooks forced me to fix an import, is it due to me not having the right version of the specs?

no, not sure why this wasn't picked up before.. I suppose it was a ruff check? the fix is good anyway.

@FynnBe
Copy link
Member

FynnBe commented Apr 25, 2024

nice fix!
sad that singledispatch does play nice with static type checking... we should probably remove it in favor of some if else switch to have this part statically checked.

@FynnBe FynnBe merged commit 60b1625 into bioimage-io:main Apr 25, 2024
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.

2 participants