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

Avoid downloading sample input and output for inference #451

Open
qin-yu opened this issue Jan 24, 2025 · 6 comments
Open

Avoid downloading sample input and output for inference #451

qin-yu opened this issue Jan 24, 2025 · 6 comments

Comments

@qin-yu
Copy link

qin-yu commented Jan 24, 2025

If I want to use core for inference, the model will be downloaded along with the sample input and output, which are unnecessary.

@FynnBe
Copy link
Member

FynnBe commented Jan 27, 2025

if you want to circumvent these additional downloads you can use perform_io_checks=False:

with ValidationContext(perform_io_checks=False):
    model_descr = load_model_description("affable-shark")

This will not download anything other than the rdf.yaml.
You can still use the resulting model description to run inference with core (it will then download weights on demand).

@qin-yu
Copy link
Author

qin-yu commented Jan 27, 2025

Thanks! Trying it.

@FynnBe FynnBe closed this as completed Jan 27, 2025
@qin-yu
Copy link
Author

qin-yu commented Jan 27, 2025

Hi @FynnBe, I don't think with ValidationContext(perform_io_checks=False): is the right way to do it:

I used your fix in my PlantSeg branch, but it seems that everything is still downloaded when GitHub Action runs the tests, e.g. the "Run Tests with PyTest" part.

@qin-yu qin-yu reopened this Jan 27, 2025
@qin-yu
Copy link
Author

qin-yu commented Jan 27, 2025

Could you explain what is the difference between:

with ValidationContext(perform_io_checks=False):  # method 1
    model_descr = load_model_description("affable-shark")

and

model = load_model_description(model_id, perform_io_checks=False)  # method 2

It seems that method 2 may work while method 1 doesn't.

@qin-yu
Copy link
Author

qin-yu commented Jan 27, 2025

I used your fix in my PlantSeg branch, but it seems that everything is still downloaded when GitHub Action runs the tests, e.g. the "Run Tests with PyTest" part.

I confirm that method 1 and 2 have different results, according to the new CI run.

@FynnBe
Copy link
Member

FynnBe commented Jan 28, 2025

oh sorry, yes using the context currently does not work for load_description (and load_model_description) as the default is set to the environment variable and not taken from the active context... sorry about that. I'll fix it in the next release!

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