class_docstr: Base class for all models.
  
  [`ModelMixin`] takes care of storing the model configuration and provides methods for loading, downloading and
  saving models.
  
      - **config_name** ([`str`]) -- Filename to save a model to when calling [`~models.ModelMixin.save_pretrained`].
class_docstr_tok: ["Base","class","for","all","models",".","[","`","ModelMixin","`","]","takes","care","of","storing","the","model","configuration","and","provides","methods","for","loading",",","downloading","and","saving","models",".","-","*","*","config_name","*","*","(","[","`","str","`","]",")","--","Filename","to","save","a","model","to","when","calling","[","`","~models.ModelMixin.save_pretrained","`","]","."]
code: def _convert_deprecated_attention_blocks(
      self, state_dict: OrderedDict
  ) -> None:
      deprecated_attention_block_paths = []
  
      def recursive_find_attn_block(name, module):
          if (
              hasattr(module, "_from_deprecated_attn_block")
              and module._from_deprecated_attn_block
          ):
              deprecated_attention_block_paths.append(name)
  
          for sub_name, sub_module in module.named_children():
              sub_name = (
                  sub_name if name == "" else f"{name}.{sub_name}"
              )
              recursive_find_attn_block(sub_name, sub_module)
  
      recursive_find_attn_block("", self)
  
      # NOTE: we have to check if the deprecated parameters are in the state dict
      # because it is possible we are loading from a state dict that was already
      # converted
  
      for path in deprecated_attention_block_paths:
          # group_norm path stays the same
  
          # query -> to_q
          if f"{path}.query.weight" in state_dict:
              state_dict[f"{path}.to_q.weight"] = state_dict.pop(
                  f"{path}.query.weight"
              )
          if f"{path}.query.bias" in state_dict:
              state_dict[f"{path}.to_q.bias"] = state_dict.pop(
                  f"{path}.query.bias"
              )
  
          # key -> to_k
          if f"{path}.key.weight" in state_dict:
              state_dict[f"{path}.to_k.weight"] = state_dict.pop(
                  f"{path}.key.weight"
              )
          if f"{path}.key.bias" in state_dict:
              state_dict[f"{path}.to_k.bias"] = state_dict.pop(
                  f"{path}.key.bias"
              )
  
          # value -> to_v
          if f"{path}.value.weight" in state_dict:
              state_dict[f"{path}.to_v.weight"] = state_dict.pop(
                  f"{path}.value.weight"
              )
          if f"{path}.value.bias" in state_dict:
              state_dict[f"{path}.to_v.bias"] = state_dict.pop(
                  f"{path}.value.bias"
              )
  
          # proj_attn -> to_out.0
          if f"{path}.proj_attn.weight" in state_dict:
              state_dict[f"{path}.to_out.0.weight"] = state_dict.pop(
                  f"{path}.proj_attn.weight"
              )
          if f"{path}.proj_attn.bias" in state_dict:
              state_dict[f"{path}.to_out.0.bias"] = state_dict.pop(
                  f"{path}.proj_attn.bias"
              )
  
imports: import inspect
  import itertools
  import os
  import re
  from collections import OrderedDict
  from functools import partial
  from typing import Any, Callable, List, Optional, Tuple, Union
  import safetensors
  import torch
  from huggingface_hub import create_repo
  from huggingface_hub.utils import validate_hf_hub_args
  from torch import Tensor, nn
  from ..None import __version__
  from ..utils import CONFIG_NAME, FLAX_WEIGHTS_NAME, SAFETENSORS_WEIGHTS_NAME, WEIGHTS_NAME, _add_variant, _get_model_file, deprecate, is_accelerate_available, is_torch_version, logging
  from ..utils.hub_utils import PushToHubMixin
label_desc: Use image node_id 15 for calling the ModelMixin obj's underlying member method code with example usage: obj._convert_deprecated_attention_blocks(state_dict) without return types