You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change API for remote function declaration, actor instantiation, and actor method invocation. (ray-project#541)
* Direction substitution of @ray.remote -> @ray.task.
* Changes to make '@ray.task' work.
* Instantiate actors with Class.remote() instead of Class().
* Convert actor instantiation in tests and examples from Class() to Class.remote().
* Change actor method invocation from object.method() to object.method.remote().
* Update tests and examples to invoke actor methods with .remote().
* Fix bugs in jenkins tests.
* Fix example applications.
* Change @ray.task back to @ray.remote.
* Changes to make @ray.actor -> @ray.remote work.
* Direct substitution of @ray.actor -> @ray.remote.
* Fixes.
* Raise exception if @ray.actor decorator is used.
* Simplify ActorMethod class.
Copy file name to clipboardExpand all lines: doc/source/example-a3c.rst
+10-4
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ We use a Ray Actor to simulate the environment.
73
73
import numpy as np
74
74
import ray
75
75
76
-
@ray.actor
76
+
@ray.remote
77
77
classRunner(object):
78
78
"""Actor object to start running simulation on workers.
79
79
Gradient computation is also executed on this object."""
@@ -127,7 +127,7 @@ global model parameters. The main training script looks like the following.
127
127
128
128
# Start gradient calculation tasks on each actor
129
129
parameters = policy.get_weights()
130
-
gradient_list = [agent.compute_gradient(parameters) for agent in agents]
130
+
gradient_list = [agent.compute_gradient.remote(parameters) for agent in agents]
131
131
132
132
whileTrue: # Replace with your termination condition
133
133
# wait for some gradient to be computed - unblock as soon as the earliest arrives
@@ -147,6 +147,12 @@ global model parameters. The main training script looks like the following.
147
147
Benchmarks and Visualization
148
148
----------------------------
149
149
150
-
For the :code:`PongDeterministic-v3` and an Amazon EC2 m4.16xlarge instance, we are able to train the agent with 16 workers in around 15 minutes. With 8 workers, we can train the agent in around 25 minutes.
150
+
For the :code:`PongDeterministic-v3` and an Amazon EC2 m4.16xlarge instance, we
151
+
are able to train the agent with 16 workers in around 15 minutes. With 8
152
+
workers, we can train the agent in around 25 minutes.
151
153
152
-
You can visualize performance by running :code:`tensorboard --logdir [directory]` in a separate screen, where :code:`[directory]` is defaulted to :code:`./results/`. If you are running multiple experiments, be sure to vary the directory to which Tensorflow saves its progress (found in :code:`driver.py`).
154
+
You can visualize performance by running
155
+
:code:`tensorboard --logdir [directory]` in a separate screen, where
156
+
:code:`[directory]` is defaulted to :code:`./results/`. If you are running
157
+
multiple experiments, be sure to vary the directory to which Tensorflow saves
0 commit comments