mirror of
https://github.com/wassname/ray.git
synced 2026-07-13 17:45:08 +08:00
[tune] Remove accidentally added files (#9835)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
project_id: 643
|
||||
@@ -1,77 +0,0 @@
|
||||
# An unique identifier for the head node and workers of this cluster.
|
||||
cluster_name: sgd-pytorch
|
||||
|
||||
# The maximum number of workers nodes to launch in addition to the head
|
||||
# node. This takes precedence over min_workers. min_workers default to 0.
|
||||
min_workers: 2
|
||||
initial_workers: 2
|
||||
max_workers: 2
|
||||
|
||||
target_utilization_fraction: 0.9
|
||||
|
||||
# If a node is idle for this many minutes, it will be removed.
|
||||
idle_timeout_minutes: 20
|
||||
# docker:
|
||||
# image: tensorflow/tensorflow:1.5.0-py3
|
||||
# container_name: ray_docker
|
||||
|
||||
# Cloud-provider specific configuration.
|
||||
provider:
|
||||
type: aws
|
||||
region: us-west-2
|
||||
|
||||
# How Ray will authenticate with newly launched nodes.
|
||||
auth:
|
||||
ssh_user: ubuntu
|
||||
|
||||
head_node:
|
||||
InstanceType: p3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
|
||||
worker_nodes:
|
||||
InstanceType: p3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
# Run workers on spot by default. Comment this out to use on-demand.
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
setup_commands:
|
||||
- ray || pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl
|
||||
- pip install -U ipdb ray[rllib] torch torchvision
|
||||
- cp -r ~/tune ~/anaconda3/lib/python3.6/site-packages/ray
|
||||
- cp -r ~/torch_ ~/anaconda3/lib/python3.6/site-packages/ray/util/sgd
|
||||
- cp -r ~/autoscaler ~/anaconda3/lib/python3.6/site-packages/ray/
|
||||
# Install apex.
|
||||
# - rm -rf apex || true
|
||||
# - git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir ./ || true
|
||||
|
||||
|
||||
file_mounts: {
|
||||
~/tune: ./tune/,
|
||||
~/torch_: ./util/sgd/torch/,
|
||||
~/autoscaler: ./autoscaler/
|
||||
}
|
||||
|
||||
# Custom commands that will be run on the head node after common setup.
|
||||
head_setup_commands: []
|
||||
|
||||
# Custom commands that will be run on worker nodes after common setup.
|
||||
worker_setup_commands: []
|
||||
|
||||
# # Command to start ray on the head node. You don't need to change this.
|
||||
head_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --head --port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
|
||||
|
||||
# Command to start ray on worker nodes. You don't need to change this.
|
||||
worker_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076 --object-store-memory=1000000000
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
project_id: 578
|
||||
@@ -1,43 +0,0 @@
|
||||
class Trial:
|
||||
hypers: dict = {} # static
|
||||
config: dict = {} # static
|
||||
status: str = None
|
||||
trace: List[Dict] = []
|
||||
checkpoints: List[str] = []
|
||||
|
||||
space = {}
|
||||
trials = []
|
||||
|
||||
trial_checkpoints = {}
|
||||
|
||||
while not Optimizer.is_finished():
|
||||
while Optimizer.has_next(space, trials, state):
|
||||
trials += [Optimizer.next(space, trials, state)]
|
||||
trial = Optimizer.choose(trials, state)
|
||||
if Optimizer.should_stop(trial, trials, state):
|
||||
Executor.stop(trial)
|
||||
elif Optimizer.should_pause(trial, state):
|
||||
Executor.pause(trial)
|
||||
elif Optimizer.should_restore(trial, state):
|
||||
restore(trial, trial.checkpoints[-1])
|
||||
elif Optimizer.should_save(trial, state):
|
||||
checkpoint = save(trial)
|
||||
elif Optimizer.should_continue(trial, state):
|
||||
step(trial)
|
||||
|
||||
|
||||
exp = Experiment(logdir, name, restore=True)
|
||||
failed_trials = exp.get_failed_trials()
|
||||
run(failed_trials)
|
||||
|
||||
exp = Experiment(logdir, name, restore=True)
|
||||
trials = exp.trials_finished()
|
||||
trials.reset_status()
|
||||
run(trials)
|
||||
|
||||
|
||||
optimizer = Optimizer(sweep, metric, *parameters)
|
||||
sweep.configure_server()
|
||||
sweep.add_logger(Logging)
|
||||
sweep.set_executor(executor)
|
||||
sweep.run(func, verbose=verbose)
|
||||
@@ -1,207 +0,0 @@
|
||||
storage = TrialStorage(location)
|
||||
trials = storage.get_trials()
|
||||
failed_trials = trials.filter(status=Failed)
|
||||
parameters = [t.hypers for t in failed_trials]
|
||||
|
||||
|
||||
# Builder Pattern
|
||||
|
||||
factory = TrialFactory()
|
||||
factory.queue(grid)
|
||||
run(func, factory)
|
||||
|
||||
factory = TrialFactory()
|
||||
factory.queue(distribution, num_samples=3, repeat=5)
|
||||
run(func, factory)
|
||||
|
||||
factory = TrialFactory(optimizer)
|
||||
factory.queue(distribution, delay_feedback=3, num_samples=20, max_concurrent=3)
|
||||
run(func, factory)
|
||||
|
||||
optimizer.restore(storage)
|
||||
|
||||
factory = TrialFactory(optimizer)
|
||||
factory.queue(parameter_list)
|
||||
factory.queue(distribution, num_samples=3)
|
||||
|
||||
# single process
|
||||
|
||||
trials = []
|
||||
|
||||
while factory.has_next():
|
||||
x = factory.next()
|
||||
trial = build(func, x)
|
||||
trials.put(trial)
|
||||
storage.save(factory, trials)
|
||||
|
||||
while not trial.done():
|
||||
result = get_next_result(trial)
|
||||
log(result)
|
||||
storage.update_checkpoint(trial)
|
||||
factory.update(result)
|
||||
storage.save(factory, trials)
|
||||
|
||||
|
||||
# concurrent
|
||||
|
||||
trials = []
|
||||
|
||||
class Actor:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def configure():
|
||||
pass
|
||||
|
||||
def step():
|
||||
pass
|
||||
|
||||
def save():
|
||||
pass
|
||||
|
||||
def restore():
|
||||
pass
|
||||
|
||||
factory, trials = storage.recover()
|
||||
optimizer = factory.optimizer
|
||||
result_streams = []
|
||||
|
||||
while factory.has_next() or not trials.not_done():
|
||||
while factory.has_next():
|
||||
x = factory.next()
|
||||
trial = build(func, x)
|
||||
trials.put(trial)
|
||||
storage.save(factory, trials)
|
||||
|
||||
while Cluster.has_space(trials.live()) and trials.has_pending():
|
||||
trial = trials.pop_pending()
|
||||
handle = Actor.configure(trial)
|
||||
result_streams.add(handle)
|
||||
|
||||
trial, handle, payload = process_next(result_streams)
|
||||
|
||||
if payload.type == "SAVE":
|
||||
trial.update(payload.checkpoint)
|
||||
storage.save(trials)
|
||||
elif payload.type == "STEP":
|
||||
trial.track(payload.result)
|
||||
log(payload.result)
|
||||
else:
|
||||
pass
|
||||
|
||||
if should_checkpoint(trial):
|
||||
Executor.save(handle)
|
||||
elif not is_finished(trial):
|
||||
action = Scheduler(trial, trials)
|
||||
Executor.execute_action(action, trial)
|
||||
elif is_finished(trial):
|
||||
factory.update(trial, result)
|
||||
storage.save(factory, trials)
|
||||
|
||||
|
||||
|
||||
# concurrent with checkpointing
|
||||
|
||||
|
||||
|
||||
# concurrent with pbt
|
||||
|
||||
while factory.has_next() or not trials.not_done():
|
||||
# ...
|
||||
|
||||
trial, handle, payload = process_next(result_streams)
|
||||
elif not is_finished(trial):
|
||||
action = pbt(trial, trials)
|
||||
factory.queue(new_hps, trial3.checkpoint)
|
||||
|
||||
Executor.execute_action(action, trial)
|
||||
|
||||
|
||||
|
||||
# Restore last experiment
|
||||
exp = Experiment.restore(storage=X)
|
||||
trials = exp.get_trial(filter=failed)
|
||||
|
||||
run(func, manual_list)
|
||||
run(func, space, searcher)
|
||||
run(func, grid)
|
||||
run(func, manual_list, checkpoints)
|
||||
run(func, manual_list)
|
||||
|
||||
|
||||
|
||||
|
||||
run(func, exp)
|
||||
|
||||
|
||||
# Core concepts:
|
||||
# Result: Dict[str, value]
|
||||
# t_state: Any
|
||||
# Trial: hps[Dict], static_config[Dict]
|
||||
# TrialTrace: List[Result], t_state, Trial
|
||||
|
||||
# Trainable: t_state, Trial -> t_state, Result
|
||||
|
||||
# Optimizer: o_state, List[TrialTrace], Trainable -> (
|
||||
# o_state, List[TrialTrace])
|
||||
|
||||
# SearchAlg: state, Dict[hps, Result] -> state, hps
|
||||
|
||||
|
||||
# Execution concepts
|
||||
|
||||
# Checkpoint
|
||||
# LiveTrial: TrialTrace, location, status, is_idle
|
||||
# Status: PENDING, SAVING, RESTORING, TRAINING, SETUP, STOP, ERROR
|
||||
# Trainer: Trainable, location, t_state, Trial -> t_state, Result
|
||||
step(o_state, LiveTrial, List[LiveTrial]) -> LiveTrial, *args
|
||||
Server(List[LiveTrial]) -> List[LiveTrial]
|
||||
checkpointer(LiveTrial, manager_state) -> TrialTrace
|
||||
Logger(TrialTrace)
|
||||
Optimizer(o_trace, ...)
|
||||
Syncer()
|
||||
|
||||
|
||||
|
||||
|
||||
TrialExecutor(reuse_actors, queue_trials)
|
||||
ServerConfig(server_port)
|
||||
Optimizer(stop, search_alg, scheduler)
|
||||
Experiment(resume, local_dir)
|
||||
CheckpointManager(
|
||||
sync_on_checkpoint,
|
||||
keep_checkpoints_num,
|
||||
global_checkpoint_period,
|
||||
export_formats,
|
||||
checkpoint_score_attr
|
||||
)
|
||||
### Tune commands
|
||||
tune.set_log_config(
|
||||
upload_dir,
|
||||
sync_to_cloud,
|
||||
trial_name_creator,
|
||||
sync_to_driver,
|
||||
progress_reporter,
|
||||
loggers,
|
||||
verbose
|
||||
)
|
||||
tune.set_server(ServerConfig)
|
||||
tune.run(
|
||||
experiment,
|
||||
trainable_fn,
|
||||
raise_on_failed_trial, # where can this go?
|
||||
max_failures: int or "fail-fast",
|
||||
trial_executor,
|
||||
restore_from, # checkpoint path to restore from
|
||||
resources_per_trial,
|
||||
num_samples,
|
||||
search_space, # I'm not a big fan of this because Search Algs have their own search_space too
|
||||
Optimizer,
|
||||
CheckpointManager)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
checkpoint_manager = State(location)
|
||||
checkpoint_manager.optimizer_state
|
||||
checkpoint_manager.generator_state
|
||||
checkpoint_manager.trial_state
|
||||
|
||||
# How much have we learned
|
||||
optimizer = Optimizer.from_checkpoint(checkpoint_manager)
|
||||
|
||||
optimizer = Optimizer(space, checkpoint=checkpoint_manager)
|
||||
for x, y in warm_start:
|
||||
optimizer.report(x, y)
|
||||
|
||||
samples = [optimizer.sample(random=True) for i in range(50)]
|
||||
|
||||
spec = TrialSpec(func, local_dir, checkpoint)
|
||||
|
||||
generator = TrialGenerator.from_checkpoint(checkpoint, optimizer)
|
||||
|
||||
generator = TrialGenerator.from_trials(trials)
|
||||
|
||||
generator = TrialGenerator.from_spec(spec, optimizer)
|
||||
generator.configure(checkpoint_callback)
|
||||
generator.queue(samples)
|
||||
generator.queue(num_samples=50, repeat=3, max_concurrent=4)
|
||||
generator.next()
|
||||
|
||||
generator = TrialGenerator.from_multi_spec(spec)
|
||||
|
||||
run(generator)
|
||||
###################################################
|
||||
|
||||
# Exploration process
|
||||
trial_list = get_trials(checkpoint_manager)
|
||||
failed_trials = [t.reset() for t in trial_list if t.status == "FAILED"]
|
||||
|
||||
generator = TrialGenerator.from_trials(failed_trials)
|
||||
tune.run(generator)
|
||||
|
||||
builder = Builder()
|
||||
|
||||
for params in samples:
|
||||
yield builder.build(params)
|
||||
@@ -1,71 +0,0 @@
|
||||
# An unique identifier for the head node and workers of this cluster.
|
||||
cluster_name: sgd-pytorch
|
||||
|
||||
# The maximum number of workers nodes to launch in addition to the head
|
||||
# node. This takes precedence over min_workers. min_workers default to 0.
|
||||
min_workers: 0
|
||||
initial_workers: 0
|
||||
max_workers: 0
|
||||
|
||||
target_utilization_fraction: 0.9
|
||||
|
||||
# If a node is idle for this many minutes, it will be removed.
|
||||
idle_timeout_minutes: 20
|
||||
# docker:
|
||||
# image: tensorflow/tensorflow:1.5.0-py3
|
||||
# container_name: ray_docker
|
||||
|
||||
# Cloud-provider specific configuration.
|
||||
provider:
|
||||
type: aws
|
||||
region: us-west-2
|
||||
|
||||
# How Ray will authenticate with newly launched nodes.
|
||||
auth:
|
||||
ssh_user: ubuntu
|
||||
|
||||
head_node:
|
||||
InstanceType: p3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
|
||||
worker_nodes:
|
||||
InstanceType: p3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
# Run workers on spot by default. Comment this out to use on-demand.
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
setup_commands:
|
||||
- ray || pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl
|
||||
- pip install -U ipdb ray[rllib] torch torchvision
|
||||
# Install apex.
|
||||
# - rm -rf apex || true
|
||||
# - git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir ./ || true
|
||||
|
||||
|
||||
file_mounts: {
|
||||
}
|
||||
|
||||
# Custom commands that will be run on the head node after common setup.
|
||||
head_setup_commands: []
|
||||
|
||||
# Custom commands that will be run on worker nodes after common setup.
|
||||
worker_setup_commands: []
|
||||
|
||||
# # Command to start ray on the head node. You don't need to change this.
|
||||
head_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
|
||||
|
||||
# Command to start ray on worker nodes. You don't need to change this.
|
||||
worker_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076 --object-store-memory=1000000000
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
# An unique identifier for the head node and workers of this cluster.
|
||||
cluster_name: sgd-pytorch
|
||||
|
||||
# The maximum number of workers nodes to launch in addition to the head
|
||||
# node. This takes precedence over min_workers. min_workers default to 0.
|
||||
min_workers: 0
|
||||
initial_workers: 0
|
||||
max_workers: 0
|
||||
|
||||
target_utilization_fraction: 0.9
|
||||
|
||||
# If a node is idle for this many minutes, it will be removed.
|
||||
idle_timeout_minutes: 20
|
||||
# docker:
|
||||
# image: tensorflow/tensorflow:1.5.0-py3
|
||||
# container_name: ray_docker
|
||||
|
||||
# Cloud-provider specific configuration.
|
||||
provider:
|
||||
type: aws
|
||||
region: us-west-2
|
||||
|
||||
# How Ray will authenticate with newly launched nodes.
|
||||
auth:
|
||||
ssh_user: ubuntu
|
||||
|
||||
head_node:
|
||||
InstanceType: g3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
|
||||
worker_nodes:
|
||||
InstanceType: g3.8xlarge
|
||||
ImageId: latest_dlami
|
||||
# Run workers on spot by default. Comment this out to use on-demand.
|
||||
InstanceMarketOptions:
|
||||
MarketType: spot
|
||||
# SpotOptions:
|
||||
# MaxPrice: "9.0"
|
||||
|
||||
setup_commands:
|
||||
- ray || pip install -U https://s3-us-west-2.amazonaws.com/ray-wheels/latest/ray-0.9.0.dev0-cp36-cp36m-manylinux1_x86_64.whl
|
||||
- pip install -U ipdb ray[rllib] torch torchvision
|
||||
# Install apex.
|
||||
# - rm -rf apex || true
|
||||
# - git clone https://github.com/NVIDIA/apex && cd apex && pip install -v --no-cache-dir ./ || true
|
||||
|
||||
|
||||
file_mounts: {
|
||||
~/anaconda3/lib/python3.6/site-packages/ray/tune: ./tune/,
|
||||
~/anaconda3/lib/python3.6/site-packages/ray/util/sgd/torch: ./util/sgd/torch/
|
||||
}
|
||||
|
||||
# Custom commands that will be run on the head node after common setup.
|
||||
head_setup_commands: []
|
||||
|
||||
# Custom commands that will be run on worker nodes after common setup.
|
||||
worker_setup_commands: []
|
||||
|
||||
# # Command to start ray on the head node. You don't need to change this.
|
||||
head_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --head --redis-port=6379 --object-manager-port=8076 --autoscaling-config=~/ray_bootstrap_config.yaml --object-store-memory=1000000000
|
||||
|
||||
# Command to start ray on worker nodes. You don't need to change this.
|
||||
worker_start_ray_commands:
|
||||
- ray stop
|
||||
- ray start --address=$RAY_HEAD_IP:6379 --object-manager-port=8076 --object-store-memory=1000000000
|
||||
|
||||
Binary file not shown.
@@ -1,28 +0,0 @@
|
||||
import pickle
|
||||
import ray
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
import torch.nn as nn
|
||||
|
||||
|
||||
class ConvNet(nn.Module):
|
||||
def __init__(self):
|
||||
super(ConvNet, self).__init__()
|
||||
self.conv1 = nn.Conv2d(1, 3, kernel_size=3)
|
||||
self.fc = nn.Linear(192, 10)
|
||||
|
||||
def forward(self, x):
|
||||
x = F.relu(F.max_pool2d(self.conv1(x), 3))
|
||||
x = x.view(-1, 192)
|
||||
x = self.fc(x)
|
||||
return F.log_softmax(x, dim=1)
|
||||
|
||||
def save_me():
|
||||
model = ConvNet()
|
||||
torch.save(model, "./test.th")
|
||||
return 1
|
||||
|
||||
ray_func = ray.remote(save_me)
|
||||
|
||||
ray.init()
|
||||
ray.get(ray_func.remote())
|
||||
@@ -1 +0,0 @@
|
||||
trialv2.py
|
||||
Reference in New Issue
Block a user