[RLlib] Add 2 Transformer learning test cases on StatelessCartPole (PPO and IMPALA). (#8624)

This commit is contained in:
Sven Mika
2020-05-27 10:19:47 +02:00
committed by GitHub
parent b0bb0584fb
commit 0422e9c5a8
14 changed files with 133 additions and 33 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ if __name__ == "__main__":
"model": {
"custom_model": GTrXLNet,
"max_seq_len": 50,
"custom_options": {
"custom_model_config": {
"num_transformer_units": 1,
"attn_dim": 64,
"num_heads": 2,
+1 -1
View File
@@ -53,7 +53,7 @@ if __name__ == "__main__":
"num_workers": 0,
"model": {
"custom_model": "custom_loss",
"custom_options": {
"custom_model_config": {
"input_files": args.input_files,
},
},
+1 -1
View File
@@ -36,7 +36,7 @@ if __name__ == "__main__":
"model": {
"custom_model": "my_model",
# Extra config passed to the custom model's c'tor as kwargs.
"custom_options": {
"custom_model_config": {
"cnn_shape": cnn_shape_torch if args.torch else cnn_shape,
},
"max_seq_len": 20,
+3 -2
View File
@@ -38,7 +38,8 @@ class CustomLossModel(TFModelV2):
@override(ModelV2)
def custom_loss(self, policy_loss, loss_inputs):
# Create a new input reader per worker.
reader = JsonReader(self.model_config["custom_options"]["input_files"])
reader = JsonReader(
self.model_config["custom_model_config"]["input_files"])
input_ops = reader.tf_input_ops()
# Define a secondary loss by building a graph copy with weight sharing.
@@ -80,7 +81,7 @@ class DeprecatedCustomLossModelV1(Model):
def custom_loss(self, policy_loss, loss_inputs):
# create a new input reader per worker
reader = JsonReader(self.options["custom_options"]["input_files"])
reader = JsonReader(self.options["custom_model_config"]["input_files"])
input_ops = reader.tf_input_ops()
# define a secondary loss by building a graph copy with weight sharing