Esempio n. 1
0
    def from_meta(meta: dict, **kwargs):
        """

        Parameters
        ----------
        meta
        kwargs

        Returns
        -------
        KerasComponent

        """
        cls = str_to_type(meta['class_path'])
        obj: KerasComponent = cls()
        assert 'load_path' in meta, f'{meta} doesn\'t contain load_path field'
        obj.load(meta['load_path'])
        return obj
Esempio n. 2
0
def load_from_meta(meta: dict) -> Component:
    cls = meta.get('class_path', None)
    assert cls, f'{meta} doesn\'t contain class_path field'
    cls = str_to_type(cls)
    return cls.from_meta(meta)
Esempio n. 3
0
 def from_meta(meta: dict, **kwargs):
     cls = str_to_type(meta['class_path'])
     function = meta['function']
     function = object_from_class_path(function)
     return cls(function)
Esempio n. 4
0
 def from_meta(meta: dict, **kwargs):
     cls = str_to_type(meta['class_path'])
     component = load_from_meta(meta['component'])
     return cls(component, meta['input_key'], meta['output_key'])