Skip to content

Bind tb_logger tag to engine dataset name? #2042

Answered by vfdev-5
aksg87 asked this question in Q&A
Discussion options

You must be logged in to vote

As an alternative, is there a nice way to bind the tag to the engine's dataloader instance/name? This would make it easier to manage the same engine running on different dataloaders?

There is a funny way to create a dynamic tag:

import torch
from ignite.engine import Engine, Events

evaluator = Engine(lambda e, b: print(b.item(), end=" "))
train_loader = torch.tensor([1, 2, 3, 4, 5])
val_loader = torch.tensor([11, 21, 31, 41, 51])

def compute_metrics():
    evaluator.run(train_loader)
    evaluator.run(val_loader)

class DataTag:
    def __init__(self, engine):
        self.engine = engine
    def __repr__(self):
        return self.engine.state.dataloader.dname


train_loader.dname = "…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@aksg87
Comment options

@sdesrozis
Comment options

Comment options

You must be logged in to vote
2 replies
@sdesrozis
Comment options

@sdesrozis
Comment options

Answer selected by aksg87
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants