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

[BC]Weighted bc training #416

Merged
merged 18 commits into from
Jan 17, 2025
Merged

Conversation

tvmarino
Copy link
Collaborator

Training code for the BC-Max algorithm which includes the tensorflow
code to train a new policy and to save it as a tf-policy and code to
compute the re-weighting for the supervised learning problem. This
required updates to SequenceExampleFeatureNames from
generate_bc_trajectories_lib.

or neither of them is set. Further, passes keep_temps to
```compilation_runner.get_workdir_context``` and ensures that the flag
and argument are not set at the same time.
explicit_temps_dir is not set and persistent_objects_path is set.
code to train a new policy and to save it as a tf-policy and code to
compute the re-weighting for the supervised learning problem. This
required updates to SequenceExampleFeatureNames from
generate_bc_trajectories_lib.
Copy link
Collaborator

@mtrofin mtrofin left a comment

Choose a reason for hiding this comment

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

lgtm with some nits, but please get Alekh's take on the algo side of things which I wouldn't be familiar with.

compiler_opt/rl/imitation_learning/weighted_bc_trainer.py Outdated Show resolved Hide resolved
compiler_opt/rl/imitation_learning/weighted_bc_trainer.py Outdated Show resolved Hide resolved
compiler_opt/rl/imitation_learning/weighted_bc_trainer.py Outdated Show resolved Hide resolved
compiler_opt/rl/imitation_learning/weighted_bc_trainer.py Outdated Show resolved Hide resolved
compiler_opt/rl/imitation_learning/weighted_bc_trainer.py Outdated Show resolved Hide resolved
int_labels = tf.cast(labels, tf.int32)
return tf.gather(weights_arr, int_labels)

def _loss_fn(self, y_true, y_pred, labels, weights_arr):
Copy link
Collaborator

Choose a reason for hiding this comment

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

_get_loss_fn?

@mtrofin mtrofin requested a review from alekh January 16, 2025 16:30
@tvmarino tvmarino merged commit 9915a6d into google:main Jan 17, 2025
11 checks passed
@tvmarino tvmarino deleted the weighted_bc_training branch January 17, 2025 15:38
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