code: def __init__(
      self,
      name=None,
      enable_sizes=None,
      layer_structure=None,
      activation_func=None,
      weight_init=None,
      add_layer_norm=False,
      use_dropout=False,
      activate_output=False,
      **kwargs,
  ):
      self.filename = None
      self.name = name
      self.layers = {}
      self.step = 0
      self.sd_checkpoint = None
      self.sd_checkpoint_name = None
      self.layer_structure = layer_structure
      self.activation_func = activation_func
      self.weight_init = weight_init
      self.add_layer_norm = add_layer_norm
      self.use_dropout = use_dropout
      self.activate_output = activate_output
      self.last_layer_dropout = kwargs.get("last_layer_dropout", True)
      self.dropout_structure = kwargs.get("dropout_structure", None)
      if self.dropout_structure is None:
          self.dropout_structure = parse_dropout_structure(
              self.layer_structure,
              self.use_dropout,
              self.last_layer_dropout,
          )
      self.optimizer_name = None
      self.optimizer_state_dict = None
      self.optional_info = None
  
      for size in enable_sizes or []:
          self.layers[size] = (
              HypernetworkModule(
                  size,
                  None,
                  self.layer_structure,
                  self.activation_func,
                  self.weight_init,
                  self.add_layer_norm,
                  self.activate_output,
                  dropout_structure=self.dropout_structure,
              ),
              HypernetworkModule(
                  size,
                  None,
                  self.layer_structure,
                  self.activation_func,
                  self.weight_init,
                  self.add_layer_norm,
                  self.activate_output,
                  dropout_structure=self.dropout_structure,
              ),
          )
      self.eval()
  
imports: import datetime
  import glob
  import html
  import os
  import inspect
  from contextlib import closing
  import modules.textual_inversion.dataset
  import torch
  import tqdm
  from einops import rearrange, repeat
  from ldm.util import default
  from modules import devices, sd_models, shared, sd_samplers, hashes, sd_hijack_checkpoint, errors
  from modules.textual_inversion import textual_inversion, logging
  from modules.textual_inversion.learn_schedule import LearnRateScheduler
  from torch import einsum
  from torch.nn.init import normal_, xavier_normal_, xavier_uniform_, kaiming_normal_, kaiming_uniform_, zeros_
  from collections import deque
  from statistics import stdev, mean
label_desc: Use image node_id 1 to create a new Hypernetwork object  with example: obj = Hypernetwork(name, enable_sizes, layer_structure, activation_func, weight_init, add_layer_norm, use_dropout, activate_output)