code: def main(config):
      env = StarCraft2Env(
          map_name=config["map"],
          seed=config["env_seed"],
          difficulty=config["difficulty"],
          replay_dir=config["replay_dir"],
      )
      env_info = env.get_env_info()
  
      config["n_actions"] = env_info["n_actions"]
      config["n_agents"] = env_info["n_agents"]
      config["state_shape"] = env_info["state_shape"]
      config["obs_shape"] = env_info["obs_shape"]
      config["episode_limit"] = env_info["episode_limit"]
  
      model = ComaModel(config=config)
      algorithm = COMA(
          model,
          n_actions=config["n_actions"],
          n_agents=config["n_agents"],
          grad_norm_clip=config["grad_norm_clip"],
          actor_lr=config["actor_lr"],
          critic_lr=config["critic_lr"],
          gamma=config["gamma"],
          td_lambda=config["td_lambda"],
      )
      agents = Agents(algorithm, config)
  
      # restore model here
      model_file = config["model_dir"] + "/coma.ckpt"
      if config["restore"] and os.path.isfile(model_file):
          agents.restore(model_file)
          print("model loaded: ", model_file)
  
      if config["test"]:
          test_by_sparse_reward(agents, config)
      else:
          run(env, agents, config)
  
      env.close()
  
file_path: PARL/benchmark/torch/coma/train.py
imports: from smac.env import StarCraft2Env
  import numpy
  import os
  from sc2_model import ComaModel
  from sc2_agent import Agents
  from parl.algorithms import COMA
  from parl.utils import summary
label_desc: Use image node_id 5 for calling a global function with example usage: main(config) without return types