facebookresearch / EGG

EGG: Emergence of lanGuage in Games
MIT License
291 stars 103 forks source link

Add batch_id in game call and logging strategy #230

Closed nicofirst1 closed 3 years ago

nicofirst1 commented 3 years ago

Problem: The logging strategy class takes no consideration of the current batch id.

Desired outcome: It can be desirable to log information based on the batch_id (typically with the formula batch_id%logging_step) when dealing with large data types such as images.

Proposed Solution: in this PR, this issue is addressed by passing to the self.game() call in the train_epoch and eval methods an additional int which is the batch_id. Moreover a filtering pass had been added inside the from_iterable method of the Interaction class. This filtering is based on a new method is_empty that checks if the current interaction is empty.

Downsides: the introduction of this new batch_id parameter probably breaks the compatibility with most game() calls. On the other side, compatibility can be enforced again by simply adding an empty argument inside each game forward method.