mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
unify starting local cluster with attaching to existing cluster (#327)
This commit is contained in:
committed by
Philipp Moritz
parent
0e5b858324
commit
2040372084
@@ -15,7 +15,7 @@ parser.add_argument("--label-file", default="train.txt", type=str, help="File co
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
num_workers = 4
|
||||
ray.services.start_ray_local(num_workers=num_workers)
|
||||
ray.init(start_ray_local=True, num_workers=num_workers)
|
||||
|
||||
# Note we do not do sess.run(tf.initialize_all_variables()) because that would
|
||||
# result in a different initialization on each worker. Instead, we initialize
|
||||
|
||||
@@ -10,7 +10,7 @@ from tensorflow.examples.tutorials.mnist import input_data
|
||||
import hyperopt
|
||||
|
||||
if __name__ == "__main__":
|
||||
ray.services.start_ray_local(num_workers=3)
|
||||
ray.init(start_ray_local=True, num_workers=3)
|
||||
|
||||
# The number of sets of random hyperparameters to try.
|
||||
trials = 2
|
||||
|
||||
@@ -8,7 +8,7 @@ import tensorflow as tf
|
||||
from tensorflow.examples.tutorials.mnist import input_data
|
||||
|
||||
if __name__ == "__main__":
|
||||
ray.services.start_ray_local(num_workers=16)
|
||||
ray.init(start_ray_local=True, num_workers=16)
|
||||
|
||||
# Define the dimensions of the data and of the model.
|
||||
image_dimension = 784
|
||||
|
||||
@@ -108,7 +108,7 @@ def compute_gradient(model):
|
||||
return policy_backward(eph, epx, epdlogp, model), reward_sum
|
||||
|
||||
if __name__ == "__main__":
|
||||
ray.services.start_ray_local(num_workers=10)
|
||||
ray.init(start_ray_local=True, num_workers=10)
|
||||
|
||||
# Run the reinforcement learning
|
||||
running_reward = None
|
||||
|
||||
Reference in New Issue
Block a user