@@ -323,6 +323,7 @@ class ModularPipelineBlocks(ConfigMixin, PushToHubMixin):
323323    """ 
324324
325325    config_name  =  "config.json" 
326+     model_name  =  None 
326327
327328    @classmethod  
328329    def  _get_signature_keys (cls , obj ):
@@ -333,6 +334,14 @@ def _get_signature_keys(cls, obj):
333334
334335        return  expected_modules , optional_parameters 
335336
337+     @property  
338+     def  expected_components (self ) ->  List [ComponentSpec ]:
339+         return  []
340+ 
341+     @property  
342+     def  expected_configs (self ) ->  List [ConfigSpec ]:
343+         return  []
344+ 
336345    @classmethod  
337346    def  from_pretrained (
338347        cls ,
@@ -386,39 +395,10 @@ def save_pretrained(self, save_directory, push_to_hub=False, **kwargs):
386395
387396        full_mod  =  type (self ).__module__ 
388397        module  =  full_mod .rsplit ("." , 1 )[- 1 ].replace ("__dynamic__" , "" )
389-         parent_module  =  self .__class__ . __bases__ [0 ]. __name__ 
398+         parent_module  =  self .save_pretrained . __func__ . __qualname__ . split ( "." ,  1 ) [0 ]
390399        auto_map  =  {f"{ parent_module }  : f"{ module } { cls_name }  }
391400
392401        self .register_to_config (auto_map = auto_map )
393- 
394-         _component_specs  =  {spec .name : deepcopy (spec ) for  spec  in  self .expected_components }
395-         _config_specs  =  {spec .name : deepcopy (spec ) for  spec  in  self .expected_configs }
396- 
397-         register_components_dict  =  {}
398-         for  name , component_spec  in  _component_specs .items ():
399-             if  component_spec .type_hint  is  not None :
400-                 lib_name , cls_name  =  _fetch_class_library_tuple (component_spec .type_hint )
401-             else :
402-                 lib_name  =  cls_name  =  None 
403-             load_spec_dict  =  {k : getattr (component_spec , k ) for  k  in  component_spec .loading_fields ()}
404- 
405-             # Since ModularPipelineBlocks can never have loaded components we set 
406-             # first two fields in the config dict to None 
407-             register_components_dict [name ] =  (
408-                 None ,
409-                 None ,
410-                 {
411-                     "type_hint" : (lib_name , cls_name ),
412-                     ** load_spec_dict ,
413-                 },
414-             )
415-         self .register_to_config (** register_components_dict )
416- 
417-         default_configs  =  {}
418-         for  name , config_spec  in  _config_specs .items ():
419-             default_configs [name ] =  config_spec .default 
420-         self .register_to_config (** default_configs )
421- 
422402        self .save_config (save_directory = save_directory , push_to_hub = push_to_hub , ** kwargs )
423403        config  =  dict (self .config )
424404        self ._internal_dict  =  FrozenDict (config )
0 commit comments