class_docstr: A base layer for LyCORIS like adapters
class_docstr_tok: ["A","base","layer","for","LyCORIS","like","adapters"]
code: def _init_empty_weights(self, cls, *args, **kwargs) -> None:
      # A helper method that allows to initialize the layer of the given class without spending time to initialize the
      # model weights. The implementation is inspired by
      # https://pytorch.org/docs/stable/generated/torch.nn.utils.skip_init.html but this function cannot be used
      # directly.
      # Instead of this approach, it would be possible to bypass the __init__ of the class but that runs the risk of
      # omitting important logic inside that __init__.
      kwargs = kwargs.copy()
      final_device = kwargs.pop("device", "cpu")
      cls.__init__(self, *args, device="meta", **kwargs)
      self.to_empty(device=final_device)
  
imports: from __future__ import annotations
  import warnings
  from abc import abstractmethod
  from dataclasses import dataclass, field
  from typing import Any, Dict, List, Optional, Set, Type, Union
  import torch
  import torch.nn
  from tqdm import tqdm
  from peft.config import PeftConfig
  from peft.utils import ModulesToSaveWrapper, _get_submodules
  from .tuners_utils import BaseTuner, BaseTunerLayer, check_target_module_exists
label_desc: Use image node_id 3 for calling the LycorisLayer obj's underlying member method code with example usage: obj._init_empty_weights(cls) without return types