class_docstr: Test save_weights
class_docstr_tok: ["Test","save_weights"]
code: def test_with_trainer(self):
      self.op.trainer.save("./test_save")
      filepath = Path("./test_save").joinpath(STATE_CHECKPOINT_NAME)
      self.assertTrue(Path(filepath).is_file())
  
      with self.assertRaises(FileExistsError):
          self.op.trainer.save("./test_save", overwrite=False)
  
      out1 = self.op(self.x)
      self.op.trainer.load("./test_save")
      out2 = self.op(self.x)
      self.assertTrue((out1 == out2).all())
  
file_path: towhee/tests/unittests/trainer/test_weights.py
imports: import unittest
  import torch
  import torchvision
  from pathlib import Path
  from towhee.trainer.utils.trainer_utils import STATE_CHECKPOINT_NAME
  from towhee.trainer.training_config import TrainingConfig
  from towhee.operator import NNOperator
  from towhee.trainer.modelcard import ModelCard
label_desc: Use image node_id 1 for calling the TestWeights obj's underlying member method code with example usage: obj.test_with_trainer() without return types