Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Correctly Integrate LSTM or GRU into the SAC Algorithm #270

Open
namjiwon1023 opened this issue Jan 17, 2024 · 1 comment
Open

How to Correctly Integrate LSTM or GRU into the SAC Algorithm #270

namjiwon1023 opened this issue Jan 17, 2024 · 1 comment

Comments

@namjiwon1023
Copy link

I have referred to some people's work on adding RNNs to reinforcement learning algorithms, but strangely, almost everyone's code implementation is different. So I would like to ask how you integrate LSTM or GRU into the SAC algorithm.

In my implementation, I have incorporated LSTM into both the actor and critic networks. The image below shows the LSTM added to the actor network.

image
image

And during training, I initialize the hidden state input of the LSTM.

image
image

I also initialize the input hidden state when the environment is reset.
image

I would like to ask if my method of adding this is correct. How did you incorporate RNN into SAC when you did it?

Thank you, I look forward to your reply.

@Denys88
Copy link
Owner

Denys88 commented Jan 22, 2024

Do you aware of any reference implementations? There are couple of ways how it can be done. Problem tht in PPO I am reusing old hidden state from previous step but in SAC you can have very old sequences so you cannot reuse hidden state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants