code: def log_artifacts(self, trainer: ITrainer) -> None:
      if not self.is_local_rank_0:
          return None
      super().log_artifacts(trainer)
      model = trainer.model
      image_folder = self._prepare_folder(trainer, check_num_keep=False)
      sample_method = getattr(model, "sample", None)
      if sample_method is None:
          raise ValueError(
              "`sample` should be implemented when `SizedGeneratorCallback` is used "
              "(and the `sample` method should support accepting `size` kwarg)"
          )
      resolution = getattr(model, "img_size", 32)
      with eval_context(model):
          for i in range(1, 4):
              size = resolution * 2**i
              batch_size = 1 if size > 256 else 4
              sampled = sample_method(batch_size, size=size).cpu()
              path = os.path.join(
                  image_folder, f"sampled_{size}x{size}.png"
              )
              save_images(sampled, path)
  
file_path: carefree-learn/cflearn/callbacks/generator.py
imports: import os
  from cftool.cv import save_images
  from cftool.array import to_device
  from .general import ImageCallback
  from ..misc.toolkit import eval_context
  from ..schema import ITrainer
  from ..schema import TrainerCallback
  from ..constants import INPUT_KEY
  from ..constants import LABEL_KEY
  from ..models.schemas.cv import GeneratorMixin
label_desc: Use image node_id 1 for calling the SizedGeneratorCallback obj's underlying member method code with example usage: obj.log_artifacts(trainer) and returns: None