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

Loading model resource gives assertion error #355

Open
jhennies opened this issue Oct 27, 2023 · 2 comments
Open

Loading model resource gives assertion error #355

jhennies opened this issue Oct 27, 2023 · 2 comments

Comments

@jhennies
Copy link
Contributor

The following code runs into an assertion error (extracted minimum example of a previously working implementation):

import bioimageio.core
rdf_doi = "10.5281/zenodo.7274275"
model_resource = bioimageio.core.load_resource_description(rdf_doi)

Output:

/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json. Skipping download of https://raw.githubusercontent.com/bioimage-io/bioimage.io/main/site.config.json.
  warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/bioimage-io.github.io/collection-bioimage-io/collection.json. Skipping download of https://bioimage-io.github.io/collection-bioimage-io/collection.json.
  warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:437: CacheWarning: found cached /tmp/julian/bioimageio_cache/https/bioimage-io.github.io/collection-bioimage-io/rdfs/10.5281/zenodo.7274275/8123818/rdf.yaml. Skipping download of https://bioimage-io.github.io/collection-bioimage-io/rdfs/10.5281/zenodo.7274275/8123818/rdf.yaml.
  warnings.warn(f"found cached {local_path}. Skipping download of {uri}.", category=CacheWarning)
/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/_resolve_source.py:439: CacheWarning: Reached cache warnings limit. No more warnings about cache hits will be issued.
  warnings.warn(
Traceback (most recent call last):
  File "/home/julian/.config/JetBrains/PyCharmCE2021.3/scratches/scratch.py", line 5, in <module>
    model_resource = bioimageio.core.load_resource_description(rdf_doi)
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/io_.py", line 57, in load_resource_description
    rd: ResourceDescription = resolve_raw_node(raw_rd=raw_rd, nodes_module=nodes)
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/utils.py", line 122, in resolve_raw_node
    rd = SourceNodeTransformer().transform(rd)
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
    return transformer(node, **kwargs)  # noqa
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in generic_transformer
    node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in <dictcomp>
    node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
    return transformer(node, **kwargs)  # noqa
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 65, in transform_dict
    return {key: self.transform(value, **kwargs) for key, value in node.items()}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 65, in <dictcomp>
    return {key: self.transform(value, **kwargs) for key, value in node.items()}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
    return transformer(node, **kwargs)  # noqa
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in generic_transformer
    node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 145, in <dictcomp>
    node, **{name: self.transform(value, **kwargs) for name, value in iter_fields(node)}
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/spec/shared/node_transformer.py", line 56, in transform
    return transformer(node, **kwargs)  # noqa
  File "/home/julian/miniconda3/envs/cebra-em-all-env2/lib/python3.9/site-packages/bioimageio/core/resource_io/utils.py", line 84, in transform_ResolvedImportableSourceFile
    assert importlib_spec is not None
AssertionError

I tried with bioimageio.core v0.5.8, then with the latest release v0.5.9 and also with a fresh conda environment installed with create -n tmp-env -c conda-forge bioimageio.core

I also tried with some other models yielding the same error.

Any help is appreciated

@FynnBe
Copy link
Member

FynnBe commented Oct 30, 2023

@jhennies thank you for reporting this issue. I'm able to reproduce it and hopefully have it fixed soon.
I suspect it's related to the recent Zenodo API changes.

@FynnBe
Copy link
Member

FynnBe commented Oct 31, 2023

fixed by bioimage-io/spec-bioimage-io#536

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

No branches or pull requests

2 participants