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

LMInferer should be instantiated with a model (or model path) as a parameter #82

Closed
gacou54 opened this issue Jun 13, 2023 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@gacou54
Copy link

gacou54 commented Jun 13, 2023

Hi!

Users must download the model when instantiating the LMInferer (see below). In some environments (e.g. some Slurm clusters), internet access is restricted, which makes lungmask raise an error.

class LMInferer:
    def __init__(...):
        ...
        # here (mask.py:115), raise an error in restricted network environments
        self.model = get_model(self.modelname)

I suggest that the LMInferer class should have a model parameter instead of a modelname, or at least a modelpath parameter.

Personal opinion: In my mind, LMInferer should not have the responsibility to load or download the model. I prefer the option where the model is given as a parameter

Thank you for this project :)

@JoHof
Copy link
Owner

JoHof commented Jun 14, 2023

Hi,

thanks for your feedback, that's actually a really good point. I think though it should be the responsibility of LMInferer to load the model. Why would you prefer to pass the model directly if may ask? I needs extra code to load the model and pass it to the constructor. I would add just a parameter for modelpath as alternative to the modelname. What do you think?

@JoHof JoHof self-assigned this Jun 14, 2023
@JoHof JoHof added the bug Something isn't working label Jun 14, 2023
@gacou54
Copy link
Author

gacou54 commented Jun 14, 2023

Why would you prefer to pass the model directly if may ask? In my mind, the LMInferer role should be to "infer/apply" the model (from a software architecture/engineering point of view). But its only details and it would indeed require you to write more code.

I would add just a parameter for modelpath as an alternative to the modelname. What do you think? It is indeed the simplest fix and I am totally good with it.

Thank you again!

@JoHof
Copy link
Owner

JoHof commented Jun 14, 2023

Hi Gabriel,

I addressed the issue in this PR. Could you please have a look and confirm that this works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants