code: def __init__(self, vocab, args, device=None):
      super(Word2tag, self).__init__()
      self.vocab = vocab
      self.vocab_model = vocab
  
      self.device = device
      self.graph_name = args.graph_name
  
      embedding_style = {
          "single_token_item": True
          if args.graph_name != "ie"
          else False,
          "emb_strategy": "w2v_bilstm",
          "num_rnn_layers": 1,
          "bert_model_name": "bert-base-uncased",
          "bert_lower_case": True,
      }
  
      self.graph_initializer = GraphEmbeddingInitialization(
          word_vocab=self.vocab_model.in_word_vocab,
          embedding_style=embedding_style,
          hidden_size=args.init_hidden_size,
          word_dropout=args.word_dropout,
          rnn_dropout=None,
          fix_word_emb=not args.no_fix_word_emb,
          fix_bert_emb=not args.no_fix_word_emb,
      )
  
      if args.graph_name == "node_emb":
          self.graph_topology = NodeEmbeddingBasedGraphConstruction(
              sim_metric_type=args.gl_metric_type,
              num_heads=args.gl_num_heads,
              top_k_neigh=args.gl_top_k,
              epsilon_neigh=args.gl_epsilon,
              smoothness_ratio=args.gl_smoothness_ratio,
              connectivity_ratio=args.gl_connectivity_ratio,
              sparsity_ratio=args.gl_sparsity_ratio,
              input_size=args.init_hidden_size,
              hidden_size=args.init_hidden_size,
              fix_word_emb=not args.no_fix_word_emb,
              fix_bert_emb=not args.no_fix_bert_emb,
              word_dropout=args.word_dropout,
              rnn_dropout=None,
              device=self.device,
              use_edge_weight=True,
          )
  
      if args.graph_name == "node_emb_refined":
          self.graph_topology = (
              NodeEmbeddingBasedRefinedGraphConstruction(
                  args.init_adj_alpha,
                  sim_metric_type=args.gl_metric_type,
                  num_heads=args.gl_num_heads,
                  top_k_neigh=args.gl_top_k,
                  epsilon_neigh=args.gl_epsilon,
                  smoothness_ratio=args.gl_smoothness_ratio,
                  connectivity_ratio=args.gl_connectivity_ratio,
                  sparsity_ratio=args.gl_sparsity_ratio,
                  input_size=args.init_hidden_size,
                  hidden_size=args.init_hidden_size,
                  fix_word_emb=not args.no_fix_word_emb,
                  word_dropout=args.word_dropout,
                  rnn_dropout=None,
                  device=self.device,
                  use_edge_weight=True,
              )
          )
  
      if (
          "w2v"
          in self.graph_initializer.embedding_layer.word_emb_layers
      ):
          self.word_emb = (
              self.graph_initializer.embedding_layer.word_emb_layers[
                  "w2v"
              ].word_emb_layer
          )
      else:
          self.word_emb = WordEmbedding(
              self.vocab.in_word_vocab.embeddings.shape[0],
              self.vocab.in_word_vocab.embeddings.shape[1],
              pretrained_word_emb=self.vocab.in_word_vocab.embeddings,
              fix_emb=not args.no_fix_word_emb,
              device=self.device,
          ).word_emb_layer
  
      self.gnn_type = args.gnn_type
      self.use_gnn = args.use_gnn
      self.linear0 = nn.Linear(
          int(args.init_hidden_size * 1), args.hidden_size
      ).to(self.device)
      self.linear0_ = nn.Linear(
          int(args.init_hidden_size * 1), args.init_hidden_size
      ).to(self.device)
      self.dropout_tag = nn.Dropout(args.tag_dropout)
      self.dropout_rnn_out = nn.Dropout(p=args.rnn_dropout)
      if self.use_gnn is False:
          self.bilstmcrf = SentenceBiLSTMCRF(
              args, device=self.device, use_rnn=False
          ).to(self.device)
      else:
          if self.gnn_type == "graphsage":
              if args.direction_option == "bi_sep":
                  self.gnn = GraphSAGE(
                      args.gnn_num_layers,
                      args.hidden_size,
                      int(args.init_hidden_size / 2),
                      int(args.init_hidden_size / 2),
                      aggregator_type="mean",
                      direction_option=args.direction_option,
                      activation=F.elu,
                  ).to(self.device)
              else:
                  self.gnn = GraphSAGE(
                      args.gnn_num_layers,
                      args.hidden_size,
                      args.init_hidden_size,
                      args.init_hidden_size,
                      aggregator_type="mean",
                      direction_option=args.direction_option,
                      activation=F.elu,
                  ).to(self.device)
              self.bilstmcrf = SentenceBiLSTMCRF(
                  args, device=self.device, use_rnn=True
              ).to(self.device)
          elif self.gnn_type == "ggnn":
              if args.direction_option == "bi_sep":
                  self.gnn = GGNN(
                      args.gnn_num_layers,
                      int(args.init_hidden_size / 2),
                      int(args.init_hidden_size / 2),
                      direction_option=args.direction_option,
                      n_etypes=1,
                  ).to(self.device)
              else:
                  self.gnn = GGNN(
                      args.gnn_num_layers,
                      args.init_hidden_size,
                      args.init_hidden_size,
                      direction_option=args.direction_option,
                      n_etypes=1,
                  ).to(self.device)
              self.bilstmcrf = SentenceBiLSTMCRF(
                  args, device=self.device, use_rnn=True
              ).to(self.device)
          elif self.gnn_type == "gat":
              heads = 2
              if args.direction_option == "bi_sep":
                  self.gnn = GAT(
                      args.gnn_num_layers,
                      args.hidden_size,
                      int(args.init_hidden_size / 2),
                      int(args.init_hidden_size / 2),
                      heads,
                      direction_option=args.direction_option,
                      feat_drop=0.6,
                      attn_drop=0.6,
                      negative_slope=0.2,
                      activation=F.elu,
                  ).to(self.device)
              else:
                  self.gnn = GAT(
                      args.gnn_num_layers,
                      args.hidden_size,
                      args.init_hidden_size,
                      args.init_hidden_size,
                      heads,
                      direction_option=args.direction_option,
                      feat_drop=0.6,
                      attn_drop=0.6,
                      negative_slope=0.2,
                      activation=F.elu,
                  ).to(self.device)
              self.bilstmcrf = SentenceBiLSTMCRF(
                  args, device=self.device, use_rnn=True
              ).to(self.device)
          elif self.gnn_type == "gcn":
              if args.direction_option == "bi_sep":
                  self.gnn = GCN(
                      args.gnn_num_layers,
                      args.hidden_size,
                      int(args.init_hidden_size / 2),
                      int(args.init_hidden_size / 2),
                      direction_option=args.direction_option,
                      activation=F.elu,
                  ).to(self.device)
              else:
                  self.gnn = GCN(
                      args.gnn_num_layers,
                      args.hidden_size,
                      args.init_hidden_size,
                      args.init_hidden_size,
                      direction_option=args.direction_option,
                      activation=F.elu,
                  ).to(self.device)
              self.bilstmcrf = SentenceBiLSTMCRF(
                  args, device=self.device, use_rnn=True
              ).to(self.device)
  
imports: import os
  import torch
  import torch.backends.cudnn
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  from graph4nlp.pytorch.modules.graph_construction import NodeEmbeddingBasedRefinedGraphConstruction
  from graph4nlp.pytorch.modules.graph_construction.node_embedding_based_graph_construction import NodeEmbeddingBasedGraphConstruction
  from graph4nlp.pytorch.modules.graph_embedding_initialization.embedding_construction import WordEmbedding
  from graph4nlp.pytorch.modules.graph_embedding_initialization.graph_embedding_initialization import GraphEmbeddingInitialization
  from graph4nlp.pytorch.modules.graph_embedding_learning.gat import GAT
  from graph4nlp.pytorch.modules.graph_embedding_learning.gcn import GCN
  from graph4nlp.pytorch.modules.graph_embedding_learning.ggnn import GGNN
  from graph4nlp.pytorch.modules.graph_embedding_learning.graphsage import GraphSAGE
  from graph4nlp.pytorch.modules.prediction.classification.node_classification import BiLSTMFeedForwardNN
label_desc: Use image node_id 1 to create a new Word2tag object from inherited base classes: nn with example: obj = Word2tag(vocab, args, device)