I am working through lesson 2, deploying a model to Gradio.
I noticed that my editor (both Neovim and VSCode) shows the return type of load_learner
is Any
.
Full code:
from fastai.vision.all import load_learner
learn = load_learner("model.pkl")
The editor type hint for learn
is:
(variable) learn: Any
Is there something I am missing with my set up? Or is this the intended type?
I can run the code and deploy to Gradio just fine. I really prefer to have everything typed when I code so I can use auto-completions and in editor documentation. I can’t detect the predict
method on learn
without looking up documentation.
I have a valid type hint for the load_learner
function though:
(function) load_learner(fname: Unknown, cpu: bool = True, pickle_module: Module("pickle") = pickle) -> Any
──────────────────────────────────────────────────────────────────────────────────────────────────────────
Load a `Learner` object in `fname`, by default putting it on the `cpu`