render设置
render设置为false则可以避免在训练时渲染,节省时间和资源。
一般都是在超参数设置,但有时也直接在环境定义的时候修改,注意要根据具体情况来定。
比如:
need_render = (rank == 0) and not isEval
self.env = football_env.create_environment(
env_name=all_args.scenario_name, stacked=False,
logdir=log_dir,
representation=all_args.representation,
rewards='scoring' if isEval else all_args.rewards,
write_goal_dumps=False,
write_full_episode_dumps=need_render,
# render=need_render,
render=False,
dump_frequency=5 if need_render else 0,
number_of_left_players_agent_controls=self.num_agents,
number_of_right_players_agent_controls=0, )
# channel_dimensions=(48, 36))