salesforce / Merlion

Merlion: A Machine Learning Framework for Time Series Intelligence
BSD 3-Clause "New" or "Revised" License
3.36k stars 295 forks source link

Fix incorrect reference to BOCPD model in factory #124

Closed jonwiggins closed 2 years ago

jonwiggins commented 2 years ago

Hello,

Currently there seems to be an issue creating BOCPD models via the model factory:

from merlion.models.factory import ModelFactory

ModelFactory.create("BOCPD")

yields

File ~/.local/lib/python3.8/site-packages/merlion/models/factory.py:73, in ModelFactory.get_model_class(cls, name)
     71 @classmethod
     72 def get_model_class(cls, name: str) -> Type[ModelBase]:
---> 73     return dynamic_import(name, import_alias)

File ~/.local/lib/python3.8/site-packages/merlion/utils/misc.py:166, in dynamic_import(import_path, alias)
    163 if ":" not in import_path:
    164     import_path = alias[import_path]
--> 166 module_name, objname = import_path.split(":")
    167 m = importlib.import_module(module_name)
    168 return getattr(m, objname)

ValueError: not enough values to unpack (expected 2, got 1)

I believe this change fixes that. Let me know if you need me to make any changes.

Thanks, Jon

salesforce-cla[bot] commented 2 years ago

Thanks for the contribution! Before we can merge this, we need @jonwiggins to sign the Salesforce.com Contributor License Agreement.