class_docstr: Run Model on all categories.
docstr: Save model results to csv. Useful for tracking model drift.
  
  Args:
      config (Union[DictConfig, ListConfig]): Model config which is also added to csv for complete picture.
      results (Dict): Metrics from trainer.test
docstr_tok: ["Save","model","results","to","csv",".","Useful","for","tracking","model","drift",".","Args",":","config","(","Union","[","DictConfig",",","ListConfig","]",")",":","Model","config","which","is","also","added","to","csv","for","complete","picture",".","results","(","Dict",")",":","Metrics","from","trainer.test"]
code: def _save_to_csv(
      self, config: Union[DictConfig, ListConfig], results: Dict
  ):
      """Save model results to csv. Useful for tracking model drift.
  
      Args:
          config (Union[DictConfig, ListConfig]): Model config which is also added to csv for complete picture.
          results (Dict): Metrics from trainer.test
      """
      # Save results in csv for tracking model drift
      model_metrics = flatten_sweep_params(config)
      # convert dict, list values to string
      for key, val in model_metrics.items():
          if isinstance(val, (list, dict, ListConfig, DictConfig)):
              model_metrics[key] = str(val)
      for metric, value in results.items():
          model_metrics[metric] = value
      model_metrics_df = pd.DataFrame([model_metrics])
  
      result_path = Path(
          f"tests/artifacts/{datetime.now().strftime('%m_%d_%Y')}.csv"
      )
      result_path.parent.mkdir(parents=True, exist_ok=True)
      if not result_path.is_file():
          model_metrics_df.to_csv(result_path)
      else:
          model_metrics_df.to_csv(result_path, mode="a", header=False)
  
imports: import itertools
  import math
  import multiprocessing
  import random
  import tempfile
  from concurrent.futures import ProcessPoolExecutor
  from datetime import datetime
  from pathlib import Path
  from typing import Dict, List, Union
  import numpy
  import pandas
  import torch
  from omegaconf import DictConfig, ListConfig, OmegaConf
  from pytorch_lightning import seed_everything
  from anomalib.utils.sweep.config import flatten_sweep_params
  from tests.helpers.dataset import get_dataset_path
  from tests.helpers.model import model_load_test, setup_model_train
label_desc: Use image node_id 2 for calling the TestModel obj's underlying member method code with example usage: obj._save_to_csv(config, results) without return types