mirror of
https://github.com/wassname/ray.git
synced 2026-09-12 12:51:15 +08:00
[RLlib] Add 2 Transformer learning test cases on StatelessCartPole (PPO and IMPALA). (#8624)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user