示例#1
0
文件: cifar.py 项目: Kaushalya/lab
    def __call__(self):
        logger_util.add_model_indicators(self.model)

        logger.add_indicator(Queue("train_loss", 20, True))
        logger.add_indicator(Histogram("test_loss", True))
        logger.add_indicator(Histogram("accuracy", True))

        for _ in self.loop:
            self._train()
            self._test()
            self.__log_model_params()
示例#2
0
    def __call__(self):
        # Training and testing
        logger_util.add_model_indicators(self.model)

        logger.add_indicator(Queue("train_loss", 20, True))
        logger.add_indicator(Histogram("test_loss", True))
        logger.add_indicator(Histogram("accuracy", True))
        logger.add_indicator(IndexedScalar('test_sample_loss'))
        logger.add_indicator(IndexedScalar('test_sample_pred'))

        test_data = np.array([d[0].numpy() for d in self.test_loader.dataset])
        logger.save_numpy("test_data", test_data)

        for _ in self.loop:
            self._train()
            self._test()
            self.__log_model_params()
示例#3
0
文件: pytorch.py 项目: Kaushalya/lab
def add_model_indicators(model: torch.nn.Module, model_name: str = "model"):
    for name, param in model.named_parameters():
        if param.requires_grad:
            logger.add_indicator(Histogram(f"{model_name}.{name}"))
            logger.add_indicator(Histogram(f"{model_name}.{name}.grad"))
示例#4
0
    def startup(self):
        logger_util.add_model_indicators(self.model)

        logger.add_indicator(Queue("train_loss", 20, True))
        logger.add_indicator(Histogram("test_loss", True))
        logger.add_indicator(Histogram("accuracy", True))