class_docstr: Transformer sequence classifier
  
  Args:
      model_type (str): transformer base model type
      labels (List[str], optional): list of labels. Defaults to None.
      task_type (str, optional): task type (classification/regression). Defaults to
      classification.
      metric_fn ([type], optional): metric to use for evaluation. Defaults to
      simple_accuracy.
class_docstr_tok: ["Transformer","sequence","classifier","Args",":","model_type","(","str",")",":","transformer","base","model","type","labels","(","List","[","str","]",",","optional",")",":","list","of","labels",".","Defaults","to","None",".","task_type","(","str",",","optional",")",":","task","type","(","classification\/regression",")",".","Defaults","to","classification",".","metric_fn","(","[","type","]",",","optional",")",":","metric","to","use","for","evaluation",".","Defaults","to","simple_accuracy","."]
docstr: Train a model
  
  Args:
      train_data_set (DataLoader): training data set
      dev_data_set (Union[DataLoader, List[DataLoader]], optional): development set.
      Defaults to None.
      test_data_set (Union[DataLoader, List[DataLoader]], optional): test set.
      Defaults to None.
      gradient_accumulation_steps (int, optional): num of gradient accumulation steps.
      Defaults to 1.
      per_gpu_train_batch_size (int, optional): per GPU train batch size. Defaults to 8.
      max_steps (int, optional): max steps. Defaults to -1.
      num_train_epochs (int, optional): number of train epochs. Defaults to 3.
      max_grad_norm (float, optional): max gradient normalization. Defaults to 1.0.
      logging_steps (int, optional): number of steps between logging. Defaults to 50.
      save_steps (int, optional): number of steps between model save. Defaults to 100.
docstr_tok: ["Train","a","model","Args",":","train_data_set","(","DataLoader",")",":","training","data","set","dev_data_set","(","Union","[","DataLoader",",","List","[","DataLoader","]","]",",","optional",")",":","development","set",".","Defaults","to","None",".","test_data_set","(","Union","[","DataLoader",",","List","[","DataLoader","]","]",",","optional",")",":","test","set",".","Defaults","to","None",".","gradient_accumulation_steps","(","int",",","optional",")",":","num","of","gradient","accumulation","steps",".","Defaults","to","1.","per_gpu_train_batch_size","(","int",",","optional",")",":","per","GPU","train","batch","size",".","Defaults","to","8.","max_steps","(","int",",","optional",")",":","max","steps",".","Defaults","to","-1.","num_train_epochs","(","int",",","optional",")",":","number","of","train","epochs",".","Defaults","to","3.","max_grad_norm","(","float",",","optional",")",":","max","gradient","normalization",".","Defaults","to","1.0.","logging_steps","(","int",",","optional",")",":","number","of","steps","between","logging",".","Defaults","to","50.","save_steps","(","int",",","optional",")",":","number","of","steps","between","model","save",".","Defaults","to","100","."]
code: def train(
      self,
      train_data_set: DataLoader,
      dev_data_set: Union[DataLoader, List[DataLoader]] = None,
      test_data_set: Union[DataLoader, List[DataLoader]] = None,
      gradient_accumulation_steps: int = 1,
      per_gpu_train_batch_size: int = 8,
      max_steps: int = -1,
      num_train_epochs: int = 3,
      max_grad_norm: float = 1.0,
      logging_steps: int = 50,
      save_steps: int = 100,
  ):
      """
      Train a model
  
      Args:
          train_data_set (DataLoader): training data set
          dev_data_set (Union[DataLoader, List[DataLoader]], optional): development set.
          Defaults to None.
          test_data_set (Union[DataLoader, List[DataLoader]], optional): test set.
          Defaults to None.
          gradient_accumulation_steps (int, optional): num of gradient accumulation steps.
          Defaults to 1.
          per_gpu_train_batch_size (int, optional): per GPU train batch size. Defaults to 8.
          max_steps (int, optional): max steps. Defaults to -1.
          num_train_epochs (int, optional): number of train epochs. Defaults to 3.
          max_grad_norm (float, optional): max gradient normalization. Defaults to 1.0.
          logging_steps (int, optional): number of steps between logging. Defaults to 50.
          save_steps (int, optional): number of steps between model save. Defaults to 100.
      """
      self._train(
          train_data_set,
          dev_data_set,
          test_data_set,
          gradient_accumulation_steps,
          per_gpu_train_batch_size,
          max_steps,
          num_train_epochs,
          max_grad_norm,
          logging_steps=logging_steps,
          save_steps=save_steps,
      )
  
file_path: nlp-architect/nlp_architect/models/transformers/sequence_classification.py
imports: import logging
  import os
  from typing import List, Union
  import numpy
  import torch
  from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
  from transformers import BertForSequenceClassification, RobertaForSequenceClassification, XLMForSequenceClassification, XLNetForSequenceClassification
  from nlp_architect.data.sequence_classification import SequenceClsInputExample
  from nlp_architect.models.transformers.base_model import InputFeatures, TransformerBase
  from nlp_architect.models.transformers.quantized_bert import QuantizedBertForSequenceClassification
  from nlp_architect.utils.metrics import accuracy
label_desc: Use image node_id 2 for calling the TransformerSequenceClassifier obj's underlying member method code with example usage: obj.train(train_data_set, dev_data_set, test_data_set, gradient_accumulation_steps, per_gpu_train_batch_size, max_steps, num_train_epochs, max_grad_norm, logging_steps, save_steps) without return types