-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Add networksettings to reward providers #4982
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
Changes from all commits
b68fbdc
4f83bbf
00eb2b2
d971b14
55ebc79
fbb3ebe
cc72294
22db076
b43e20c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,7 +183,7 @@ def to_settings(self) -> type: | |
class RewardSignalSettings: | ||
gamma: float = 0.99 | ||
strength: float = 1.0 | ||
normalize: bool = False | ||
network_settings: NetworkSettings = attr.ib(factory=NetworkSettings) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would make this one optional and if it is None, then use the Policy's network settings rather than our own defaults. How does that sound ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd prefer to use our defaults since it's possible the policy has significantly more capacity than is needed i.e. the Crawler policy of 3/512 vs what we use for the discriminator 2/128. That being said, I also realize this enables users to specify There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not opposed to either route, they have their own pros/cons. Either way as long as it's documented it should be fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im not sure how future proof it is for multi-agent scenarios. We could have different policies to select from. Additionally, we currently create reward signals in the |
||
|
||
@staticmethod | ||
def structure(d: Mapping, t: type) -> Any: | ||
|
@@ -199,28 +199,41 @@ def structure(d: Mapping, t: type) -> Any: | |
enum_key = RewardSignalType(key) | ||
t = enum_key.to_settings() | ||
d_final[enum_key] = strict_to_cls(val, t) | ||
# Checks to see if user specifying deprecated encoding_size for RewardSignals. | ||
# If network_settings is not specified, this updates the default hidden_units | ||
# to the value of encoding size. If specified, this ignores encoding size and | ||
# uses network_settings values. | ||
if "encoding_size" in val: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Backward compatible with old configs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you ad a comment around this code so we will remember it ? |
||
logger.warning( | ||
"'encoding_size' was deprecated for RewardSignals. Please use network_settings." | ||
) | ||
# If network settings was not specified, use the encoding size. Otherwise, use hidden_units | ||
if "network_settings" not in val: | ||
d_final[enum_key].network_settings.hidden_units = val[ | ||
"encoding_size" | ||
] | ||
return d_final | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class GAILSettings(RewardSignalSettings): | ||
encoding_size: int = 64 | ||
learning_rate: float = 3e-4 | ||
encoding_size: Optional[int] = None | ||
use_actions: bool = False | ||
use_vail: bool = False | ||
demo_path: str = attr.ib(kw_only=True) | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class CuriositySettings(RewardSignalSettings): | ||
encoding_size: int = 64 | ||
learning_rate: float = 3e-4 | ||
encoding_size: Optional[int] = None | ||
|
||
|
||
@attr.s(auto_attribs=True) | ||
class RNDSettings(RewardSignalSettings): | ||
encoding_size: int = 64 | ||
learning_rate: float = 1e-4 | ||
encoding_size: Optional[int] = None | ||
|
||
|
||
# SAMPLERS ############################################################################# | ||
|
Uh oh!
There was an error while loading. Please reload this page.