Repository: huggingface/diffusers
File: src/diffusers/modular_pipelines/modular_pipeline.py (Python)

Code before:
        Returns a list of available workflow names. Must be implemented by subclasses that define `_workflow_map`.
        """
        raise NotImplementedError(f"`available_workflows` is not implemented for {self.__class__.__name__}")

    def get_workflow(self, workflow_name: str):
        """
        Get the execution blocks for a specific workflow. Must be implemented by subclasses that define
        `_workflow_map`.

        Args:
            workflow_name: Name of the workflow to retrieve.
        """
        raise NotImplementedError(f"`get_workflow` is not implemented for {self.__class__.__name__}")

    @classmethod
    def from_pretrained(
        cls,
        pretrained_model_name_or_path: str,
        trust_remote_code: bool = False,
        **kwargs,
    ):
        config = cls.load_config(pretrained_model_name_or_path)
        has_remote_code = "auto_map" in config and cls.__name__ in config["auto_map"]
        trust_remote_code = resolve_trust_remote_code(
            trust_remote_code, pretrained_model_name_or_path, has_remote_code
        )
        if not (has_remote_code and trust_remote_code):
            raise ValueError(
                "Selected model repository does not happear to have any custom code or does not have a valid `config.json` file."
            )

        if "requirements" in config and config["requirements"] is not None:
            _ = _validate_requirements(config["requirements"])

        hub_kwargs_names = [
            "cache_dir",
            "force_download",
            "local_files_only",
            "local_dir",
            "proxies",
            "revision",
            "subfolder",
            "token",
        ]
        hub_kwargs = {name: kwargs.pop(name) for name in hub_kwargs_names if name in kwargs}

        class_ref = config["auto_map"][cls.__name__]
        module_file, class_name = class_ref.split(".")
        module_file = module_file + ".py"
        block_cls = get_class_from_dynamic_module(
            pretrained_model_name_or_path,

Review comment (performance):
We need to pass `hub_kwargs` to `load_config` in order to load revisions, set cache_dir, local_dir etc. 

Code after:
        """
        raise NotImplementedError(f"`get_execution_blocks` is not implemented for {self.__class__.__name__}")

    # currently only SequentialPipelineBlocks support workflows
    @property
    def available_workflows(self):
        """
        Returns a list of available workflow names. Must be implemented by subclasses that define `_workflow_map`.
        """
        raise NotImplementedError(f"`available_workflows` is not implemented for {self.__class__.__name__}")

    def get_workflow(self, workflow_name: str):
        """
        Get the execution blocks for a specific workflow. Must be implemented by subclasses that define
        `_workflow_map`.

        Args:
            workflow_name: Name of the workflow to retrieve.
        """
        raise NotImplementedError(f"`get_workflow` is not implemented for {self.__class__.__name__}")

    @classmethod
    def from_pretrained(
        cls,
        pretrained_model_name_or_path: str,
        trust_remote_code: bool = False,
        **kwargs,
    ):
        hub_kwargs_names = [
            "cache_dir",
            "force_download",
            "local_files_only",
            "local_dir",
            "proxies",
            "revision",
            "subfolder",
            "token",
        ]
        hub_kwargs = {name: kwargs.pop(name) for name in hub_kwargs_names if name in kwargs}

        config = cls.load_config(pretrained_model_name_or_path, **hub_kwargs)
        has_remote_code = "auto_map" in config and cls.__name__ in config["auto_map"]
        trust_remote_code = resolve_trust_remote_code(
            trust_remote_code, pretrained_model_name_or_path, has_remote_code
        )
        if not has_remote_code and trust_remote_code:
            raise ValueError(
                "Selected model repository does not happear to have any custom code or does not have a valid `config.json` file."
            )

        if "requirements" in config and config["requirements"] is not None: