class_docstr: The base class for Contextual Bandit models. A minimal implementation of a specific model requires providing a specific
      implementation for only the cb_training_step() method.
  The main functionality implemented in this base class is the integration of Offline Evaluation into the training loop.
class_docstr_tok: ["The","base","class","for","Contextual","Bandit","models",".","A","minimal","implementation","of","a","specific","model","requires","providing","a","specific","implementation","for","only","the","cb_training_step","(",")","method",".","The","main","functionality","implemented","in","this","base","class","is","the","integration","of","Offline","Evaluation","into","the","training","loop","."]
docstr: Agruments:
      eval_model_update_critical_weight: Maximum total weight of training data (all data, not just that where
          logged and model actions match) after which we update the state of the evaluated model.
docstr_tok: ["Agruments",":","eval_model_update_critical_weight",":","Maximum","total","weight","of","training","data","(","all","data",",","not","just","that","where","logged","and","model","actions","match",")","after","which","we","update","the","state","of","the","evaluated","model","."]
code: def __init__(
      self,
      eval_model_update_critical_weight: Optional[float] = None,
      recmetric_module: Optional[RecMetricModule] = None,
      log_every_n_steps: int = 0,
      *args,
      **kwargs,
  ):
      """
      Agruments:
          eval_model_update_critical_weight: Maximum total weight of training data (all data, not just that where
              logged and model actions match) after which we update the state of the evaluated model.
      """
      super().__init__(*args, **kwargs)
      self.eval_module: Optional[BaseOfflineEval] = None
      self.eval_model_update_critical_weight = (
          eval_model_update_critical_weight
      )
      self.recmetric_module = recmetric_module
      self.log_every_n_steps = log_every_n_steps
      assert (log_every_n_steps > 0) == (
          recmetric_module is not None
      ), "recmetric_module should be provided if and only if log_every_n_steps > 0"
  
imports: import logging
  from abc import ABC, abstractmethod
  from typing import final, Optional
  import torch
  from reagent.core.types import CBInput
  from reagent.core.utils import get_rank
  from reagent.evaluation.cb.base_evaluator import BaseOfflineEval
  from reagent.models.cb_base_model import UCBBaseModel
  from reagent.models.mab import MABBaseModel
  from reagent.training.cb.utils import add_chosen_arm_features, get_model_actions
  from reagent.training.reagent_lightning_module import ReAgentLightningModule
  from torchrec.metrics.metric_module import RecMetricModule
label_desc: Use image node_id 1 to create a new BaseCBTrainerWithEval object from inherited base classes: ABC, ReAgentLightningModule with example: obj = BaseCBTrainerWithEval(eval_model_update_critical_weight, recmetric_module, log_every_n_steps)