Unfortunately template expressions aren't yet compatible with loading from file—should update the error message to mention this.
Discussed in #844
Originally posted by ibengtsson February 28, 2025
Hi!
First of all, thank you for a great library.
I'm having some issues when working with TemplateExpresssionSpec, and it could very well be a fault on my end... If I create a model with a TemplateExpression, fit and save it, and then try and load it (with from_file) in a different script, I cannot do any model predictions. I just get the error:
ValueError: Failed to evaluate the expression. If you are using a custom operator, make sure to define it in `extra_sympy_mappings`, e.g., `model.set_params(extra_sympy_mappings={'inv': lambda x: 1/x})`, where `lambda x: 1/x` is a valid SymPy function defining the operator. You can then run `model.refresh()` to re-load the expressions.
I don't use any custom operators in my TemplateEpxressionSpec, but maybe I still need to add some mappings to make the loading work?
Grateful for any help!
Unfortunately template expressions aren't yet compatible with loading from file—should update the error message to mention this.
Discussed in #844
Originally posted by ibengtsson February 28, 2025
Hi!
First of all, thank you for a great library.
I'm having some issues when working with TemplateExpresssionSpec, and it could very well be a fault on my end... If I create a model with a TemplateExpression, fit and save it, and then try and load it (with
from_file) in a different script, I cannot do any model predictions. I just get the error:I don't use any custom operators in my TemplateEpxressionSpec, but maybe I still need to add some mappings to make the loading work?
Grateful for any help!