You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mutable default <class 'greykite.framework.templates.autogen.forecast_config.ModelComponentsParam'> for field SILVERKITE is not allowed: use default_factory
#123
Open
koonleong opened this issue
Jun 26, 2023
· 1 comment
I tried running the sample file 0100_simple_forecast.ipynb from Greykite but I could not get beyond the import statements.
I am using Greykite 0.5.0. on Python version_info(major=3, minor=11, micro=4, releaselevel='final', serial=0)
The error message starts with:
ValueError Traceback (most recent call last) Cell In[4], line 12 10 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 11 from greykite.framework.templates.autogen.forecast_config import MetadataParam ---> 12 from greykite.framework.templates.forecaster import Forecaster 13 from greykite.framework.templates.model_templates import ModelTemplateEnum 14 from greykite.framework.utils.result_summary import summarize_grid_search_results
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/forecaster.py:40 38 from greykite.framework.pipeline.pipeline import forecast_pipeline 39 from greykite.framework.pipeline.utils import get_basic_pipeline ---> 40 from greykite.framework.templates.auto_model_template import get_auto_silverkite_model_template 41 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 42 from greykite.framework.templates.autogen.forecast_config import forecast_config_from_dict
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/auto_model_template.py:36 34 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 35 from greykite.framework.templates.forecast_config_defaults import ForecastConfigDefaults ---> 36 from greykite.framework.templates.model_templates import ModelTemplateEnum 37 from greykite.framework.templates.simple_silverkite_template_config import SILVERKITE_DAILY_90 38 from greykite.framework.templates.simple_silverkite_template_config import SILVERKITE_HOURLY_1
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/model_templates.py:55 53 from greykite.framework.templates.auto_arima_template import AutoArimaTemplate 54 from greykite.framework.templates.lag_based_template import LagBasedTemplate ---> 55 from greykite.framework.templates.multistage_forecast_template import MultistageForecastTemplate 56 from greykite.framework.templates.prophet_template import ProphetTemplate 57 from greykite.framework.templates.silverkite_template import SilverkiteTemplate
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/multistage_forecast_template.py:39 37 from greykite.framework.templates.autogen.forecast_config import MetadataParam 38 from greykite.framework.templates.base_template import BaseTemplate ---> 39 from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConfig 40 from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConstants 41 from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/multistage_forecast_template_config.py:44 42 from greykite.framework.templates.prophet_template import ProphetTemplate 43 from greykite.framework.templates.silverkite_template import SilverkiteTemplate ---> 44 from greykite.framework.templates.simple_silverkite_template import SimpleSilverkiteTemplate 45 from greykite.sklearn.estimator.lag_based_estimator import LagUnitEnum 48 @DataClass 49 class MultistageForecastTemplateConfig:
and ends with
File /opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py:815, in _get_field(cls, a_name, a_type, default_kw_only) 811 # For real fields, disallow mutable defaults. Use unhashable as a proxy 812 # indicator for mutability. Read the hash attribute from the class, 813 # not the instance. 814 if f._field_type is _FIELD and f.default.class.hash is None: --> 815 raise ValueError(f'mutable default {type(f.default)} for field ' 816 f'{f.name} is not allowed: use default_factory') 818 return f
ValueError: mutable default <class 'greykite.framework.templates.autogen.forecast_config.ModelComponentsParam'> for field SILVERKITE is not allowed: use default_factory
@koonleong I ran into this myself and did some quick testing. It appears that Greykite 1.0 also exhibits this problem when used with Python 3.11. I tested it on Debian Bookwork as well as MacOS. In both cases, the exception is the same as what you were getting with 0.50 on 3.11.
I tried running the sample file 0100_simple_forecast.ipynb from Greykite but I could not get beyond the import statements.
I am using Greykite 0.5.0. on Python version_info(major=3, minor=11, micro=4, releaselevel='final', serial=0)
The error message starts with:
ValueError Traceback (most recent call last) Cell In[4], line 12 10 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 11 from greykite.framework.templates.autogen.forecast_config import MetadataParam ---> 12 from greykite.framework.templates.forecaster import Forecaster 13 from greykite.framework.templates.model_templates import ModelTemplateEnum 14 from greykite.framework.utils.result_summary import summarize_grid_search_results
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/forecaster.py:40 38 from greykite.framework.pipeline.pipeline import forecast_pipeline 39 from greykite.framework.pipeline.utils import get_basic_pipeline ---> 40 from greykite.framework.templates.auto_model_template import get_auto_silverkite_model_template 41 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 42 from greykite.framework.templates.autogen.forecast_config import forecast_config_from_dict
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/auto_model_template.py:36 34 from greykite.framework.templates.autogen.forecast_config import ForecastConfig 35 from greykite.framework.templates.forecast_config_defaults import ForecastConfigDefaults ---> 36 from greykite.framework.templates.model_templates import ModelTemplateEnum 37 from greykite.framework.templates.simple_silverkite_template_config import SILVERKITE_DAILY_90 38 from greykite.framework.templates.simple_silverkite_template_config import SILVERKITE_HOURLY_1
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/model_templates.py:55 53 from greykite.framework.templates.auto_arima_template import AutoArimaTemplate 54 from greykite.framework.templates.lag_based_template import LagBasedTemplate ---> 55 from greykite.framework.templates.multistage_forecast_template import MultistageForecastTemplate 56 from greykite.framework.templates.prophet_template import ProphetTemplate 57 from greykite.framework.templates.silverkite_template import SilverkiteTemplate
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/multistage_forecast_template.py:39 37 from greykite.framework.templates.autogen.forecast_config import MetadataParam 38 from greykite.framework.templates.base_template import BaseTemplate ---> 39 from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConfig 40 from greykite.framework.templates.multistage_forecast_template_config import MultistageForecastTemplateConstants 41 from greykite.sklearn.estimator.base_forecast_estimator import BaseForecastEstimator
File /opt/homebrew/lib/python3.11/site-packages/greykite/framework/templates/multistage_forecast_template_config.py:44 42 from greykite.framework.templates.prophet_template import ProphetTemplate 43 from greykite.framework.templates.silverkite_template import SilverkiteTemplate ---> 44 from greykite.framework.templates.simple_silverkite_template import SimpleSilverkiteTemplate 45 from greykite.sklearn.estimator.lag_based_estimator import LagUnitEnum 48 @DataClass 49 class MultistageForecastTemplateConfig:
and ends with
File /opt/homebrew/Cellar/[email protected]/3.11.4/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py:815, in _get_field(cls, a_name, a_type, default_kw_only) 811 # For real fields, disallow mutable defaults. Use unhashable as a proxy 812 # indicator for mutability. Read the hash attribute from the class, 813 # not the instance. 814 if f._field_type is _FIELD and f.default.class.hash is None: --> 815 raise ValueError(f'mutable default {type(f.default)} for field ' 816 f'{f.name} is not allowed: use default_factory') 818 return f
ValueError: mutable default <class 'greykite.framework.templates.autogen.forecast_config.ModelComponentsParam'> for field SILVERKITE is not allowed: use default_factory
(also raised in https://stackoverflow.com/questions/76554925/value-error-with-greykite-framework-templates-autogen-forecast-config-modelcomp)
The text was updated successfully, but these errors were encountered: