code: def init_model(model, method="random", fill_val=1.0):
      if method == "zeros":
          init_fn = nn.init.zeros_
      elif method == "ones":
          init_fn = nn.init.ones_
      elif method == "consts":
  
          def init_fn(x):
              return nn.init.constant_(x, fill_val)
  
      elif method == "random":
          init_fn = nn.init.normal_
      else:
          raise ValueError(
              "Invalid method. Options are: 'zeros', 'ones', 'consts', 'random'"
          )
  
      for name, param in model.named_parameters():
          if "bias" in name:
              # usually it's good practice to initialize biases to zero
              nn.init.zeros_(param)
          else:
              init_fn(param)
  
imports: import torch.nn
  from fate.arch.dataframe import DataFrame
  from fate.ml.abc.module import HomoModule
  from fate.ml.utils.model_io import ModelIO
  from fate.arch import Context
  import logging
  import torch
  from fate.ml.nn.homo.fedavg import FedAVGClient, TrainingArguments, FedAVGArguments
  from transformers import default_data_collator
  import functools
  import tempfile
  from fate.ml.utils.predict_tools import array_to_predict_df
  from fate.ml.utils.predict_tools import MULTI, BINARY
  from fate.ml.nn.dataset.table import TableDataset
  from fate.ml.utils._optimizer import optimizer_factory, lr_scheduler_factory
label_desc: Use image node_id 2 for calling a global function with example usage: init_model(model, method, fill_val) and returns: nn