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

ValueError when creating prediction pipeline with locally created model #443

Open
ElpadoCan opened this issue Dec 13, 2024 · 3 comments
Open

Comments

@ElpadoCan
Copy link

When I try to run a prediction from a zip source file that I created locally I get a ValueError (full traceback below).

The model was created from scratch locally and validation_summary.display() shows that everything is fine.

To replicate you can run this minimal script where path_to_zip_file should be replaced with the path of the zip file you can download from here. This is also the same model I recently uploaded on model zoo website.

import bioimageio.core
MODEL_SOURCE = 'path_to_zip_file'
model_descr = bioimageio.core.load_model_description(MODEL_SOURCE)
prediction_pipeline = bioimageio.core.create_prediction_pipeline(
        model_descr
)

Traceback:

Traceback (most recent call last):
  File "d:\OneDrive\01_Postdoc_HMGU\GitHub\spotMAX_v2\spotmax\BioImageIO\test_any_model_script.py", line 72, in <module>
    main()
  File "d:\OneDrive\01_Postdoc_HMGU\GitHub\spotMAX_v2\spotmax\BioImageIO\test_any_model_script.py", line 55, in main
    prediction_pipeline = bioimageio.core.create_prediction_pipeline(
  File "C:\Users\Francesco\miniforge3\envs\acdc\lib\site-packages\bioimageio\core\_prediction_pipeline.py", line 351, in create_prediction_pipeline
    model_adapter = model_adapter or create_model_adapter(
  File "C:\Users\Francesco\miniforge3\envs\acdc\lib\site-packages\bioimageio\core\model_adapters\_model_adapter.py", line 137, in create
    raise ValueError(
ValueError: The 'pytorch_state_dict' model adapter could not be created in this environment:
AttributeError('Path' object has no attribute 'seek'. You can only torch.load from a file that is seekable. Please pre-load the data into a buffer like io.BytesIO and try to load 
from it instead.).
@FynnBe
Copy link
Member

FynnBe commented Dec 13, 2024

so sorry for the inconvenience! This is a known bug that I have fixed already, but I'm still finishing the next core release that will include it. I'll ping you here if that one is released then it should work.
In the mean-time please unzip beforehand and point to the folder or the rdf.yaml file in it.

@FynnBe
Copy link
Member

FynnBe commented Dec 13, 2024

oh, and thank you for reporting this!

@ElpadoCan
Copy link
Author

Oh ok, easy fix anyway, thanks! Feel free to close this issue whenever you want, thanks!

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