code: def test_chemberta_save_reload(tmpdir):
      tokenizer_path = "seyonec/PubChem10M_SMILES_BPE_60k"
      model = Chemberta(
          task="regression",
          tokenizer_path=tokenizer_path,
          model_dir=tmpdir,
      )
      model._ensure_built()
      model.save_checkpoint()
  
      model_new = Chemberta(
          task="regression",
          tokenizer_path=tokenizer_path,
          model_dir=tmpdir,
      )
      model_new.restore()
  
      old_state = model.model.state_dict()
      new_state = model_new.model.state_dict()
      matches = [
          torch.allclose(old_state[key], new_state[key])
          for key in old_state.keys()
      ]
  
      # all keys values should match
      assert all(matches)
  
file_path: deepchem/deepchem/models/torch_models/tests/test_chemberta.py
imports: import os
  import deepchem
  import numpy
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_chemberta_save_reload(tmpdir) without return types