code: def __init__(self, vocab, label_model, config):
      super(TextClassifier, self).__init__()
      self.config = config
      self.vocab_model = vocab
      self.label_model = label_model
      self.graph_name = self.config["graph_construction_args"][
          "graph_construction_share"
      ]["graph_name"]
      assert not (
          self.graph_name in ("node_emb", "node_emb_refined")
          and config["gnn"] == "gat"
      ), "dynamic graph construction does not support GAT"
  
      embedding_style = {
          "single_token_item": True
          if self.graph_name != "ie"
          else False,
          "emb_strategy": config.get("emb_strategy", "w2v_bilstm"),
          "num_rnn_layers": 1,
          "bert_model_name": config.get(
              "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=config["num_hidden"],
          word_dropout=config["word_dropout"],
          rnn_dropout=config["rnn_dropout"],
          fix_word_emb=not config["no_fix_word_emb"],
          fix_bert_emb=not config.get("no_fix_bert_emb", False),
      )
  
      use_edge_weight = False
      if self.graph_name == "node_emb":
          self.graph_topology = NodeEmbeddingBasedGraphConstruction(
              sim_metric_type=config["gl_metric_type"],
              num_heads=config["gl_num_heads"],
              top_k_neigh=config["gl_top_k"],
              epsilon_neigh=config["gl_epsilon"],
              smoothness_ratio=config["gl_smoothness_ratio"],
              connectivity_ratio=config["gl_connectivity_ratio"],
              sparsity_ratio=config["gl_sparsity_ratio"],
              input_size=config["num_hidden"],
              hidden_size=config["gl_num_hidden"],
          )
          use_edge_weight = True
      elif self.graph_name == "node_emb_refined":
          self.graph_topology = (
              NodeEmbeddingBasedRefinedGraphConstruction(
                  config["init_adj_alpha"],
                  sim_metric_type=config["gl_metric_type"],
                  num_heads=config["gl_num_heads"],
                  top_k_neigh=config["gl_top_k"],
                  epsilon_neigh=config["gl_epsilon"],
                  smoothness_ratio=config["gl_smoothness_ratio"],
                  connectivity_ratio=config["gl_connectivity_ratio"],
                  sparsity_ratio=config["gl_sparsity_ratio"],
                  input_size=config["num_hidden"],
                  hidden_size=config["gl_num_hidden"],
              )
          )
          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_model.in_word_vocab.embeddings.shape[0],
              self.vocab_model.in_word_vocab.embeddings.shape[1],
              pretrained_word_emb=self.vocab_model.in_word_vocab.embeddings,
              fix_emb=not config["no_fix_word_emb"],
          ).word_emb_layer
  
      if config["gnn"] == "gat":
          heads = [config["gat_num_heads"]] * (
              config["gnn_num_layers"] - 1
          ) + [config["gat_num_out_heads"]]
          self.gnn = GAT(
              config["gnn_num_layers"],
              config["num_hidden"],
              config["num_hidden"],
              config["num_hidden"],
              heads,
              direction_option=config["gnn_direction_option"],
              feat_drop=config["gnn_dropout"],
              attn_drop=config["gat_attn_dropout"],
              negative_slope=config["gat_negative_slope"],
              residual=config["gat_residual"],
              activation=F.elu,
              allow_zero_in_degree=True,
          )
      elif config["gnn"] == "graphsage":
          self.gnn = GraphSAGE(
              config["gnn_num_layers"],
              config["num_hidden"],
              config["num_hidden"],
              config["num_hidden"],
              config["graphsage_aggreagte_type"],
              direction_option=config["gnn_direction_option"],
              feat_drop=config["gnn_dropout"],
              bias=True,
              norm=None,
              activation=F.relu,
              use_edge_weight=use_edge_weight,
          )
      elif config["gnn"] == "ggnn":
          self.gnn = GGNN(
              config["gnn_num_layers"],
              config["num_hidden"],
              config["num_hidden"],
              config["num_hidden"],
              feat_drop=config["gnn_dropout"],
              direction_option=config["gnn_direction_option"],
              bias=True,
              use_edge_weight=use_edge_weight,
          )
      else:
          raise RuntimeError(
              "Unknown gnn type: {}".format(config["gnn"])
          )
  
      self.clf = FeedForwardNN(
          2 * config["num_hidden"]
          if config["gnn_direction_option"] == "bi_sep"
          else config["num_hidden"],
          config["num_classes"],
          [config["num_hidden"]],
          graph_pool_type=config["graph_pooling"],
          dim=config["num_hidden"],
          use_linear_proj=config["max_pool_linear_proj"],
      )
  
      self.loss = GeneralLoss("CrossEntropy")
  
imports: import argparse
  import os
  import time
  import numpy
  import torch
  import torch.backends.cudnn
  import torch.multiprocessing
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import yaml
  from torch.optim.lr_scheduler import ReduceLROnPlateau
  from torch.utils.data import DataLoader
  from graph4nlp.pytorch.datasets.trec import TrecDataset
  from graph4nlp.pytorch.modules.evaluation.accuracy import Accuracy
  from graph4nlp.pytorch.modules.graph_construction import NodeEmbeddingBasedGraphConstruction, NodeEmbeddingBasedRefinedGraphConstruction
  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 import GAT, GGNN, GraphSAGE
  from graph4nlp.pytorch.modules.loss.general_loss import GeneralLoss
  from graph4nlp.pytorch.modules.prediction.classification.graph_classification import FeedForwardNN
  from graph4nlp.pytorch.modules.utils import constants
  from graph4nlp.pytorch.modules.utils.generic_utils import EarlyStopping, grid, to_cuda
  from graph4nlp.pytorch.modules.utils.logger import Logger
label_desc: Use image node_id 1 to create a new TextClassifier object from inherited base classes: nn with example: obj = TextClassifier(vocab, label_model, config)