code: def test_chemberta_finetuning(
      smiles_regression_dataset, smiles_multitask_regression_dataset
  ):
      # test regression
      tokenizer_path = "seyonec/PubChem10M_SMILES_BPE_60k"
      model = Chemberta(
          task="regression", tokenizer_path=tokenizer_path
      )
      loss = model.fit(smiles_regression_dataset, nb_epoch=1)
      eval_score = model.evaluate(
          smiles_regression_dataset,
          metrics=dc.metrics.Metric(dc.metrics.mean_absolute_error),
      )
      assert loss, eval_score
      prediction = model.predict(smiles_regression_dataset)
      assert prediction.shape == smiles_regression_dataset.y.shape
  
      # test multitask regression
      model = Chemberta(
          task="mtr", tokenizer_path=tokenizer_path, n_tasks=2
      )
      loss = model.fit(smiles_multitask_regression_dataset, nb_epoch=1)
      eval_score = model.evaluate(
          smiles_multitask_regression_dataset,
          metrics=dc.metrics.Metric(dc.metrics.mean_absolute_error),
      )
      assert loss, eval_score
      prediction = model.predict(smiles_multitask_regression_dataset)
      assert (
          prediction.shape
          == smiles_multitask_regression_dataset.y.shape
      )
  
      # test classification
      y = np.random.choice(
          [0, 1], size=smiles_regression_dataset.y.shape
      )
      dataset = dc.data.NumpyDataset(
          X=smiles_regression_dataset.X,
          y=y,
          w=smiles_regression_dataset.w,
          ids=smiles_regression_dataset.ids,
      )
      model = Chemberta(
          task="classification", tokenizer_path=tokenizer_path
      )
      loss = model.fit(dataset, nb_epoch=1)
      eval_score = model.evaluate(
          dataset, metrics=dc.metrics.Metric(dc.metrics.recall_score)
      )
      assert eval_score, loss
      prediction = model.predict(dataset)
      # logit scores
      assert prediction.shape == (dataset.y.shape[0], 2)
  
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 2 for calling a global function with example usage: test_chemberta_finetuning(smiles_regression_dataset, smiles_multitask_regression_dataset) without return types