tensorboard two value every step
🐛 Bug
two loss logged every step

To Reproduce
https://colab.research.google.com/drive/1d7a3fwzZOQobFk58QXEqmzziQf1-GJYS?usp=sharing
Code sample
https://colab.research.google.com/drive/1d7a3fwzZOQobFk58QXEqmzziQf1-GJYS?usp=sharing
import os
import torch
from torch.utils.data import Dataset
from pytorch_lightning import Trainer, LightningModule
import torch
from pytorch_lightning.callbacks import LearningRateMonitor

import logging
import os
import pytorch_lightning as pl
import argparse
from pytorch_lightning import loggers as pl_loggers

class RandomDataset(Dataset):
    def __init__(self, size, length):
        self.len = length
        self.data = torch.randn(length, size)

    def __getitem__(self, index):
        return self.data[index]

    def __len__(self):
        return self.len


class BoringModel(LightningModule):

    def __init__(self):
        """
        Testing PL Module
        Use as follows:
        - subclass
        - modify the behavior for what you want
        class TestModel(BaseTestModel):
            def training_step(...):
                # do your own thing
        or:
        model = BaseTestModel()
        model.training_epoch_end = None
        """
        super().__init__()
        self.layer = torch.nn.Linear(32, 2)

    def forward(self, x):
        return self.layer(x)

    def loss(self, batch, prediction):
        # An arbitrary loss to have a loss that updates the model weights during `Trainer.fit` calls
        return torch.nn.functional.mse_loss(prediction, torch.ones_like(prediction))

    def step(self, x):
        x = self.layer(x)
        out = torch.nn.functional.mse_loss(x, torch.ones_like(x))
        return out

    def training_step(self, batch, batch_idx):
        output = self.layer(batch)
        loss = self.loss(batch, output)
        self.log("train_loss:", loss, on_epoch=True)
        return {"loss": loss}

    def training_step_end(self, training_step_outputs):
        return training_step_outputs

    def training_epoch_end(self, outputs) -> None:
        torch.stack([x["loss"] for x in outputs]).mean()

    def validation_step(self, batch, batch_idx):
        output = self.layer(batch)
        loss = self.loss(batch, output)
        return {"x": loss}

    def validation_epoch_end(self, outputs) -> None:
        torch.stack([x['x'] for x in outputs]).mean()

    def test_step(self, batch, batch_idx):
        output = self.layer(batch)
        loss = self.loss(batch, output)
        return {"y": loss}

    def test_epoch_end(self, outputs) -> None:
        torch.stack([x["y"] for x in outputs]).mean()

    def configure_optimizers(self):
        optimizer = torch.optim.SGD(self.layer.parameters(), lr=0.1)
        lr_scheduler = torch.optim.lr_scheduler.StepLR(optimizer, step_size=1)
        return [optimizer], [lr_scheduler]


def run_test():
    class TestModel(BoringModel):

        def on_train_epoch_start(self) -> None:
            print('override any method to prove your bug')

    # fake data
    train_data = torch.utils.data.DataLoader(RandomDataset(32, 2000), batch_size=4)
    val_data = torch.utils.data.DataLoader(RandomDataset(32, 2000), batch_size=4)
    test_data = torch.utils.data.DataLoader(RandomDataset(32, 2000), batch_size=4)

    # model

    tb_logger = pl_loggers.TensorBoardLogger(os.path.join("logs", "test"))
    lr_logger = LearningRateMonitor(logging_interval='step') 
    model = TestModel()
    trainer = Trainer(
        default_root_dir=os.getcwd(),
        # limit_train_batches=1,
        # limit_val_batches=1,
        max_epochs=1,
        weights_summary=None,
        accumulate_grad_batches=2,
        gpus=1,
        gradient_clip_val=1,
        callbacks=[lr_logger],
        logger=tb_logger,
        log_every_n_steps=1
    )
    trainer.fit(model, train_data, val_data)
    trainer.test(test_dataloaders=test_data)


if __name__ == '__main__':
    run_test()
Expected behavior
only one loss logged every step
Environment
colab

CUDA:

GPU:

Tesla K80


available:         True
version:           10.1


Packages:

numpy:             1.18.5
pyTorch_debug:     False
pyTorch_version:   1.6.0+cu101
pytorch-lightning: 1.0.0rc2
tqdm:              4.41.1


System:

OS:                Linux
architecture:

64bit



processor:         x86_64
python:            3.6.9
version:           #1 SMP Thu Jul 23 08:00:38 PDT 2020