code: def save_model(
      model_dir: str,
      model_name: str,
      params: Union[np.ndarray, jnp.ndarray],
      obs_params: Union[np.ndarray, jnp.ndarray] = None,
      best: bool = False,
  ) -> None:
      """Save policy parameters to the specified directory.
  
      Args:
          model_dir - Directory to save the model.
          model_name - Filename.
          params - The parameters to save.
          obs_params - The observation parameters to save
          best - Whether to save a copy as best.npz.
      """
  
      model_file = os.path.join(model_dir, "{}.npz".format(model_name))
      np.savez(
          model_file,
          params=np.array(params),
          obs_params=np.array(obs_params),
      )
      if best:
          model_file = os.path.join(model_dir, "best.npz")
          np.savez(
              model_file,
              params=np.array(params),
              obs_params=np.array(obs_params),
          )
  
file_path: evojax/evojax/util.py
imports: import os
  import logging
  import numpy
  from typing import Union
  from typing import Tuple
  from typing import Callable
  import jax.numpy
  from jax import tree_util
  from flax.core import FrozenDict
label_desc: Use image node_id 4 for calling a global function with example usage: save_model(model_dir, model_name, params, obs_params, best) without return types