示例#1
0
    def _initialize(self):
        """Initialize non-common things."""
        self.save_distillation_dir = None
        if not self.hyper_params.is_student:
            # Since raining teacher do not require DistillationBuffer,
            # it overloads DQNAgent._initialize.
            print("[INFO] Teacher mode.")
            DQNAgent._initialize(self)
            self.make_distillation_dir()
        else:
            # Training student or generating distillation data(test).
            print("[INFO] Student mode.")
            self.softmax_tau = 0.01

            build_args = dict(
                hyper_params=self.hyper_params,
                log_cfg=self.log_cfg,
                env_name=self.env_info.name,
                state_size=self.env_info.observation_space.shape,
                output_size=self.env_info.action_space.n,
                is_test=self.is_test,
                load_from=self.load_from,
            )
            self.learner = build_learner(self.learner_cfg, build_args)
            self.dataset_path = self.hyper_params.dataset_path

            self.memory = DistillationBuffer(self.hyper_params.batch_size,
                                             self.dataset_path)
            if self.is_test:
                self.make_distillation_dir()
示例#2
0
    def _initialize(self):
        """Initialize non-common things."""
        self.save_distillation_dir = None
        if not self.args.student:
            # Since raining teacher do not require DistillationBuffer,
            # it overloads DQNAgent._initialize.

            DQNAgent._initialize(self)
            self.make_distillation_dir()
        else:
            # Training student or generating distillation data(test).

            self.softmax_tau = 0.01
            self.learner = build_learner(self.learner_cfg)
            self.dataset_path = self.hyper_params.dataset_path

            self.memory = DistillationBuffer(self.hyper_params.batch_size,
                                             self.dataset_path)
            if self.args.test:
                self.make_distillation_dir()