2023-05-12 07:56:44 +00:00
|
|
|
import logging
|
|
|
|
from pathlib import Path
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
import xgboost as xgb
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class BaseTensorboardLogger:
|
2023-05-14 14:08:00 +00:00
|
|
|
def __init__(self, logdir: Path, activate: bool = True):
|
2023-05-12 07:56:44 +00:00
|
|
|
logger.warning("Tensorboard is not installed, no logs will be written."
|
|
|
|
"Ensure torch is installed, or use the torch/RL docker images")
|
|
|
|
|
2023-05-14 16:05:49 +00:00
|
|
|
def log_scalar(self, tag: str, scalar_value: Any, step: int):
|
2023-05-12 07:56:44 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
class BaseTensorBoardCallback(xgb.callback.TrainingCallback):
|
|
|
|
|
2023-05-14 14:08:00 +00:00
|
|
|
def __init__(self, logdir: Path, activate: bool = True):
|
2023-05-12 07:56:44 +00:00
|
|
|
logger.warning("Tensorboard is not installed, no logs will be written."
|
|
|
|
"Ensure torch is installed, or use the torch/RL docker images")
|
|
|
|
|
|
|
|
def after_iteration(
|
|
|
|
self, model, epoch: int, evals_log: xgb.callback.TrainingCallback.EvalsLog
|
|
|
|
) -> bool:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def after_training(self, model):
|
|
|
|
return model
|