训练中使用logging来记录
首先
logger = logging.getLogger(__name__)
然后
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S",
level=logging.INFO,
)
logger.setLevel(logging.INFO)
记录的时候
logger.info(f"训练完成度:{temp}")