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

Rollout Problem #5

Open
baitingzbt opened this issue Jun 30, 2023 · 2 comments
Open

Rollout Problem #5

baitingzbt opened this issue Jun 30, 2023 · 2 comments

Comments

@baitingzbt
Copy link

When rolling out policy here. The nested function policy(index) ALWAYS assumes dreamer is None (i.e. never going to the else section).

@famishedrover
Copy link

I think its correct, can put a debug point to be sure, but

def fun1():
  dreamer = None

  def fun2():
    nonlocal dreamer
    if dreamer == None: 
      print("dreamer was none")
      dreamer = 1
    else : 
      print("dreamer working!")
  return fun2

myfunc = fun1()
myfunc()
myfunc()
myfunc()

prints the following :

dreamer was none
dreamer working!
dreamer working!

which is as expected.

@baitingzbt
Copy link
Author

Hi I think I see the problem now after more testing. The default config results in a train_every=0.76<1, which causes the trainer to create a new function object for rollout every step.

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