base_logger.py 324 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import os
from abc import ABC, abstractmethod

class BaseLogger(ABC):
    def __init__(self, save_dir):
        self.save_dir = save_dir
        os.makedirs(self.save_dir, exist_ok=True)

    @abstractmethod
    def log_metrics(self, metrics, prefix=None):
        pass

    @abstractmethod
    def close(self):
        pass