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

Fix pytorch_state_dict import from library #378

Merged
merged 1 commit into from
Apr 25, 2024

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
13 checks passed
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