facebookresearch / ReAgent

A platform for Reasoning systems (Reinforcement Learning, Contextual Bandits, etc.)
https://reagent.ai
BSD 3-Clause "New" or "Revised" License
3.58k stars 521 forks source link

Add check if the logger is set in dqn_trainer #650

Closed dkorenkevych closed 2 years ago

dkorenkevych commented 2 years ago

Summary: In the base LightningModule class we define an optional logger property which may be initialized to None, while in DQNtrainer._log_dqn method we try to access the logger object without checking first if it was initialized. The issue surfaced when trying to run unit tests analogous to those in test_qrdqn. This commit adds a check whether the logger is initialized prior to attempting to use it. Interestingly, the analogous QRDQNTrainer class implementation does not use the logger property for logging, perhaps it's redundant?

Differential Revision: D37529027

facebook-github-bot commented 2 years ago

This pull request was exported from Phabricator. Differential Revision: D37529027