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

[RLlib] TF2 Bandit Agent #22838

Merged
merged 9 commits into from
Mar 21, 2022
Merged

[RLlib] TF2 Bandit Agent #22838

merged 9 commits into from
Mar 21, 2022

Conversation

gjoliver
Copy link
Member

@gjoliver gjoliver commented Mar 5, 2022

Why are these changes needed?

TF2 version of Bandit.

I also think these Bandit models need to save value outputs after applying UCB updates. Otherwise the UCB exploration won't really work.
Please help double check.

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • [*] Unit tests
    • Release tests
    • This PR is not tested :(

@gjoliver gjoliver changed the title [RLlib] TF2 Bendit Agent [RLlib] TF2 Bandit Agent Mar 10, 2022
@sven1977 sven1977 self-assigned this Mar 15, 2022
tf1, tf, tfv = try_import_tf()


class OnlineLinearRegression(tf.Module):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tf.Module if tf is not None else object

(in case tf is not installed)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if tf is not installed, I feel like we should just error whenever possible?
we need this module to be tf.Module so the weights of all the arms can be checkpointed actually.

@@ -32,7 +32,12 @@ def plot_model_weights(means, covs):
if __name__ == "__main__":
num_iter = 10
print("Running training for %s time steps" % num_iter)
trainer = BanditLinTSTrainer(env=WheelBanditEnv)
config = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this a command line arg, like in most other example scripts?

--framework=[tf|tf2|torch] and --eager-tracing.

You can copy paste this from any other example script, e.g. rllib/examples/attention_nets.py

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@sven1977 sven1977 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! Awesome to have Bandits frameworks-complete :)
Just a few nits before merging. Thank you for this PR Jun!

@sven1977 sven1977 merged commit d12977c into ray-project:master Mar 21, 2022
@gjoliver gjoliver deleted the bandits-tf branch April 1, 2022 07:00
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

Successfully merging this pull request may close these issues.

2 participants