Attemping to deploy my model to HuggingFace using Streamlit and LoadLearner from fastAI. It is throwing an error that it’s missing the custom classes or functions.
I am having the same issue as the above. Attribute error. Using Kaggle Notebooks to develop and export the .pkl file
I’m running the load_learner and it is giving me the attribute error missing a custom function which in my case is my GetLabel from the food classifier exercise
Does anyone know where in the code to declare that original function? It actually happened in the Production example of Chapter two from the 2022 course as well.
I’m not really sure what the cause of this problem is because you didn’t share a lot of code. If you could link your notebook with the error output in here (e.g. upload it to Kaggle, run it, share a link) I could try to help you more.
For now, I think it’s important to re-declare any functions that your exported model was using in the previous notebook. It sounds like your GetLabel function and your model were in notebook A, where the model was then exported and importet in notebook B. In order for the model to work in notebook B, you need to re-declare GetLabel in there too, or the model won’t work as it can’t use this function. Jeremy talks about it specifically here: Lesson 2: Practical Deep Learning for Coders 2022 - YouTube