Skip to content

ValueError when creating prediction pipeline with locally created model #443

Open

Description

@ElpadoCan

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.).

Activity

  1. FynnBe commented on Dec 13, 2024

    @FynnBe
    Member

    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.

  2. FynnBe commented on Dec 13, 2024

    @FynnBe
    Member

    oh, and thank you for reporting this!

  3. ElpadoCan commented on Dec 13, 2024

    @ElpadoCan
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions