Please post the full error message with the traceback, along with the model involved here.
Also, when you’re posting code or error messages, enclose the code (or error message) between lines of three backtick - ` characters. This means you’ll have a line of ```, then the code, then another line of ```. (I’ve taken the liberty of editing your original post for this. Please remember to do this in future posts.)