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] Multiprocessing fix and change to avoid Issue #391 #393

Merged
merged 6 commits into from
Dec 4, 2024

Conversation

tvmarino
Copy link
Collaborator

The main from generate_bc_trajectories needs to be in a separate file otherwise cloudpickle fails. To avoid Issue #391 we also parse the gin config for mlgo_task_type in each ModuleExplorer sub-process.

convention. Initial fix to Issue google#391 by parsing the gin config sting
in ModuleExplorer instead of wrapping mlgo_task_type to pass it's
arguments directly.
generate_bc_trajectories into a separate file.
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, curious though why default values had to change?

@@ -742,7 +741,7 @@ def __init__(
clang_path: str = gin.REQUIRED,
mlgo_task_type: Type[env.MLGOTask] = gin.REQUIRED,
policy_paths: List[Optional[str]] = [],
exploration_frac: float = gin.REQUIRED,
exploration_frac: float = 1.0,
Copy link
Collaborator

Choose a reason for hiding this comment

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

wait why?

@@ -869,7 +868,7 @@ def select_best_exploration(
def gen_trajectories(
# pylint: disable=dangerous-default-value
data_path: str = gin.REQUIRED,
delete_flags: Tuple[str, ...] = gin.REQUIRED,
delete_flags: Tuple[str, ...] = (),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For both default parameter changes -- I realized that these should not be gin.REQUIRED and they have standard default values. For exploration_frac the normal behavior is to set it to 1.0 and not constrain the number of exploration steps, for delete_flags the default behavior should be not to delete any flags.

@@ -341,6 +338,8 @@ def __init__(
'reward_key not specified in ModuleExplorer initialization.')
self._reward_key = reward_key
kwargs.pop('reward_key', None)
gin_config_str = kwargs.pop('gin_config_str', None)
gin.parse_config(gin_config_str)
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a gin.clear_config() here. In test, for example, previous tests that do a gin.bind_parameter can mess things up.

separate issue: what we need to do with gin.bind_parameter in tests (in a maintainable way)

@tvmarino tvmarino merged commit 82dc72a into google:main Dec 4, 2024
15 checks passed
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