Sweep API

​

read_sweep

1
vessl.read_sweep(
2
sweep_name: str, **kwargs
3
)
Copied!
Read sweep in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs.
Args
  • sweep_name (str) : Sweep name.
Example
1
vessl.read_sweep(
2
sweep_name="pitch-lord",
3
)
Copied!
​

list_sweeps

1
vessl.list_sweeps(
2
**kwargs
3
)
Copied!
List sweeps in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs.
Example
1
vessl.list_sweeps()
Copied!
​

create_sweep

1
vessl.create_sweep(
2
objective: OrmSweepObjective, max_experiment_count: int,
3
parallel_experiment_count: int, max_failed_experiment_count: int,
4
algorithm: str, parameters: List[OrmParameter], cluster_name: str,
5
start_command: str, kernel_resource_spec_name: str = None,
6
processor_type: str = None, cpu_limit: float = None, memory_limit: float = None,
7
gpu_type: str = None, gpu_limit: int = None, kernel_image_url: str = None, *,
8
early_stopping_name: str = None, early_stopping_settings: List[Tuple[str,
9
str]] = None, message: str = None, hyperparameters: List[Tuple[str, str]] = None,
10
dataset_mounts: List[str] = None, git_ref_mounts: List[str] = None,
11
git_diff_mount: str = None, archive_file_mount: str = None,
12
root_volume_size: str = None, working_dir: str = None,
13
output_dir: str = MOUNT_PATH_OUTPUT, **kwargs
14
)
Copied!
Create sweep in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs. Pass use_git_diff=True if you want to run experiment with uncommitted changes and pass use_git_diff_untracked=True if you want to run untracked changes(only valid if use_git_diff is set).
Args
  • objective (OrmSweepObjective) : A sweep objective including goal, metric, and type.
  • max_experiment_count (int) : The maximum number of experiments to run.
  • parallel_experiment_count (int) : The number of experiments to run in parallel.
  • max_failed_experiment_count (int) : The maximum number of experiments to allow to fail.
  • algorithm (str) : Parameter suggestion algorithm. grid, random, or bayesian.
  • parameters (List[OrmParameter]) : A list of parameters to search.
  • cluster_name (str) : Cluster name(must be specified before other options).
  • start_command (str) : Start command to execute in experiment container.
  • kernel_resource_spec_name (str) : Resource type to run an experiment (for managed cluster only). Defaults to None.
  • cpu_limit (float) : Number of vCPUs (for custom cluster only). Defaults to None.
  • memory_limit (str) : Memory limit in GiB (for custom cluster only). Defaults to None.
  • gpu_type (str) : GPU type (for custom cluster only). Defaults to None.
  • gpu_limit (int) : Number of GPU cores (for custom cluster only). Defaults to None.
  • kernel_image_url (str) : Kernel docker image URL. Defaults to None.
  • early_stopping_name (str) : Early stopping algorithm name. Defaults to None.
  • early_stopping_settings (List[Tuple[str, str]]) : Early stopping algorithm settings. Defaults to None.
  • message (str) : Message. Defaults to None.
  • hyperparameters (List[str]) : A list of hyperparameters. Defaults to None.
  • dataset_mounts (List[str]) : A list of dataset mounts. Defaults to None.
  • git_ref_mounts (List[str]) : A list of git repository mounts. Defaults to None.
  • git_diff_mount (str) : Git diff mounts. Defaults to None.
  • archive_file_mount (str) : Local archive file mounts. Defaults to None.
  • root_volume_size (str) : Root volume size. Defaults to None.
  • working_dir (str) : Working directory path. Defaults to None.
  • output_dir (str) : Output directory path. Defaults to "/output/". processor_type(str) cpu or gpu (for custom cluster only). Defaults to None.
Example
1
sweep_objective = vessl.SweepObjective(
2
type="maximize",
3
goal="0.99",
4
metric="val_accuracy",
5
)
6
​
7
parameters = [
8
vessl.SweepParameter(
9
name="optimizer",
10
type="categorical",
11
range=vessl.SweepParameterRange(
12
list=["adam", "sgd", "adadelta"]
13
)
14
),
15
vessl.SweepParameter(
16
name="batch_size",
17
type="int",
18
range=vessl.SweepParameterRange(
19
max="256",
20
min="64",
21
step="8",
22
)
23
)
24
]
25
​
26
vessl.create_sweep(
27
objective=sweep_objective,
28
max_experiment_count=4,
29
parallel_experiment_count=2,
30
max_failed_experiment_count=2,
31
algorithm="random",
32
parameters=parameters,
33
dataset_mounts=[/input:mnist],
34
cluster_name="aws-apne2-prod1",
35
kernel_resource_spec_name="v1.cpu-4.mem-13",
36
kernel_image_url="public.ecr.aws/vessl/kernels:py36.full-cpu",
37
start_command="pip install requirements.txt && python main.py",
38
)
Copied!
​

terminate_sweep

1
vessl.terminate_sweep(
2
sweep_name: str, **kwargs
3
)
Copied!
Terminate sweep in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs.
Args
  • sweep_name (str) : Sweep name.
Example
1
vessl.terminate_sweep(
2
sweep_name="pitch-lord",
3
)
Copied!
​

list_sweep_logs

1
vessl.list_sweep_logs(
2
sweep_name: str, tail: int = 200, **kwargs
3
)
Copied!
List sweep logs in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs.
Args
  • sweep_name (str) : Sweep name.
  • tail (int) : The number of lines to display from the end. Display all if -1. Defaults to 200.
Example
1
vessl.list_sweep_logs(
2
sweep_name="pitch-lord",
3
)
Copied!
​

get_best_sweep_experiment

1
vessl.get_best_sweep_experiment(
2
sweep_name: str, **kwargs
3
)
Copied!
Read sweep and return the best experiment info in the default organization/project. If you want to override the default organization/project, then pass organization_name or project_name as **kwargs.
Args
  • sweep_name (str) : Sweep name.
Example
1
vessl.get_best_sweep_experiment(
2
sweep_name="pitch-lord",
3
)
Copied!