code: def __init__(
      self,
      data: BertNERDataBunch,
      model: nn.Module,
      pretrained_model_path,
      output_dir,
      device,
      logger,
      multi_gpu=True,
      is_fp16=True,
      loss_scale=0,
      warmup_steps=0,
      fp16_opt_level="O1",
      grad_accumulation_steps=1,
      max_grad_norm=1.0,
      adam_epsilon=1e-8,
      logging_steps=100,
      save_steps=0,
  ):
      super(BertNERLearner, self).__init__(
          data,
          model,
          pretrained_model_path,
          output_dir,
          device,
          logger,
          multi_gpu,
          is_fp16,
          warmup_steps,
          fp16_opt_level,
          grad_accumulation_steps,
          max_grad_norm,
          adam_epsilon,
          logging_steps,
      )
  
      if self.output_dir:
          tensorboard_dir = self.output_dir / "tensorboard"
          tensorboard_dir.mkdir(exist_ok=True)
      else:
          tensorboard_dir = None
  
      self.training_arguments = TrainingArguments(
          str(output_dir),
          overwrite_output_dir=True,
          do_train=True,
          do_eval=True,
          evaluation_strategy="epoch",
          logging_strategy="epoch",
          per_device_train_batch_size=data.batch_size_per_gpu,
          per_device_eval_batch_size=data.batch_size_per_gpu * 2,
          gradient_accumulation_steps=grad_accumulation_steps,
          adam_epsilon=adam_epsilon,
          max_grad_norm=max_grad_norm,
          warmup_steps=warmup_steps,
          logging_dir=str(tensorboard_dir),
          logging_steps=logging_steps,
          fp16=is_fp16,
          fp16_opt_level=fp16_opt_level,
          save_steps=save_steps,
      )
  
      # LR Finder
      self.history = {"lr": [], "loss": []}
      self.best_loss = None
      self.state_cacher = None
      self.trainer = None
  
imports: import os
  import logging
  import torch
  import numpy
  from .data_ner import BertNERDataBunch
  from torch import nn
  from seqeval.metrics import f1_score, precision_score, recall_score
  from typing import Dict, List, Optional, Tuple
  from .learner_util import Learner
  from transformers import AutoConfig, AutoModelForTokenClassification, Trainer, TrainingArguments, EvalPrediction, HfArgumentParser
label_desc: Use image node_id 2 to create a new BertNERLearner object from inherited base classes: Learner with example: obj = BertNERLearner(data, model, pretrained_model_path, output_dir, device, logger, multi_gpu, is_fp16, loss_scale, warmup_steps, fp16_opt_level, grad_accumulation_steps, max_grad_norm, adam_epsilon, logging_steps, save_steps)