-
Notifications
You must be signed in to change notification settings - Fork 93
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
Conversation
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.
There was a problem hiding this 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, |
There was a problem hiding this comment.
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, ...] = (), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)
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 eachModuleExplorer
sub-process.