Skip to content

Centralize logging for uniform CLI output #12

Description

@tonyzamyatin

Description:

Currently, additional logging outside of WandB is handled via dispersed print statements throughout the code, which do not follow a uniform format. This results in inconsistent and sometimes cluttered CLI output, for example:

INFO: Precomputing 13941 items...
[19:27:41] Conflicting single bond directions around double bond at index 7.
[19:27:41]   BondStereo set to STEREONONE and single bond directions set to NONE.
[19:27:41] Conflicting single bond directions around double bond at index 7.
[19:27:41]   BondStereo set to STEREONONE and single bond directions set to NONE.
INFO: Precomputation finished in 51.36s.
INFO: Precomputing 774 items...
INFO: Precomputation finished in 2.84s.
INFO: Precomputing 775 items...
INFO: Precomputation finished in 2.90s.
INFO: Updating global config with properties of training dataset
INFO: Final config:
data_ingestor:
  data_source:
    _target_: chemtorch.data_ingestor.data_source.SingleCSVSource
    data_path: data/rdb7/barriers/forward/data.csv
    ...
dataset:
  _target_: chemtorch.dataset.GraphDataset
  ...
  representation:
    _target_: chemtorch.representation.graph.cgr.CGR
    ...
dataloader:
  _target_: torch_geometric.loader.DataLoader
  batch_size: 50
  ...
model:
  ...
routine:
  ...
...
Total parameters: 305,921
GNN(
  (encoder): DirectedEdgeEncoder(
    (edge_init): Linear(in_features=110, out_features=128, bias=True)
  )
  (layer_stack): DMPNNStack(
    (dmpnn_blocks): LayerStack(
      (layers): ModuleList(
        (0-2): 3 x DMPNNBlock(
          (graph_conv): DMPNNConv()
          (activation): ReLU()
          (norm): Identity()
          (dropout): Dropout(p=0.1, inplace=False)
          (ffn_norm_in): Identity()
          (ffn_linear1): Linear(in_features=128, out_features=256, bias=True)
          (ffn_linear2): Linear(in_features=256, out_features=128, bias=True)
          (ffn_act_fn): ReLU()
          (ffn_norm_out): Identity()
          (ffn_dropout1): Dropout(p=0.1, inplace=False)
          (ffn_dropout2): Dropout(p=0.1, inplace=False)
        )
      )
    )
    (edge_to_node_embedding): EdgeToNodeEmbedding(
      (linear): Linear(in_features=216, out_features=128, bias=True)
      (activation): ReLU()
      (aggregation): SumAggregation()
    )
  )
  (pool): GlobalPool()
  (head): MLP(
    (activation): ReLU()
    (layers): Sequential(
      (0): Dropout(p=0.02, inplace=False)
      (1): Linear(in_features=128, out_features=128, bias=True)
      (2): ReLU()
      (3): Dropout(p=0.02, inplace=False)
      (4): Linear(in_features=128, out_features=1, bias=True)
    )
  )
)

Proposal:
Implement a centralized, multilevel logging system (e.g., using Python’s built-in logging module) to:

  • Replace print statements with proper logging calls (e.g., logger.info, logger.warning, logger.error, etc.).
  • Unify log formatting for all output, making CLI output consistent and easy to follow.
  • Support multiple log levels (DEBUG, INFO, WARNING, ERROR).
  • Make future maintenance easier and improve developer/user experience.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions