wisnunugroho21 / reinforcement_learning_ppo_rnd

Deep Reinforcement Learning by using Proximal Policy Optimization and Random Network Distillation in Tensorflow 2 and Pytorch with some explanation
GNU General Public License v3.0
48 stars 5 forks source link

When will RND_predictor_Model().lets_init_weights be called? #5

Open wangyuhuix opened 4 years ago

wangyuhuix commented 4 years ago

I notice that you have write the initialization code for RND_predictor_Model. But I failed to find where and when it has been called.

class RND_predictor_Model(nn.Module):
    def init_state_predict_weights(self, m):
        for name, param in m.named_parameters():
            if 'bias' in name:
                nn.init.constant_(param, 0.01)
            elif 'weight' in name:
                nn.init.constant_(param, 1)
wisnunugroho21 commented 4 years ago

it will be called inside lets_init_weights in RND_predictor_Model class

def lets_init_weights(self): 
      self.state_predict_layer.apply(self.init_state_predict_weights)
wangyuhuix commented 4 years ago

Thanks for your reply. But when will lets_init_weights() be called? I have run the ppo_rnd_taxi_final_blow_pytorch.py, but it seems that lets_init_weights () is never called during the running process.

wisnunugroho21 commented 4 years ago

i have comment the code to init weights. just uncomment the code on line 551

if load_weights:
        agent.load_weights()
        print('Weight Loaded')
'''else :
        agent.lets_init_weights()
        print('Init Weight')'''