#3478·deepchem

Logging loss with multiple objective functions

Author: arunppsgCreated Jul 14, 2023Updated Sep 9, 2026

By default, ModularTorchModel logs only the overall loss. An utility to log individual loss values will be useful.

Example: In GroverPretrain, the loss consists of three components - functional group loss, atom vocab prediction loss and bond vocab prediction loss but we only return the overall loss.

https://github.com/deepchem/deepchem/blob/d3a2e89671b5c55b2143e2159ee2ece045068aeb/deepchem/models/losses.py#L905-L907

Some ideas:

  • we can pass log_frequency argument and log values directly in GroverPretrainLoss
  • Have GroverPretrainLoss return a dictionary containing overall loss and other losses