AttributeError: 'list' object has no attribute '__module__' when loading model from file system with from_pretrained
Original issue postedhere.Essentially I’m loading & saving the stable cascade pipeline from HF using the following code snippet:model = StableCascadeCombinedPipeline.from_pretrained(HF_MODEL_ID, 
                                                      variant="bf16",
                                                      torch_dtype=torch.float16,
                                                      cache_dir=CACHE_DIR)
model.save_pretrained(save_directory="model/", from_pt=True)This works great until I try to load that model from my file system:model = StableCascadeCombinedPipeline.from_pretrained("model/", 
                                                      variant="bf16",
                                                      torch_dtype=torch.float16,
                                                      local_files_only=True)
Loading pipeline components...: 100%
 9/9 [00:05<00:00,  2.32it/s]

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[12], line 1
----> 1 model = StableCascadeCombinedPipeline.from_pretrained("model/", 
      2                                                       variant="bf16",
      3                                                       torch_dtype=torch.float16,
      4                                                       local_files_only=True)

File /opt/conda/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py:119, in validate_REDACTED_TOKEN_args.<locals>._inner_fn(*args, **kwargs)
    116 if check_use_auth_token:
    117     kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
--> 119 return fn(*args, **kwargs)

File /opt/conda/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py:910, in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    905     raise ValueError(
    906         f"Pipeline {pipeline_class} expected {expected_modules}, but only {passed_modules} were passed."
    907     )
    909 # 8. Instantiate the pipeline
--> 910 model = pipeline_class(**init_kwargs)
    912 # 9. Save where the model was instantiated from
    913 model.register_to_config(_name_or_path=pretrained_model_name_or_path)

File /opt/conda/lib/python3.10/site-packages/diffusers/pipelines/stable_cascade/pipeline_stable_cascade_combined.py:88, in StableCascadeCombinedPipeline.__init__(self, tokenizer, text_encoder, decoder, scheduler, vqgan, prior_prior, prior_text_encoder, prior_tokenizer, prior_scheduler, prior_feature_extractor, prior_image_encoder)
     72 def __init__(
     73     self,
     74     tokenizer: CLIPTokenizer,
   (...)
     84     prior_image_encoder: Optional[CLIPVisionModelWithProjection] = None,
     85 ):
     86     super().__init__()
---> 88     self.register_modules(
     89         text_encoder=text_encoder,
     90         tokenizer=tokenizer,
     91         decoder=decoder,
     92         scheduler=scheduler,
     93         vqgan=vqgan,
     94         prior_text_encoder=prior_text_encoder,
     95         prior_tokenizer=prior_tokenizer,
     96         prior_prior=prior_prior,
     97         prior_scheduler=prior_scheduler,
     98         prior_feature_extractor=prior_feature_extractor,
     99         prior_image_encoder=prior_image_encoder,
    100     )
    101     self.prior_pipe = StableCascadePriorPipeline(
    102         prior=prior_prior,
    103         text_encoder=prior_text_encoder,
   (...)
    107         feature_extractor=prior_feature_extractor,
    108     )
    109     self.decoder_pipe = StableCascadeDecoderPipeline(
    110         text_encoder=text_encoder,
    111         tokenizer=tokenizer,
   (...)
    114         vqgan=vqgan,
    115     )

File /opt/conda/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py:154, in DiffusionPipeline.register_modules(self, **kwargs)
    152     register_dict = {name: (None, None)}
    153 else:
--> 154     library, class_name = _fetch_class_library_tuple(module)
    155     register_dict = {name: (library, class_name)}
    157 # save model index config

File /opt/conda/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py:488, in _fetch_class_library_tuple(module)
    486 # register the config from the original module, not the dynamo compiled one
    487 not_compiled_module = _unwrap_model(module)
--> 488 library = not_compiled_module.__module__.split(".")[0]
    490 # check if the module is a pipeline module
    491 module_path_items = not_compiled_module.__module__.split(".")

AttributeError: 'list' object has no attribute '__module__'I’m not sure where I’m going wrong here, some suggested workarounds were to modifysrc/diffusers/pipelines/pipeline_loading_utils.pybut I’d rather do this by the book.