code: def test_wandblogger():
      """Test logging to Weights & Biases."""
      # Load dataset and Models
      tasks, datasets, transformers = dc.molnet.load_delaney(
          featurizer="ECFP", splitter="random"
      )
      train_dataset, valid_dataset, test_dataset = datasets
      metric = dc.metrics.Metric(dc.metrics.pearson_r2_score)
      wandblogger = dc.models.WandbLogger(
          anonymous="allow", save_run_history=True
      )
  
      pytorch_model = torch.nn.Sequential(
          torch.nn.Linear(1024, 1000),
          torch.nn.Dropout(p=0.5),
          torch.nn.Linear(1000, 1),
      )
      model = dc.models.TorchModel(
          pytorch_model,
          dc.models.losses.L2Loss(),
          wandb_logger=wandblogger,
      )
      vc_train = dc.models.ValidationCallback(
          train_dataset, 1, [metric]
      )
      vc_valid = dc.models.ValidationCallback(
          valid_dataset, 1, [metric]
      )
      model.fit(
          train_dataset, nb_epoch=10, callbacks=[vc_train, vc_valid]
      )
      # call model.fit again to test multiple fit() calls
      model.fit(
          train_dataset, nb_epoch=10, callbacks=[vc_train, vc_valid]
      )
      wandblogger.finish()
  
      run_data = wandblogger.run_history
      valid_score = model.evaluate(
          valid_dataset, [metric], transformers
      )
  
      assert math.isclose(
          valid_score["pearson_r2_score"],
          run_data["eval/pearson_r2_score_(1)"],
          abs_tol=0.0005,
      )
  
file_path: deepchem/deepchem/models/tests/test_torch_model.py
imports: import os
  import pytest
  import deepchem
  import numpy
  import math
  import unittest
label_desc: Use image node_id 11 for calling a global function with example usage: test_wandblogger() without return types