id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,700 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/poll.py | ray.train.v2._internal.execution.worker_group.poll.PollTask | from ray.types import ObjectRef
from dataclasses import dataclass
@dataclass(frozen=True)
class PollTask:
"""Represents a poll task for a worker.
Attributes:
start_time: The time when the poll task was started.
task: The ObjectRef representing the poll task.
"""
start_time: float
t... | @dataclass(frozen=True)
class PollTask:
'''Represents a poll task for a worker.
Attributes:
start_time: The time when the poll task was started.
task: The ObjectRef representing the poll task.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 1.67 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 3 | 1 | 2 | 5 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,701 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/poll.py | ray.train.v2._internal.execution.worker_group.poll.WorkerGroupPollStatus | from collections import defaultdict
from ray.train.v2.api.exceptions import WorkerGroupError
from typing import Dict, Optional
from dataclasses import dataclass
from ray.train.v2._internal.exceptions import WorkerHealthCheckFailedError
@dataclass(frozen=True)
class WorkerGroupPollStatus:
worker_statuses: Dict[int,... | @dataclass(frozen=True)
class WorkerGroupPollStatus:
@property
def errors(self) -> Dict[int, Exception]:
pass
def get_worker_group_error(self) -> WorkerGroupError:
pass
@property
def finished(self) -> bool:
pass
def get_error_string(self) -> str:
'''
Re... | 8 | 1 | 5 | 0 | 5 | 0 | 1 | 0 | 0 | 3 | 0 | 0 | 2 | 0 | 2 | 2 | 16 | 2 | 14 | 5 | 9 | 0 | 6 | 3 | 3 | 1 | 0 | 0 | 2 |
10,702 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/poll.py | ray.train.v2._internal.execution.worker_group.poll.WorkerStatus | from dataclasses import dataclass
from ray.train._internal.session import _TrainingResult
from typing import Dict, Optional
@dataclass
class WorkerStatus:
running: bool
error: Optional[Exception] = None
training_result: Optional[_TrainingResult] = None | @dataclass
class WorkerStatus:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 4 | 3 | 3 | 0 | 4 | 3 | 3 | 0 | 0 | 0 | 0 |
10,703 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/state.py | ray.train.v2._internal.execution.worker_group.state.WorkerGroupState | from ray.train.v2._internal.execution.worker_group.worker import Worker
from typing import List
from dataclasses import dataclass
from ray.util.placement_group import PlacementGroup, remove_placement_group
from ray.actor import ActorHandle
@dataclass(frozen=True)
class WorkerGroupState:
"""Ongoing state of an acti... | @dataclass(frozen=True)
class WorkerGroupState:
'''Ongoing state of an active worker group.
Attributes:
start_time: The time when the worker group was started.
workers: The workers in the worker group.
These should always be in sorted order by world rank.
placement_group: The... | 5 | 1 | 4 | 0 | 4 | 0 | 1 | 0.89 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 20 | 3 | 9 | 2 | 7 | 8 | 9 | 2 | 7 | 1 | 0 | 0 | 1 |
10,704 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/state.py | ray.train.v2._internal.execution.worker_group.state.WorkerGroupStateBuilder | from typing import List
from ray.train.v2._internal.execution.worker_group.worker import Worker
from ray.util.placement_group import PlacementGroup, remove_placement_group
from ray.train.v2._internal.util import time_monotonic
from ray.train.v2._internal.execution.checkpoint.sync_actor import SynchronizationActor
clas... |
class WorkerGroupStateBuilder:
'''Builder for WorkerGroupState.
Example usage:
```python
builder = WorkerGroupStateBuilder()
builder.with_placement_group(placement_group)
builder.with_workers(workers)
builder.with_sync_actor(sync_actor)
state = builder.build()
... | 7 | 1 | 7 | 0 | 7 | 0 | 2 | 0.24 | 0 | 5 | 4 | 0 | 6 | 3 | 6 | 6 | 64 | 8 | 45 | 16 | 34 | 11 | 30 | 12 | 23 | 4 | 0 | 1 | 10 |
10,705 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/thread_runner.py | ray.train.v2._internal.execution.worker_group.thread_runner.ThreadRunner | from ray.train.v2._internal.util import construct_user_exception_with_traceback, get_callable_name
import threading
import queue
from ray.train.v2._internal.exceptions import UserExceptionWithTraceback
from typing import Callable, Optional, TypeVar
class ThreadRunner:
"""Utility to run a user function as a thread ... |
class ThreadRunner:
'''Utility to run a user function as a thread and capture its return value
or exception.
'''
def __init__(self):
pass
def run(self, target: Callable[[], T]) -> None:
pass
def _run_target():
pass
def _monitor_target():
... | 9 | 3 | 11 | 1 | 8 | 1 | 1 | 0.16 | 0 | 6 | 1 | 0 | 6 | 5 | 6 | 6 | 64 | 14 | 43 | 16 | 35 | 7 | 39 | 15 | 31 | 2 | 0 | 2 | 10 |
10,706 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/worker.py | ray.train.v2._internal.execution.worker_group.worker.ActorMetadata | from typing import TYPE_CHECKING, Callable, Dict, List, Optional, TypeVar, Union
from dataclasses import dataclass
from functools import cached_property
@dataclass(frozen=True)
class ActorMetadata:
hostname: str
node_id: str
node_ip: str
pid: int
accelerator_ids: Dict[str, List[Union[int, str]]]
... | @dataclass(frozen=True)
class ActorMetadata:
@property
def gpu_ids(self) -> List[Union[int, str]]:
pass
@cached_property
def _repr(self) -> str:
pass
def __repr__(self) -> str:
pass | 7 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 25 | 2 | 23 | 7 | 19 | 0 | 16 | 6 | 13 | 2 | 0 | 1 | 3 |
10,707 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/worker.py | ray.train.v2._internal.execution.worker_group.worker.RayTrainWorker | from ray.train.v2._internal.execution.context import DistributedContext, ExecutionContext, TrainContext, TrainRunContext, get_train_context, set_train_context
from ray.train.v2._internal.util import ObjectRefWrapper
from ray.train import Checkpoint
from ray.train.v2._internal.execution.callback import TrainContextCallb... |
class RayTrainWorker:
def __init__(self):
pass
def execute(self, fn: Callable[..., T], *fn_args, **fn_kwargs) -> T:
pass
def run_train_fn(self, train_fn_ref: ObjectRefWrapper[Callable[[], None]]):
'''Run the training function in a separate thread.
This function should ret... | 9 | 2 | 13 | 1 | 9 | 3 | 1 | 0.34 | 0 | 11 | 7 | 1 | 7 | 1 | 7 | 7 | 99 | 13 | 64 | 26 | 47 | 22 | 31 | 17 | 23 | 2 | 0 | 1 | 10 |
10,708 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/worker.py | ray.train.v2._internal.execution.worker_group.worker.Worker | from functools import cached_property
from ray.train.v2._internal.execution.context import DistributedContext, ExecutionContext, TrainContext, TrainRunContext, get_train_context, set_train_context
from ray.types import ObjectRef
from ray.actor import ActorHandle
from dataclasses import dataclass
from typing import TYPE... | @dataclass
class Worker:
@cached_property
def _repr(self) -> str:
pass
def __repr__(self) -> str:
pass
def execute_async(self, fn: Callable[..., T], *fn_args, **fn_kwargs) -> ObjectRef:
'''Execute ``func`` on worker.
Returns:
(ObjectRef) An ObjectRef repres... | 6 | 1 | 8 | 1 | 6 | 1 | 1 | 0.17 | 0 | 2 | 1 | 0 | 3 | 0 | 3 | 3 | 33 | 6 | 23 | 10 | 18 | 4 | 14 | 9 | 10 | 1 | 0 | 0 | 3 |
10,709 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/worker_group.py | ray.train.v2._internal.execution.worker_group.worker_group.WorkerGroup | import traceback
from ray.train.v2._internal.logging.logging import get_train_application_worker_log_path
from ray.train.v2._internal.exceptions import InsufficientClusterResourcesError, WorkerGroupStartupFailedError, WorkerGroupStartupTimeoutError, WorkerHealthCheckFailedError, WorkerHealthCheckTimeoutError
import col... |
class WorkerGroup:
@classmethod
def create(cls, train_run_context: TrainRunContext, worker_group_context: WorkerGroupContext, callbacks: Optional[List[Union[WorkerGroupCallback, WorkerCallback, TrainContextCallback]]]=None) -> 'WorkerGroup':
'''Create and start a new worker group.
Args:
... | 37 | 20 | 24 | 3 | 15 | 5 | 2 | 0.4 | 0 | 32 | 20 | 1 | 21 | 11 | 24 | 24 | 630 | 111 | 370 | 136 | 303 | 149 | 197 | 90 | 171 | 7 | 0 | 4 | 55 |
10,710 | ray-project/ray | python/ray/train/v2/_internal/execution/worker_group/worker_group.py | ray.train.v2._internal.execution.worker_group.worker_group.WorkerGroupContext | from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, TypeVar, Union
from ray.train.v2._internal.util import ObjectRefWrapper, bundle_to_remote_args, invoke_context_managers, ray_get_safe, time_monotonic
@dataclass(frozen=True)
class WorkerGroupContext:
"""Context for a worker g... | @dataclass(frozen=True)
class WorkerGroupContext:
'''Context for a worker group.
This stores the context that is shared when starting a worker group.
Attributes:
run_attempt_id: The ID of the run attempt.
train_fn_ref: An object store reference to the training function to execute.
nu... | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 21 | 3 | 6 | 3 | 5 | 12 | 6 | 3 | 5 | 0 | 0 | 0 | 0 |
10,711 | ray-project/ray | python/ray/train/v2/_internal/logging/logging.py | ray.train.v2._internal.logging.logging.SessionFileHandler | import os
from typing import Optional, Union
import logging.config
class SessionFileHandler(logging.Handler):
"""A handler that writes to a log file in the Ray session directory.
The Ray session directory isn't available until Ray is initialized, so any logs
emitted before Ray is initialized will be lost.... |
class SessionFileHandler(logging.Handler):
'''A handler that writes to a log file in the Ray session directory.
The Ray session directory isn't available until Ray is initialized, so any logs
emitted before Ray is initialized will be lost.
This handler will not create the file handler until you emit a ... | 6 | 1 | 7 | 1 | 6 | 1 | 2 | 0.52 | 1 | 4 | 0 | 0 | 5 | 4 | 5 | 25 | 55 | 11 | 29 | 12 | 23 | 15 | 29 | 12 | 23 | 3 | 3 | 1 | 10 |
10,712 | ray-project/ray | python/ray/train/v2/_internal/logging/logging.py | ray.train.v2._internal.logging.logging.TrainContextFilter | from enum import Enum
from typing import Optional, Union
from ray.train.v2._internal.execution.context import TrainContext, TrainRunContext
import logging.config
class TrainContextFilter(logging.Filter):
"""Add Ray Train metadata to the log records.
This filter is applied to Ray Train controller and worker pr... |
class TrainContextFilter(logging.Filter):
'''Add Ray Train metadata to the log records.
This filter is applied to Ray Train controller and worker processes.
'''
class LogKey(str, Enum):
class TrainComponent(str, Enum):
def __init__(self, context: Union[TrainRunContext, TrainContext]):
... | 7 | 1 | 7 | 0 | 7 | 1 | 2 | 0.22 | 1 | 5 | 2 | 0 | 4 | 6 | 4 | 6 | 51 | 7 | 36 | 20 | 29 | 8 | 34 | 20 | 27 | 2 | 2 | 1 | 6 |
10,713 | ray-project/ray | python/ray/train/v2/api/callback.py | ray.train.v2.api.callback.RayTrainCallback | from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class RayTrainCallback:
"""Base Ray Train callback interface."""
pass | @DeveloperAPI
class RayTrainCallback:
'''Base Ray Train callback interface.'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
10,714 | ray-project/ray | python/ray/train/v2/api/callback.py | ray.train.v2.api.callback.UserCallback | from ray.train.v2._internal.execution.context import TrainRunContext
from ray.train import Checkpoint
from typing import Any, Dict, List, Optional
from ray.util.annotations import DeveloperAPI
@DeveloperAPI
class UserCallback(RayTrainCallback):
"""Callback interface for custom user-defined callbacks to handling ev... | @DeveloperAPI
class UserCallback(RayTrainCallback):
'''Callback interface for custom user-defined callbacks to handling events
during training.
This callback is called on the Ray Train controller process, not on the
worker processes.
'''
def after_report(self, run_context: TrainRunContext, metr... | 4 | 3 | 15 | 1 | 6 | 8 | 1 | 1.75 | 1 | 6 | 2 | 2 | 2 | 0 | 2 | 2 | 38 | 5 | 12 | 10 | 2 | 21 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
10,715 | ray-project/ray | python/ray/train/v2/api/config.py | ray.train.v2.api.config.FailureConfig | from ray.train.v2._internal.constants import _DEPRECATED
from dataclasses import dataclass
from ray.air.config import CheckpointConfig, FailureConfig as FailureConfigV1, ScalingConfig as ScalingConfigV1
from ray.train.v2._internal.migration_utils import FAIL_FAST_DEPRECATION_MESSAGE, TRAINER_RESOURCES_DEPRECATION_MESSA... | @dataclass
class FailureConfig(FailureConfigV1):
'''Configuration related to failure handling of each training run.
Args:
max_failures: Tries to recover a run from training worker errors at least this many times.
Will recover from the latest checkpoint if present.
Setting to -1 w... | 3 | 1 | 4 | 0 | 3 | 1 | 2 | 1.6 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 16 | 3 | 5 | 3 | 3 | 8 | 5 | 3 | 3 | 2 | 1 | 1 | 2 |
10,716 | ray-project/ray | python/ray/train/v2/api/config.py | ray.train.v2.api.config.RunConfig | from ray.train.v2._internal.constants import _DEPRECATED
from pathlib import Path
from functools import cached_property
from ray.runtime_env import RuntimeEnv
from ray.train.v2._internal.execution.storage import StorageContext
from ray.train.v2._internal.util import date_str
from typing import TYPE_CHECKING, List, Opti... | @dataclass
@PublicAPI(stability='stable')
class RunConfig:
'''Runtime configuration for training runs.
Args:
name: Name of the trial or experiment. If not provided, will be deduced
from the Trainable.
storage_path: [Beta] Path where all results and checkpoints are persisted.
... | 6 | 1 | 39 | 6 | 32 | 1 | 5 | 0.44 | 1 | 4 | 1 | 0 | 1 | 1 | 1 | 1 | 68 | 9 | 41 | 13 | 38 | 18 | 20 | 13 | 17 | 5 | 1 | 2 | 5 |
10,717 | ray-project/ray | python/ray/train/v2/api/config.py | ray.train.v2.api.config.ScalingConfig | from typing import TYPE_CHECKING, List, Optional, Union
from ray.air.config import CheckpointConfig, FailureConfig as FailureConfigV1, ScalingConfig as ScalingConfigV1
from ray.train.v2._internal.migration_utils import FAIL_FAST_DEPRECATION_MESSAGE, TRAINER_RESOURCES_DEPRECATION_MESSAGE
from dataclasses import dataclas... | @dataclass
class ScalingConfig(ScalingConfigV1):
'''Configuration for scaling training.
Args:
num_workers: The number of workers (Ray actors) to launch.
Each worker will reserve 1 CPU by default. The number of CPUs
reserved by each worker can be overridden with the
``... | 9 | 2 | 4 | 1 | 3 | 0 | 2 | 4 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 56 | 11 | 9 | 5 | 5 | 36 | 8 | 4 | 5 | 2 | 1 | 1 | 3 |
10,718 | ray-project/ray | python/ray/train/v2/api/data_parallel_trainer.py | ray.train.v2.api.data_parallel_trainer.DataParallelTrainer | from ray.actor import ActorHandle
from ray.train.v2._internal.callbacks.state_manager import StateManagerCallback
from ray.train.v2._internal.constants import METRICS_ENABLED_ENV_VAR, get_env_vars_to_propagate
from ray.train.base_trainer import _RESUME_FROM_CHECKPOINT_DEPRECATION_WARNING, _TRAINER_RESTORE_DEPRECATION_W... | @DeveloperAPI
class DataParallelTrainer:
'''Base class for distributed data parallel training on Ray.
This class supports the SPMD parallelization pattern, where a single
training function is executed in parallel across multiple workers,
and different shards of data are processed by each worker.
'''... | 17 | 5 | 23 | 2 | 17 | 4 | 2 | 0.29 | 0 | 21 | 18 | 4 | 4 | 8 | 6 | 6 | 155 | 21 | 104 | 40 | 81 | 30 | 50 | 26 | 43 | 3 | 0 | 1 | 12 |
10,719 | ray-project/ray | python/ray/train/v2/api/result.py | ray.train.v2.api.result.Result | from typing import Any, Dict, List, Optional, Tuple, Union
import os
import pyarrow
from ray.util.annotations import Deprecated, PublicAPI
from ray.train.v2.api.exceptions import TrainingFailedError
from dataclasses import dataclass
from ray.air.result import Result as ResultV1
@dataclass
class Result(ResultV1):
c... | @dataclass
class Result(ResultV1):
@PublicAPI(stability='alpha')
def get_best_checkpoint(self, metric: str, mode: str) -> Optional['ray.train.Checkpoint']:
pass
@classmethod
def from_path(cls, path: Union[str, os.PathLike], storage_filesystem: Optional[pyarrow.fs.FileSystem]=None) -> 'Result':
... | 9 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 5 | 0 | 0 | 1 | 0 | 2 | 9 | 18 | 2 | 16 | 9 | 6 | 0 | 6 | 3 | 3 | 1 | 1 | 0 | 2 |
10,720 | ray-project/ray | python/ray/train/v2/horovod/horovod_trainer.py | ray.train.v2.horovod.horovod_trainer.HorovodTrainer | from ray.air.config import RunConfig, ScalingConfig
from ray.util.annotations import Deprecated
from typing import Any, Callable, Dict, Optional, Union
from ray.train.horovod.config import HorovodConfig
from ray.train.trainer import GenDataset
from ray.train.data_parallel_trainer import DataParallelTrainer
from ray.tra... | @Deprecated
class HorovodTrainer(DataParallelTrainer):
'''A Trainer for data parallel Horovod training. HorovodTrainer is deprecated.'''
def __init__(self, train_loop_per_worker: Union[Callable[[], None], Callable[[Dict], None]], *, train_loop_config: Optional[Dict]=None, horovod_config: Optional[HorovodConfig... | 3 | 1 | 20 | 0 | 20 | 0 | 1 | 0.05 | 1 | 8 | 5 | 0 | 1 | 0 | 1 | 50 | 23 | 1 | 21 | 14 | 7 | 1 | 3 | 2 | 1 | 1 | 6 | 0 | 1 |
10,721 | ray-project/ray | python/ray/train/v2/lightgbm/lightgbm_trainer.py | ray.train.v2.lightgbm.lightgbm_trainer.LightGBMTrainer | from ray.train.trainer import GenDataset
from ray.train import Checkpoint
from ray.train.v2.api.config import RunConfig, ScalingConfig
import ray.train
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
from ray.train.v2.api.data_parallel_trainer import DataParallelTrainer
from ray.util.annotations ... |
class LightGBMTrainer(DataParallelTrainer):
'''A Trainer for distributed data-parallel LightGBM training.
Example
-------
.. testcode::
import lightgbm as lgb
import ray.data
import ray.train
from ray.train.lightgbm import RayTrainReportCallback
from ray.train.li... | 5 | 2 | 19 | 1 | 16 | 2 | 1 | 2.6 | 1 | 9 | 5 | 0 | 1 | 0 | 2 | 8 | 142 | 16 | 35 | 19 | 15 | 91 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
10,722 | ray-project/ray | python/ray/train/v2/tensorflow/tensorflow_trainer.py | ray.train.v2.tensorflow.tensorflow_trainer.TensorflowTrainer | from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
from ray.util import PublicAPI
from ray.train.v2.api.config import RunConfig, ScalingConfig
from ray.train.trainer import GenDataset
from ray.train.v2.api.data_parallel_trainer import DataParallelTrainer
from ray.train import Checkpoint, DataConfig
... | @PublicAPI(stability='beta')
class TensorflowTrainer(DataParallelTrainer):
'''A Trainer for data parallel Tensorflow training.
At a high level, this Trainer does the following:
1. Launches multiple workers as defined by the ``scaling_config``.
2. Sets up a distributed Tensorflow environment
on th... | 3 | 1 | 28 | 1 | 26 | 1 | 2 | 4.48 | 1 | 8 | 5 | 0 | 1 | 0 | 1 | 7 | 179 | 31 | 27 | 14 | 13 | 121 | 5 | 2 | 3 | 2 | 1 | 1 | 2 |
10,723 | ray-project/ray | python/ray/train/v2/torch/torch_trainer.py | ray.train.v2.torch.torch_trainer.TorchTrainer | from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
from ray.util import PublicAPI
from ray.train.v2.api.config import RunConfig, ScalingConfig
from ray.train.v2._internal.execution.local_mode.torch import LocalTorchController
from ray.train.trainer import GenDataset
from ray.train import Checkpoint,... | @PublicAPI(stability='stable')
class TorchTrainer(DataParallelTrainer):
'''A Trainer for data parallel PyTorch training.
At a high level, this Trainer does the following:
1. Launches multiple workers as defined by the ``scaling_config``.
2. Sets up a distributed PyTorch environment
on these worke... | 4 | 1 | 29 | 1 | 27 | 1 | 3 | 4.79 | 1 | 8 | 5 | 0 | 1 | 0 | 1 | 7 | 196 | 34 | 28 | 14 | 14 | 134 | 6 | 2 | 4 | 3 | 1 | 1 | 3 |
10,724 | ray-project/ray | python/ray/train/v2/xgboost/xgboost_trainer.py | ray.train.v2.xgboost.xgboost_trainer.XGBoostTrainer | from ray.util.annotations import Deprecated
from ray.train.v2.api.data_parallel_trainer import DataParallelTrainer
from ray.train.trainer import GenDataset
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
import ray.train
from ray.train.v2.api.config import RunConfig, ScalingConfig
from ray.train ... |
class XGBoostTrainer(DataParallelTrainer):
'''A Trainer for distributed data-parallel XGBoost training.
Example
-------
.. testcode::
import xgboost
import ray.data
import ray.train
from ray.train.xgboost import RayTrainReportCallback
from ray.train.xgboost impor... | 5 | 2 | 16 | 0 | 15 | 1 | 1 | 2.75 | 1 | 9 | 5 | 0 | 1 | 0 | 2 | 8 | 136 | 16 | 32 | 16 | 15 | 88 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
10,725 | ray-project/ray | python/ray/train/xgboost/_xgboost_utils.py | ray.train.xgboost._xgboost_utils.RayTrainReportCallback | from xgboost.core import Booster
from contextlib import contextmanager
import tempfile
import ray.train
from typing import Callable, Dict, List, Optional, Union
from ray.train import Checkpoint
from pathlib import Path
from ray.util.annotations import PublicAPI
@PublicAPI(stability='beta')
class RayTrainReportCallback... | @PublicAPI(stability='beta')
class RayTrainReportCallback(RayReportCallback):
'''XGBoost callback to save checkpoints and report metrics.
Args:
metrics: Metrics to report. If this is a list,
each item describes the metric key reported to XGBoost,
and it will be reported under the... | 7 | 1 | 18 | 2 | 13 | 3 | 3 | 0.77 | 1 | 10 | 1 | 0 | 5 | 7 | 6 | 8 | 174 | 29 | 82 | 42 | 62 | 63 | 59 | 25 | 52 | 7 | 2 | 3 | 18 |
10,726 | ray-project/ray | python/ray/train/xgboost/config.py | ray.train.xgboost.config.XGBoostConfig | from contextlib import contextmanager
from dataclasses import dataclass
import xgboost
from packaging.version import Version
from ray.train.backend import Backend, BackendConfig
from xgboost.collective import CommunicatorContext
@dataclass
class XGBoostConfig(BackendConfig):
"""Configuration for xgboost collective... | @dataclass
class XGBoostConfig(BackendConfig):
'''Configuration for xgboost collective communication setup.
Ray Train will set up the necessary coordinator processes and environment
variables for your workers to communicate with each other.
Additional configuration options can be passed into the
`xg... | 8 | 1 | 6 | 1 | 6 | 0 | 2 | 0.61 | 1 | 4 | 2 | 0 | 2 | 0 | 2 | 5 | 37 | 8 | 18 | 8 | 11 | 11 | 11 | 5 | 7 | 3 | 1 | 1 | 5 |
10,727 | ray-project/ray | python/ray/train/xgboost/config.py | ray.train.xgboost.config._XGBoostRabitBackend | import threading
import json
from xgboost import RabitTracker
from typing import Optional
import ray
from ray.train._internal.worker_group import WorkerGroup
from ray.train.backend import Backend, BackendConfig
class _XGBoostRabitBackend(Backend):
def __init__(self):
self._tracker: Optional[RabitTracker] ... |
class _XGBoostRabitBackend(Backend):
def __init__(self):
pass
def _setup_xgboost_distributed_backend(self, worker_group: WorkerGroup):
pass
def set_xgboost_communicator_args(args):
pass
def on_training_start(self, worker_group: WorkerGroup, backend_config: XGBoos... | 6 | 0 | 14 | 2 | 10 | 1 | 1 | 0.16 | 1 | 3 | 2 | 0 | 4 | 2 | 4 | 28 | 63 | 13 | 43 | 16 | 34 | 7 | 29 | 14 | 22 | 3 | 5 | 2 | 7 |
10,728 | ray-project/ray | python/ray/train/xgboost/config.py | ray.train.xgboost.config._XGBoostRabitBackend_pre_xgb210 | import ray
import os
import json
from ray.train._internal.worker_group import WorkerGroup
from xgboost import RabitTracker
from ray.train.backend import Backend, BackendConfig
from typing import Optional
class _XGBoostRabitBackend_pre_xgb210(Backend):
def __init__(self):
self._tracker: Optional[RabitTrack... |
class _XGBoostRabitBackend_pre_xgb210(Backend):
def __init__(self):
pass
def _setup_xgboost_distributed_backend(self, worker_group: WorkerGroup):
pass
def set_xgboost_env_vars():
pass
def on_training_start(self, worker_group: WorkerGroup, backend_config: XGBoostC... | 6 | 0 | 14 | 2 | 10 | 2 | 2 | 0.16 | 1 | 3 | 2 | 0 | 4 | 1 | 4 | 28 | 62 | 12 | 43 | 17 | 34 | 7 | 29 | 15 | 22 | 3 | 5 | 1 | 8 |
10,729 | ray-project/ray | python/ray/train/xgboost/v2.py | ray.train.xgboost.v2.XGBoostTrainer | from ray.train.xgboost import XGBoostConfig
import ray.train
from ray.train.data_parallel_trainer import DataParallelTrainer
from typing import Any, Callable, Dict, Optional, Union
from ray.train.trainer import GenDataset
from ray.train import Checkpoint
class XGBoostTrainer(DataParallelTrainer):
"""A Trainer for ... |
class XGBoostTrainer(DataParallelTrainer):
'''A Trainer for distributed data-parallel XGBoost training.
Example
-------
.. testcode::
import xgboost
import ray.data
import ray.train
from ray.train.xgboost import RayTrainReportCallback, XGBoostTrainer
def train_fn... | 2 | 1 | 24 | 0 | 24 | 0 | 1 | 3.24 | 1 | 8 | 5 | 1 | 1 | 0 | 1 | 50 | 121 | 15 | 25 | 14 | 11 | 81 | 3 | 2 | 1 | 1 | 6 | 0 | 1 |
10,730 | ray-project/ray | python/ray/train/xgboost/xgboost_checkpoint.py | ray.train.xgboost.xgboost_checkpoint.XGBoostCheckpoint | import xgboost
import tempfile
from ray.train._internal.framework_checkpoint import FrameworkCheckpoint
from pathlib import Path
from typing import TYPE_CHECKING, Optional
from ray.util.annotations import PublicAPI
@PublicAPI(stability='beta')
class XGBoostCheckpoint(FrameworkCheckpoint):
"""A :py:class:`~ray.trai... | @PublicAPI(stability='beta')
class XGBoostCheckpoint(FrameworkCheckpoint):
'''A :py:class:`~ray.train.Checkpoint` with XGBoost-specific functionality.'''
@classmethod
def from_model(cls, booster: xgboost.Booster, *, preprocessor: Optional['Preprocessor']=None, path: Optional[str]=None) -> 'XGBoostCheckpoint... | 5 | 3 | 27 | 6 | 10 | 12 | 2 | 1.04 | 1 | 3 | 0 | 0 | 1 | 0 | 2 | 28 | 61 | 14 | 23 | 15 | 13 | 24 | 16 | 7 | 13 | 3 | 5 | 1 | 4 |
10,731 | ray-project/ray | python/ray/train/xgboost/xgboost_predictor.py | ray.train.xgboost.xgboost_predictor.XGBoostPredictor | from ray.air.constants import TENSOR_COLUMN_NAME
import xgboost
import pandas as pd
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from ray.air.util.data_batch_conversion import _unwrap_ndarray_object_type_if_needed
from ray.air.data_batch_type import DataBatchType
from ray.train.predictor import Pr... | null | 8 | 3 | 26 | 4 | 12 | 10 | 2 | 0.89 | 1 | 6 | 1 | 0 | 4 | 1 | 5 | 37 | 143 | 24 | 63 | 27 | 42 | 56 | 33 | 12 | 27 | 8 | 5 | 2 | 12 |
10,732 | ray-project/ray | python/ray/train/xgboost/xgboost_trainer.py | ray.train.xgboost.xgboost_trainer.XGBoostTrainer | from ray.train import Checkpoint
from ray.train.constants import TRAIN_DATASET_KEY
from ray.util.annotations import PublicAPI
from functools import partial
import ray.train
from typing import Any, Callable, Dict, Optional, Union
import xgboost
from ray.train.xgboost.v2 import XGBoostTrainer as SimpleXGBoostTrainer
from... | @PublicAPI(stability='beta')
class XGBoostTrainer(SimpleXGBoostTrainer):
'''A Trainer for distributed data-parallel XGBoost training.
Example
-------
.. testcode::
import xgboost
import ray.data
import ray.train
from ray.train.xgboost import RayTrainReportCallback, XGBoos... | 6 | 3 | 27 | 2 | 24 | 1 | 3 | 0.72 | 1 | 16 | 5 | 2 | 2 | 0 | 3 | 53 | 149 | 20 | 75 | 30 | 53 | 54 | 27 | 12 | 23 | 6 | 7 | 1 | 9 |
10,733 | ray-project/ray | python/ray/tune/analysis/experiment_analysis.py | ray.tune.analysis.experiment_analysis.ExperimentAnalysis | from numbers import Number
import copy
import json
from ray.tune.utils.serialization import TuneFunctionDecoder
from ray.tune.execution.tune_controller import TuneController
import os
import io
from ray.tune.utils.util import is_nan, is_nan_or_inf, unflattened_lookup
from ray.util.annotations import PublicAPI
from ray.... | @PublicAPI(stability='beta')
class ExperimentAnalysis:
'''Analyze results from a Ray Train/Tune experiment.
To use this class, the run must store the history of reported metrics
in log files (e.g., `result.json` and `progress.csv`).
This is the default behavior, unless default loggers are explicitly exc... | 39 | 20 | 22 | 3 | 13 | 6 | 3 | 0.52 | 0 | 15 | 3 | 0 | 26 | 8 | 26 | 26 | 643 | 96 | 360 | 121 | 290 | 188 | 214 | 76 | 186 | 11 | 0 | 3 | 76 |
10,734 | ray-project/ray | python/ray/tune/callback.py | ray.tune.callback.Callback | from ray.util.annotations import DeveloperAPI, PublicAPI
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
@PublicAPI(stability='beta')
class Callback(metaclass=_CallbackMeta):
"""Tune base callback that can be extended and passed to a ``TrialRunner``
Tune callbacks are called from within the... | null | 16 | 15 | 16 | 2 | 4 | 10 | 1 | 2.71 | 1 | 1 | 0 | 19 | 14 | 0 | 14 | 38 | 290 | 60 | 62 | 48 | 15 | 168 | 30 | 16 | 15 | 1 | 4 | 0 | 14 |
10,735 | ray-project/ray | python/ray/tune/callback.py | ray.tune.callback.CallbackList | from ray.tune.utils.util import _atomic_save, _load_newest_checkpoint
import warnings
from pathlib import Path
from ray.util.annotations import DeveloperAPI, PublicAPI
import glob
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
@DeveloperAPI
class CallbackList(Callback):
"""Call multiple callbac... | @DeveloperAPI
class CallbackList(Callback):
'''Call multiple callbacks at once.'''
def __init__(self, callbacks: List[Callback]):
pass
def setup(self, **info):
pass
def on_step_begin(self, **info):
pass
def on_step_end(self, **info):
pass
def on_trial_start(s... | 22 | 6 | 6 | 0 | 5 | 1 | 2 | 0.27 | 1 | 8 | 0 | 0 | 20 | 1 | 20 | 58 | 150 | 27 | 97 | 47 | 76 | 26 | 80 | 46 | 59 | 4 | 5 | 3 | 41 |
10,736 | ray-project/ray | python/ray/tune/callback.py | ray.tune.callback._CallbackMeta | from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
from abc import ABCMeta
class _CallbackMeta(ABCMeta):
"""A helper metaclass to ensure container classes (e.g. CallbackList) have
implemented all the callback methods (e.g. `on_*`).
"""
def __new__(mcs, name: str, bases: Tuple[type], at... |
class _CallbackMeta(ABCMeta):
'''A helper metaclass to ensure container classes (e.g. CallbackList) have
implemented all the callback methods (e.g. `on_*`).
'''
def __new__(mcs, name: str, bases: Tuple[type], attrs: Dict[str, Any]) -> type:
pass
@classmethod
def need_check(mcs, cls: ty... | 8 | 1 | 10 | 1 | 10 | 0 | 2 | 0.07 | 1 | 6 | 0 | 2 | 1 | 0 | 4 | 24 | 51 | 6 | 42 | 18 | 30 | 3 | 18 | 10 | 13 | 3 | 3 | 1 | 7 |
10,737 | ray-project/ray | python/ray/tune/context.py | ray.tune.context.TuneContext | from ray.util.annotations import Deprecated, PublicAPI
from ray.train.constants import V2_MIGRATION_GUIDE_MESSAGE, _v2_migration_warnings_enabled
from ray.train._internal import session
from ray.train.context import TrainContext as TrainV1Context
from ray.tune.execution.placement_groups import PlacementGroupFactory
fro... | @PublicAPI(stability='beta')
class TuneContext(TrainV1Context):
'''Context to access metadata within Ray Tune functions.'''
@_copy_doc(session.get_trial_name)
def get_trial_name(self) -> str:
pass
@_copy_doc(session.get_trial_id)
def get_trial_id(self) -> str:
pass
@_copy_doc(ses... | 27 | 1 | 2 | 0 | 2 | 0 | 1 | 0.09 | 1 | 5 | 1 | 0 | 10 | 0 | 10 | 22 | 72 | 12 | 55 | 38 | 12 | 5 | 21 | 11 | 10 | 1 | 1 | 0 | 10 |
10,738 | ray-project/ray | python/ray/tune/error.py | ray.tune.error._AbortTrialExecution | class _AbortTrialExecution(TuneError):
"""Error that indicates a trial should not be retried."""
pass | class _AbortTrialExecution(TuneError):
'''Error that indicates a trial should not be retried.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 4 | 0 | 0 |
10,739 | ray-project/ray | python/ray/tune/error.py | ray.tune.error._SubCategoryTuneError | class _SubCategoryTuneError(TuneError):
"""The more specific TuneError that happens for a certain Tune
subroutine. For example starting/stopping a trial.
"""
def __init__(self, traceback_str: str):
self.traceback_str = traceback_str
def __str__(self):
return self.traceback_str | class _SubCategoryTuneError(TuneError):
'''The more specific TuneError that happens for a certain Tune
subroutine. For example starting/stopping a trial.
'''
def __init__(self, traceback_str: str):
pass
def __str__(self):
pass | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 0.6 | 1 | 1 | 0 | 3 | 2 | 1 | 2 | 12 | 10 | 2 | 5 | 4 | 2 | 3 | 5 | 4 | 2 | 1 | 4 | 0 | 2 |
10,740 | ray-project/ray | python/ray/tune/error.py | ray.tune.error._TuneNoNextExecutorEventError | class _TuneNoNextExecutorEventError(_SubCategoryTuneError):
"""Error that happens when waiting to get the next event to
handle from RayTrialExecutor.
Note: RayTaskError will be raised by itself and will not be using
this category. This category is for everything else."""
pass | class _TuneNoNextExecutorEventError(_SubCategoryTuneError):
'''Error that happens when waiting to get the next event to
handle from RayTrialExecutor.
Note: RayTaskError will be raised by itself and will not be using
this category. This category is for everything else.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 8 | 2 | 2 | 1 | 1 | 4 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
10,741 | ray-project/ray | python/ray/tune/error.py | ray.tune.error._TuneStartTrialError | class _TuneStartTrialError(_SubCategoryTuneError):
"""Error that happens when starting a tune trial."""
pass | class _TuneStartTrialError(_SubCategoryTuneError):
'''Error that happens when starting a tune trial.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
10,742 | ray-project/ray | python/ray/tune/error.py | ray.tune.error._TuneStopTrialError | class _TuneStopTrialError(_SubCategoryTuneError):
"""Error that happens when stopping a tune trial."""
pass | class _TuneStopTrialError(_SubCategoryTuneError):
'''Error that happens when stopping a tune trial.'''
pass | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
10,743 | ray-project/ray | python/ray/tune/examples/bohb_example.py | ray.tune.examples.bohb_example.MyTrainableClass | import json
import time
import os
import numpy as np
from ray.tune import Trainable
class MyTrainableClass(Trainable):
"""Example agent whose learning curve is a random sigmoid.
The dummy hyperparameters "width" and "height" determine the slope and
maximum reward value reached.
"""
def setup(self... |
class MyTrainableClass(Trainable):
'''Example agent whose learning curve is a random sigmoid.
The dummy hyperparameters "width" and "height" determine the slope and
maximum reward value reached.
'''
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(se... | 5 | 1 | 5 | 0 | 4 | 1 | 1 | 0.35 | 1 | 1 | 0 | 0 | 4 | 1 | 4 | 4 | 28 | 5 | 17 | 11 | 12 | 6 | 17 | 9 | 12 | 1 | 1 | 1 | 4 |
10,744 | ray-project/ray | python/ray/tune/examples/cifar10_pytorch.py | ray.tune.examples.cifar10_pytorch.Net | import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, l1=120, l2=84):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, l1)
... |
class Net(nn.Module):
def __init__(self, l1=120, l2=84):
pass
def forward(self, x):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 18 | 1 | 17 | 9 | 14 | 0 | 17 | 9 | 14 | 1 | 1 | 0 | 2 |
10,745 | ray-project/ray | python/ray/tune/examples/logging_example.py | ray.tune.examples.logging_example.TestLoggerCallback | from ray.tune.logger import LoggerCallback
class TestLoggerCallback(LoggerCallback):
def on_trial_result(self, iteration, trials, trial, result, **info):
print(f'TestLogger for trial {trial}: {result}') |
class TestLoggerCallback(LoggerCallback):
def on_trial_result(self, iteration, trials, trial, result, **info):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 51 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 6 | 0 | 1 |
10,746 | ray-project/ray | python/ray/tune/examples/mnist_ptl_mini.py | ray.tune.examples.mnist_ptl_mini.LightningMNISTClassifier | import os
import pytorch_lightning as pl
from torch.nn import functional as F
import torch
from torchmetrics import Accuracy
class LightningMNISTClassifier(pl.LightningModule):
def __init__(self, config, data_dir=None):
super(LightningMNISTClassifier, self).__init__()
self.data_dir = data_dir or o... |
class LightningMNISTClassifier(pl.LightningModule):
def __init__(self, config, data_dir=None):
pass
def forward(self, x):
pass
def configure_optimizers(self):
pass
def training_step(self, train_batch, batch_idx):
pass
def validation_step(self, val_batch, batch_i... | 7 | 0 | 7 | 0 | 7 | 0 | 1 | 0.02 | 1 | 1 | 0 | 0 | 6 | 7 | 6 | 6 | 50 | 7 | 42 | 26 | 35 | 1 | 42 | 26 | 35 | 1 | 1 | 0 | 6 |
10,747 | ray-project/ray | python/ray/tune/examples/mnist_ptl_mini.py | ray.tune.examples.mnist_ptl_mini.MNISTDataModule | from torchvision import transforms
import pytorch_lightning as pl
from datasets import load_dataset
import os
from torch.utils.data import DataLoader
from filelock import FileLock
class MNISTDataModule(pl.LightningDataModule):
def __init__(self, batch_size: int, data_dir: str=PATH_DATASETS):
super().__ini... |
class MNISTDataModule(pl.LightningDataModule):
def __init__(self, batch_size: int, data_dir: str=PATH_DATASETS):
pass
def prepare_data(self):
pass
def setup(self, stage=None):
pass
def transform_fn(sample):
pass
def train_dataloader(self):
pa... | 7 | 0 | 5 | 0 | 5 | 0 | 1 | 0.04 | 1 | 3 | 0 | 0 | 5 | 7 | 5 | 5 | 33 | 6 | 26 | 15 | 19 | 1 | 21 | 15 | 14 | 1 | 1 | 1 | 6 |
10,748 | ray-project/ray | python/ray/tune/examples/mnist_pytorch.py | ray.tune.examples.mnist_pytorch.ConvNet | import torch.nn as nn
import torch.nn.functional as F
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))
... |
class ConvNet(nn.Module):
def __init__(self):
pass
def forward(self, x):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 1 | 10 | 5 | 7 | 0 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
10,749 | ray-project/ray | python/ray/tune/examples/mnist_pytorch_trainable.py | ray.tune.examples.mnist_pytorch_trainable.TrainMNIST | import torch
from ray import tune
from ray.tune.examples.mnist_pytorch import ConvNet, get_data_loaders, test_func, train_func
import os
import torch.optim as optim
class TrainMNIST(tune.Trainable):
def setup(self, config):
use_cuda = config.get('use_gpu') and torch.cuda.is_available()
self.device... |
class TrainMNIST(tune.Trainable):
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(self, checkpoint_dir):
pass
def load_checkpoint(self, checkpoint_dir):
pass | 5 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 4 | 5 | 4 | 4 | 24 | 3 | 21 | 13 | 16 | 0 | 17 | 13 | 12 | 2 | 1 | 0 | 5 |
10,750 | ray-project/ray | python/ray/tune/examples/pbt_convnet_example.py | ray.tune.examples.pbt_convnet_example.PytorchTrainable | import torch
import os
import torch.optim as optim
from ray.tune.examples.mnist_pytorch import ConvNet, get_data_loaders, test_func, train_func
from ray import tune
class PytorchTrainable(tune.Trainable):
"""Train a Pytorch ConvNet with Trainable and PopulationBasedTraining
scheduler. The example reuse some... |
class PytorchTrainable(tune.Trainable):
'''Train a Pytorch ConvNet with Trainable and PopulationBasedTraining
scheduler. The example reuse some of the functions in mnist_pytorch,
and is a good demo for how to add the tuning function without
changing the original training code.
'''
def... | 6 | 1 | 5 | 0 | 5 | 0 | 2 | 0.19 | 1 | 1 | 1 | 0 | 5 | 5 | 5 | 5 | 37 | 6 | 26 | 14 | 20 | 5 | 23 | 14 | 17 | 4 | 1 | 2 | 8 |
10,751 | ray-project/ray | python/ray/tune/examples/pbt_dcgan_mnist/common.py | ray.tune.examples.pbt_dcgan_mnist.common.Discriminator | import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self):
super(Discriminator, self).__init__()
self.main = nn.Sequential(nn.Conv2d(nc, ndf, 4, 2, 1, bias=False), nn.LeakyReLU(0.2, inplace=True), nn.Conv2d(ndf, ndf * 2, 4, 2, 1, bias=False), nn.BatchNorm2d(ndf * 2), nn.LeakyReLU(0.... |
class Discriminator(nn.Module):
def __init__(self):
pass
def forward(self, input):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 18 | 1 | 17 | 4 | 14 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
10,752 | ray-project/ray | python/ray/tune/examples/pbt_dcgan_mnist/common.py | ray.tune.examples.pbt_dcgan_mnist.common.Generator | import torch.nn as nn
class Generator(nn.Module):
def __init__(self):
super(Generator, self).__init__()
self.main = nn.Sequential(nn.ConvTranspose2d(nz, ngf * 4, 4, 1, 0, bias=False), nn.BatchNorm2d(ngf * 4), nn.ReLU(True), nn.ConvTranspose2d(ngf * 4, ngf * 2, 4, 2, 1, bias=False), nn.BatchNorm2d(... |
class Generator(nn.Module):
def __init__(self):
pass
def forward(self, input):
pass | 3 | 0 | 9 | 0 | 9 | 1 | 1 | 0.06 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 20 | 1 | 18 | 4 | 15 | 1 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
10,753 | ray-project/ray | python/ray/tune/examples/pbt_dcgan_mnist/common.py | ray.tune.examples.pbt_dcgan_mnist.common.Net | import torch.nn as nn
from torch.nn import functional as F
class Net(nn.Module):
"""
LeNet for MNist classification, used for inception_score
"""
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_s... |
class Net(nn.Module):
'''
LeNet for MNist classification, used for inception_score
'''
def __init__(self):
pass
def forward(self, x):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.19 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 21 | 2 | 16 | 8 | 13 | 3 | 16 | 8 | 13 | 1 | 1 | 0 | 2 |
10,754 | ray-project/ray | python/ray/tune/examples/pbt_dcgan_mnist/pbt_dcgan_mnist_trainable.py | ray.tune.examples.pbt_dcgan_mnist.pbt_dcgan_mnist_trainable.PytorchTrainable | from ray.tune.examples.pbt_dcgan_mnist.common import MODEL_PATH, Discriminator, Generator, Net, beta1, demo_gan, get_data_loader, plot_images, train_func, weights_init
from ray import tune
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import torch
from filelock import FileLock
import torch.n... |
class PytorchTrainable(tune.Trainable):
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(self, checkpoint_dir):
pass
def load_checkpoint(self, checkpoint_dir):
pass
def reset_config(self, new_config):
pass | 6 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 2 | 2 | 0 | 5 | 9 | 5 | 5 | 65 | 6 | 59 | 21 | 53 | 0 | 37 | 21 | 31 | 5 | 1 | 2 | 10 |
10,755 | ray-project/ray | python/ray/tune/examples/pbt_example.py | ray.tune.examples.pbt_example.PBTBenchmarkExample | from ray import tune
import random
import numpy as np
class PBTBenchmarkExample(tune.Trainable):
"""Toy PBT problem for benchmarking adaptive learning rate.
The goal is to optimize this trainable's accuracy. The accuracy increases
fastest at the optimal lr, which is a function of the current accuracy.
... |
class PBTBenchmarkExample(tune.Trainable):
'''Toy PBT problem for benchmarking adaptive learning rate.
The goal is to optimize this trainable's accuracy. The accuracy increases
fastest at the optimal lr, which is a function of the current accuracy.
The optimal lr schedule for this problem is the triang... | 6 | 1 | 9 | 0 | 7 | 2 | 2 | 0.71 | 1 | 0 | 0 | 0 | 5 | 3 | 5 | 5 | 70 | 11 | 38 | 14 | 32 | 27 | 27 | 14 | 21 | 4 | 1 | 1 | 8 |
10,756 | ray-project/ray | python/ray/tune/examples/pbt_memnn_example.py | ray.tune.examples.pbt_memnn_example.MemNNModel | from filelock import FileLock
from ray import tune
import os
class MemNNModel(tune.Trainable):
def build_model(self):
"""Helper method for creating the model"""
vocab = set()
for story, q, answer in self.train_stories + self.test_stories:
vocab |= set(story + q + [answer])
... |
class MemNNModel(tune.Trainable):
def build_model(self):
'''Helper method for creating the model'''
pass
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(self, checkpoint_dir):
pass
def load_checkpoint(self, checkpoint_dir):
... | 6 | 1 | 23 | 3 | 15 | 6 | 1 | 0.36 | 1 | 2 | 0 | 0 | 5 | 9 | 5 | 5 | 119 | 17 | 78 | 32 | 72 | 28 | 55 | 32 | 49 | 2 | 1 | 1 | 6 |
10,757 | ray-project/ray | python/ray/tune/examples/pbt_tune_cifar10_with_keras.py | ray.tune.examples.pbt_tune_cifar10_with_keras.Cifar10Model | from tensorflow.keras.layers import Convolution2D, Dense, Dropout, Flatten, Input, MaxPooling2D
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.datasets import cifar10
import tensorflow as tf
from ray.tune import Trainable
... |
class Cifar10Model(Trainable):
def _read_data(self):
pass
def _build_model(self, input_shape):
pass
def setup(self, config):
pass
def step(self):
pass
def save_checkpoint(self, checkpoint_dir):
pass
def load_checkpoint(self, checkpoint_dir):
... | 8 | 0 | 20 | 2 | 16 | 2 | 1 | 0.15 | 1 | 0 | 0 | 0 | 7 | 3 | 7 | 7 | 148 | 17 | 114 | 25 | 106 | 17 | 55 | 25 | 47 | 1 | 1 | 0 | 7 |
10,758 | ray-project/ray | python/ray/tune/examples/tf_mnist_example.py | ray.tune.examples.tf_mnist_example.MNISTTrainable | import os
from filelock import FileLock
from ray import tune
class MNISTTrainable(tune.Trainable):
def setup(self, config):
import tensorflow as tf
with FileLock(os.path.expanduser('~/.tune.lock')):
(x_train, y_train), (x_test, y_test) = load_data()
x_train, x_test = (x_train /... |
class MNISTTrainable(tune.Trainable):
def setup(self, config):
pass
@tf.function
def train_step(images, labels):
pass
@tf.function
def test_step(images, labels):
pass
def save_checkpoint(self, checkpoint_dir: str):
pass
def ... | 9 | 0 | 16 | 3 | 13 | 1 | 2 | 0.08 | 1 | 4 | 1 | 0 | 4 | 11 | 4 | 4 | 83 | 16 | 63 | 30 | 53 | 5 | 49 | 27 | 41 | 4 | 1 | 2 | 9 |
10,759 | ray-project/ray | python/ray/tune/examples/tf_mnist_example.py | ray.tune.examples.tf_mnist_example.MyModel | class MyModel(Model):
def __init__(self, hiddens=128):
super(MyModel, self).__init__()
self.conv1 = Conv2D(32, 3, activation='relu')
self.flatten = Flatten()
self.d1 = Dense(hiddens, activation='relu')
self.d2 = Dense(10, activation='softmax')
def call(self, x):
... | class MyModel(Model):
def __init__(self, hiddens=128):
pass
def call(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 2 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
10,760 | ray-project/ray | python/ray/tune/execution/class_cache.py | ray.tune.execution.class_cache._ActorClassCache | import ray
from ray.train.v2._internal.constants import ENV_VARS_TO_PROPAGATE as TRAIN_ENV_VARS_TO_PROPAGATE
import os
class _ActorClassCache:
"""Caches actor classes.
ray.remote is a registration call. It sends the serialized object to the
key value store (redis), and will be fetched at an arbitrary work... |
class _ActorClassCache:
'''Caches actor classes.
ray.remote is a registration call. It sends the serialized object to the
key value store (redis), and will be fetched at an arbitrary worker
later. Registration does not use any Ray scheduling resources.
Later, class.remote() actually creates the rem... | 3 | 2 | 8 | 1 | 6 | 1 | 3 | 1.15 | 0 | 0 | 0 | 0 | 2 | 1 | 2 | 2 | 36 | 8 | 13 | 8 | 10 | 15 | 13 | 8 | 10 | 4 | 0 | 2 | 5 |
10,761 | ray-project/ray | python/ray/tune/execution/experiment_state.py | ray.tune.execution.experiment_state._ExperimentCheckpointManager | from ray.train._internal.storage import StorageContext, _download_from_fs_path, _list_at_fs_path, get_fs_and_path
from ray.tune.experiment.trial import Trial
from ray.tune.impl.out_of_band_serialize_dataset import out_of_band_serialize_dataset
import os
from collections import Counter
import time
from typing import Cal... |
class _ExperimentCheckpointManager:
'''Helper class for managing experiment-level checkpoints.
This class implements the ``checkpoint()`` method used to checkpoint
experiment state. When called, this will serialize and write to disk
the state of the trial runner, trial executor, and search algorithm, t... | 9 | 2 | 31 | 3 | 23 | 5 | 3 | 0.28 | 0 | 9 | 2 | 0 | 6 | 10 | 6 | 6 | 227 | 29 | 156 | 44 | 136 | 43 | 70 | 32 | 62 | 9 | 0 | 2 | 21 |
10,762 | ray-project/ray | python/ray/tune/execution/insufficient_resources_manager.py | ray.tune.execution.insufficient_resources_manager._InsufficientResourcesManager | import time
from ray.tune.experiment import Trial
class _InsufficientResourcesManager:
"""Insufficient resources manager.
Makes best effort, conservative guesses about if Tune loop is stuck due to
infeasible resources. If so, outputs usability messages for users to
act upon.
"""
def __init__(... |
class _InsufficientResourcesManager:
'''Insufficient resources manager.
Makes best effort, conservative guesses about if Tune loop is stuck due to
infeasible resources. If so, outputs usability messages for users to
act upon.
'''
def __init__(self, for_train: bool=False):
pass
def... | 3 | 2 | 20 | 1 | 14 | 6 | 3 | 0.57 | 0 | 1 | 0 | 0 | 2 | 3 | 2 | 2 | 49 | 5 | 28 | 8 | 25 | 16 | 18 | 8 | 15 | 5 | 0 | 3 | 6 |
10,763 | ray-project/ray | python/ray/tune/execution/placement_groups.py | ray.tune.execution.placement_groups.PlacementGroupFactory | from ray.air.execution.resources.request import ResourceRequest
from ray.util.annotations import DeveloperAPI, PublicAPI
import warnings
from ray.util.placement_group import placement_group
@PublicAPI(stability='beta')
class PlacementGroupFactory(ResourceRequest):
"""Wrapper class that creates placement groups for... | @PublicAPI(stability='beta')
class PlacementGroupFactory(ResourceRequest):
'''Wrapper class that creates placement groups for trials.
This function should be used to define resource requests for Ray Tune
trials. It holds the parameters to create
:ref:`placement groups <ray-placement-group-doc-ref>`.
... | 3 | 1 | 9 | 0 | 8 | 1 | 1 | 7.44 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 14 | 93 | 17 | 9 | 2 | 7 | 67 | 5 | 2 | 3 | 1 | 1 | 0 | 1 |
10,764 | ray-project/ray | python/ray/tune/execution/tune_controller.py | ray.tune.execution.tune_controller.TrialRunnerWrapper | from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from ray.util.annotations import DeveloperAPI
from ray.util.debug import log_once
@DeveloperAPI
class TrialRunnerWrapper:
"""Wraps around TrialRunner class, intercepts API calls and warns users
of restricted API access.
This is mean... | @DeveloperAPI
class TrialRunnerWrapper:
'''Wraps around TrialRunner class, intercepts API calls and warns users
of restricted API access.
This is meant to facilitate restricting
the current API exposure of TrialRunner by TrialScheduler.
'''
def __init__(self, tune_controller: TuneController, tr... | 4 | 1 | 15 | 1 | 15 | 0 | 3 | 0.16 | 0 | 4 | 2 | 0 | 2 | 3 | 2 | 2 | 41 | 5 | 31 | 14 | 22 | 5 | 15 | 8 | 12 | 4 | 0 | 2 | 6 |
10,765 | ray-project/ray | python/ray/tune/execution/tune_controller.py | ray.tune.execution.tune_controller.TuneController | import json
from ray.exceptions import RayActorError, RayTaskError
import copy
from ray.air.execution._internal import RayActorManager, TrackedActor
from ray.air.execution import PlacementGroupResourceManager, ResourceManager
from ray.tune.result import DEBUG_METRICS, DEFAULT_METRIC, DONE, RESULT_DUPLICATE, SHOULD_CHEC... | null | 91 | 33 | 23 | 3 | 16 | 4 | 3 | 0.26 | 0 | 52 | 34 | 4 | 80 | 53 | 80 | 80 | 1,962 | 342 | 1,289 | 297 | 1,152 | 335 | 822 | 237 | 738 | 11 | 0 | 5 | 242 |
10,766 | ray-project/ray | python/ray/tune/execution/tune_controller.py | ray.tune.execution.tune_controller._FakeRayTrialExecutor | from ray.train._internal.session import _FutureTrainingResult, _TrainingResult
from ray.tune.experiment import Experiment, Trial
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
class _FakeRayTrialExecutor:
"""The TuneController does not use a RayTrialExecutor anymore.
Instead, we pas... |
class _FakeRayTrialExecutor:
'''The TuneController does not use a RayTrialExecutor anymore.
Instead, we pass this fake executor for searchers/schedulers to use
as an interface.
In the future, we should have the searchers/schedulers either interact with
the tune controller, or define a different API... | 8 | 1 | 3 | 0 | 3 | 0 | 1 | 0.35 | 0 | 2 | 1 | 0 | 6 | 1 | 6 | 6 | 35 | 8 | 20 | 13 | 8 | 7 | 13 | 8 | 6 | 1 | 0 | 0 | 6 |
10,767 | ray-project/ray | python/ray/tune/execution/tune_controller.py | ray.tune.execution.tune_controller._TrialExecutorWrapper | from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
from ray.util.debug import log_once
class _TrialExecutorWrapper:
"""Wraps around TrialExecutor class, intercepts API calls and warns users
of restricted API access.
This is meant to facilitate restricting
the current API exposur... |
class _TrialExecutorWrapper:
'''Wraps around TrialExecutor class, intercepts API calls and warns users
of restricted API access.
This is meant to facilitate restricting
the current API exposure of TrialExecutor by TrialScheduler.
'''
def __init__(self, trial_executor: '_FakeRayTrialExecutor', ... | 3 | 1 | 12 | 1 | 11 | 0 | 3 | 0.22 | 0 | 1 | 0 | 0 | 2 | 2 | 2 | 2 | 32 | 4 | 23 | 10 | 16 | 5 | 11 | 6 | 8 | 3 | 0 | 2 | 5 |
10,768 | ray-project/ray | python/ray/tune/experiment/Trial.py | ray.tune.experiment.Trial.Trial | from ray.tune.error import TuneError
from ray.tune.result import DEBUG_METRICS, DONE, NODE_IP, PID, STDERR_FILE, STDOUT_FILE, TRIAL_ID, TRIAL_INFO
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
from pathlib import Path
import ray
import os
from ray.tune.utils import date_str, flatten_dic... | @DeveloperAPI
class Trial:
'''A trial object holds the state for one model training run.
Trials are themselves managed by the TrialRunner class, which implements
the event loop for submitting trial runs to a Ray cluster.
Trials start in the PENDING state, and transition to RUNNING once started.
On e... | 94 | 19 | 11 | 1 | 8 | 2 | 2 | 0.26 | 0 | 27 | 12 | 0 | 61 | 27 | 64 | 64 | 826 | 146 | 541 | 196 | 423 | 141 | 359 | 143 | 293 | 9 | 0 | 3 | 130 |
10,769 | ray-project/ray | python/ray/tune/experiment/Trial.py | ray.tune.experiment.Trial._TemporaryTrialState | from ray.train._internal.session import _FutureTrainingResult, _TrainingResult
import ray.cloudpickle as cloudpickle
import ray
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
class _TemporaryTrialState:
"""Temporary trial state.
Values saved here should not be restored on resum... |
class _TemporaryTrialState:
'''Temporary trial state.
Values saved here should not be restored on resume.
'''
def __init__(self):
pass
def __getstate__(self):
pass | 3 | 1 | 6 | 2 | 4 | 0 | 1 | 0.33 | 0 | 3 | 2 | 0 | 2 | 5 | 2 | 2 | 18 | 6 | 9 | 8 | 6 | 3 | 9 | 8 | 6 | 1 | 0 | 0 | 2 |
10,770 | ray-project/ray | python/ray/tune/experiment/experiment.py | ray.tune.experiment.experiment.Experiment | from ray.tune import CheckpointConfig, SyncConfig
from functools import partial
from pickle import PicklingError
from ray.train._internal.storage import StorageContext
import traceback
from ray.train.constants import DEFAULT_STORAGE_PATH
from ray.tune.stopper import CombinedStopper, FunctionStopper, Stopper, TimeoutSto... | @DeveloperAPI
class Experiment:
'''Tracks experiment specifications.
Implicitly registers the Trainable if needed. The args here take
the same meaning as the arguments defined `tune.py:run`.
.. code-block:: python
experiment_spec = Experiment(
"my_experiment_name",
my_fun... | 29 | 6 | 22 | 2 | 17 | 3 | 4 | 0.24 | 0 | 23 | 8 | 0 | 10 | 4 | 13 | 13 | 337 | 41 | 239 | 71 | 186 | 57 | 113 | 33 | 97 | 19 | 0 | 3 | 46 |
10,771 | ray-project/ray | python/ray/tune/experiment/trial.py | ray.tune.experiment.trial.ExportFormat | from ray.tune.error import TuneError
from ray.util.annotations import Deprecated, DeveloperAPI
@DeveloperAPI
class ExportFormat:
"""Describes the format to import/export the trial Trainable.
This may correspond to different file formats based on the
Trainable implementation.
"""
CHECKPOINT = 'chec... | @DeveloperAPI
class ExportFormat:
'''Describes the format to import/export the trial Trainable.
This may correspond to different file formats based on the
Trainable implementation.
'''
@staticmethod
def validate(formats):
'''Validates formats.
Raises:
ValueError: if t... | 4 | 2 | 15 | 1 | 10 | 4 | 3 | 0.5 | 0 | 2 | 1 | 0 | 0 | 0 | 1 | 1 | 28 | 4 | 16 | 8 | 13 | 8 | 10 | 7 | 8 | 3 | 0 | 2 | 3 |
10,772 | ray-project/ray | python/ray/tune/experiment/trial.py | ray.tune.experiment.trial.Trial | from ray.tune.execution.placement_groups import PlacementGroupFactory, resource_dict_to_pg_factory
from ray.tune.error import TuneError
from ray._common.utils import binary_to_hex, hex_to_binary
from ray.train._internal.storage import StorageContext, _exists_at_fs_path
from ray.train.constants import RAY_CHDIR_TO_TRIAL... | @DeveloperAPI
class Trial:
'''A trial object holds the state for one model training run.
Trials are themselves managed by the TrialRunner class, which implements
the event loop for submitting trial runs to a Ray cluster.
Trials start in the PENDING state, and transition to RUNNING once started.
On e... | 94 | 19 | 11 | 1 | 8 | 2 | 2 | 0.26 | 0 | 27 | 12 | 0 | 61 | 27 | 64 | 64 | 826 | 146 | 541 | 196 | 423 | 141 | 359 | 143 | 293 | 9 | 0 | 3 | 130 |
10,773 | ray-project/ray | python/ray/tune/experiment/trial.py | ray.tune.experiment.trial._Location | import platform
class _Location:
"""Describes the location at which Trial is placed to run."""
def __init__(self, hostname=None, pid=None):
self.hostname = hostname
self.pid = pid
def __str__(self):
if not self.pid:
return ''
elif self.hostname == platform.node... |
class _Location:
'''Describes the location at which Trial is placed to run.'''
def __init__(self, hostname=None, pid=None):
pass
def __str__(self):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.09 | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 14 | 2 | 11 | 5 | 8 | 1 | 9 | 5 | 6 | 3 | 0 | 1 | 4 |
10,774 | ray-project/ray | python/ray/tune/experiment/trial.py | ray.tune.experiment.trial._TemporaryTrialState | from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import ray.cloudpickle as cloudpickle
import ray
from ray.train._internal.session import _FutureTrainingResult, _TrainingResult
class _TemporaryTrialState:
"""Temporary trial state.
Values saved here should not be restored on resum... |
class _TemporaryTrialState:
'''Temporary trial state.
Values saved here should not be restored on resume.
'''
def __init__(self):
pass
def __getstate__(self):
pass | 3 | 1 | 6 | 2 | 4 | 0 | 1 | 0.33 | 0 | 3 | 2 | 0 | 2 | 5 | 2 | 2 | 18 | 6 | 9 | 8 | 6 | 3 | 9 | 8 | 6 | 1 | 0 | 0 | 2 |
10,775 | ray-project/ray | python/ray/tune/experiment/trial.py | ray.tune.experiment.trial._TrialInfo | from ray.tune.execution.placement_groups import PlacementGroupFactory, resource_dict_to_pg_factory
class _TrialInfo:
"""Serializable struct for holding information for a Trial.
Attributes:
trial_name: String name of the current trial.
trial_id: trial_id of the trial
trial_resources: re... |
class _TrialInfo:
'''Serializable struct for holding information for a Trial.
Attributes:
trial_name: String name of the current trial.
trial_id: trial_id of the trial
trial_resources: resources used by trial.
'''
def __init__(self, trial: 'Trial'):
pass
@property
... | 12 | 1 | 3 | 0 | 3 | 0 | 1 | 0.29 | 0 | 2 | 1 | 0 | 6 | 4 | 6 | 6 | 34 | 7 | 21 | 16 | 9 | 6 | 16 | 11 | 9 | 1 | 0 | 0 | 6 |
10,776 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output.AirVerbosity | from enum import IntEnum
class AirVerbosity(IntEnum):
SILENT = 0
DEFAULT = 1
VERBOSE = 2
def __repr__(self):
return str(self.value) |
class AirVerbosity(IntEnum):
def __repr__(self):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 56 | 7 | 1 | 6 | 5 | 4 | 0 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
10,777 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output.ProgressReporter | from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
from ray.tune.result import AUTO_RESULT_KEYS, EPISODE_REWARD_MEAN, MEAN_ACCURACY, MEAN_LOSS, TIME_TOTAL_S, TIMESTEPS_TOTAL
import time
from ray.tune import Checkpoint
from ray.air.constants import TRAINING_ITERATION
from ray.tune.callback ... |
class ProgressReporter(Callback):
'''Periodically prints out status update.'''
def __init__(self, verbosity: AirVerbosity, progress_metrics: Optional[Union[List[str], List[Dict[str, str]]]]=None):
'''
Args:
verbosity: AirVerbosity level.
'''
pass
@property
d... | 21 | 3 | 10 | 1 | 9 | 0 | 2 | 0.06 | 1 | 9 | 3 | 2 | 18 | 6 | 18 | 56 | 214 | 30 | 175 | 80 | 117 | 10 | 98 | 41 | 79 | 3 | 5 | 1 | 32 |
10,778 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output.TrainReporter | from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
from ray.air.constants import TRAINING_ITERATION
import time
from ray.tune.experiment.trial import Trial
class TrainReporter(ProgressReporter):
_heartbeat_threshold = AirVerbosity.VERBOSE
_intermediate_result_verbosity = AirVerbos... |
class TrainReporter(ProgressReporter):
def _get_heartbeat(self, trials: List[Trial], force_full_output: bool=False):
pass
def _print_heartbeat(self, trials, *args, force: bool=False):
pass
def on_trial_result(self, iteration: int, trials: List[Trial], trial: Trial, result: Dict, **info):... | 4 | 0 | 10 | 0 | 10 | 0 | 2 | 0.06 | 1 | 4 | 1 | 0 | 3 | 1 | 3 | 59 | 39 | 3 | 34 | 18 | 23 | 2 | 20 | 11 | 16 | 4 | 6 | 1 | 6 |
10,779 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output.TuneReporterBase | from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
class TuneReporterBase(ProgressReporter):
_heartbeat_threshold = AirVerbosity.DEFAULT
_wrap_headers = False
_intermediate_result_verbosity = AirVerbosity.VERBOSE
_start_end_verbosity = AirVerbosity.DEFAULT
_addressing_... |
class TuneReporterBase(ProgressReporter):
def __init__(self, verbosity: AirVerbosity, num_samples: int=0, metric: Optional[str]=None, mode: Optional[str]=None, config: Optional[Dict]=None, progress_metrics: Optional[Union[List[str], List[Dict[str, str]]]]=None):
pass
def setup(self, start_time: Optio... | 6 | 0 | 13 | 0 | 12 | 1 | 1 | 0.13 | 1 | 9 | 2 | 1 | 5 | 5 | 5 | 61 | 79 | 7 | 64 | 36 | 43 | 8 | 34 | 21 | 28 | 3 | 6 | 1 | 7 |
10,780 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output.TuneTerminalReporter | from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
import sys
from ray._private.thirdparty.tabulate.tabulate import DataRow, Line, TableFormat, tabulate
from ray.tune.experiment.trial import Trial
class TuneTerminalReporter(TuneReporterBase):
def experiment_started(self, experiment_n... |
class TuneTerminalReporter(TuneReporterBase):
def experiment_started(self, experiment_name: str, experiment_path: str, searcher_str: str, scheduler_str: str, total_num_samples: int, tensorboard_path: Optional[str]=None, **kwargs):
pass
def _print_heartbeat(self, trials, *sys_args, force: bool=False):... | 3 | 0 | 48 | 3 | 44 | 2 | 6 | 0.03 | 1 | 5 | 1 | 0 | 2 | 0 | 2 | 63 | 98 | 7 | 89 | 21 | 77 | 3 | 36 | 12 | 33 | 10 | 7 | 2 | 12 |
10,781 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output._PerStatusTrialTableData | from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
from dataclasses import dataclass
@dataclass
class _PerStatusTrialTableData:
trial_infos: List[List[str]]
more_info: str | @dataclass
class _PerStatusTrialTableData:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,782 | ray-project/ray | python/ray/tune/experimental/output.py | ray.tune.experimental.output._TrialTableData | from dataclasses import dataclass
from typing import Any, Collection, Dict, Iterable, List, Optional, Tuple, Union
@dataclass
class _TrialTableData:
header: List[str]
data: List[_PerStatusTrialTableData] | @dataclass
class _TrialTableData:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 0 | 0 | 0 |
10,783 | ray-project/ray | python/ray/tune/impl/config.py | ray.tune.impl.config.CheckpointConfig | from ray.air.config import CheckpointConfig as _CheckpointConfig, FailureConfig as _FailureConfig, RunConfig as _RunConfig
from ray.train.utils import _copy_doc, _log_deprecation_warning
from dataclasses import dataclass
@dataclass
@_copy_doc(_CheckpointConfig)
class CheckpointConfig(_CheckpointConfig):
pass | @dataclass
@_copy_doc(_CheckpointConfig)
class CheckpointConfig(_CheckpointConfig):
pass | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
10,784 | ray-project/ray | python/ray/tune/impl/config.py | ray.tune.impl.config.FailureConfig | from dataclasses import dataclass
from ray.train.utils import _copy_doc, _log_deprecation_warning
from ray.air.config import CheckpointConfig as _CheckpointConfig, FailureConfig as _FailureConfig, RunConfig as _RunConfig
@dataclass
@_copy_doc(_FailureConfig)
class FailureConfig(_FailureConfig):
pass | @dataclass
@_copy_doc(_FailureConfig)
class FailureConfig(_FailureConfig):
pass | 3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
10,785 | ray-project/ray | python/ray/tune/impl/config.py | ray.tune.impl.config.RunConfig | from ray.train.constants import V2_MIGRATION_GUIDE_MESSAGE, _v2_migration_warnings_enabled
from dataclasses import dataclass
from ray.train.utils import _copy_doc, _log_deprecation_warning
from ray.air.config import CheckpointConfig as _CheckpointConfig, FailureConfig as _FailureConfig, RunConfig as _RunConfig
@datacl... | @dataclass
@_copy_doc(_RunConfig)
class RunConfig(_RunConfig):
def __post_init__(self):
pass | 4 | 0 | 21 | 3 | 18 | 0 | 5 | 0 | 1 | 3 | 2 | 0 | 1 | 2 | 1 | 1 | 22 | 3 | 19 | 4 | 17 | 0 | 11 | 4 | 9 | 5 | 1 | 2 | 5 |
10,786 | ray-project/ray | python/ray/tune/impl/placeholder.py | ray.tune.impl.placeholder._FunctionResolver | from typing import Any, Dict, Tuple
class _FunctionResolver:
"""Replaced value for function typed objects."""
TOKEN = '__fn_ph'
def __init__(self, hash, fn):
self.hash = hash
self._fn = fn
def resolve(self, config: Dict):
"""Some functions take a resolved spec dict as input.
... |
class _FunctionResolver:
'''Replaced value for function typed objects.'''
def __init__(self, hash, fn):
pass
def resolve(self, config: Dict):
'''Some functions take a resolved spec dict as input.
Note: Function placeholders are independently sampled during
resolution. Ther... | 4 | 2 | 4 | 0 | 2 | 1 | 1 | 0.56 | 0 | 1 | 0 | 0 | 3 | 2 | 3 | 3 | 19 | 5 | 9 | 7 | 5 | 5 | 9 | 7 | 5 | 1 | 0 | 0 | 3 |
10,787 | ray-project/ray | python/ray/tune/impl/placeholder.py | ray.tune.impl.placeholder._RefResolver | class _RefResolver:
"""Replaced value for all other non-primitive objects."""
TOKEN = '__ref_ph'
def __init__(self, hash, value):
self.hash = hash
self._value = value
def resolve(self):
return self._value
def get_placeholder(self) -> str:
return (self.TOKEN, self.h... | class _RefResolver:
'''Replaced value for all other non-primitive objects.'''
def __init__(self, hash, value):
pass
def resolve(self):
pass
def get_placeholder(self) -> str:
pass | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.11 | 0 | 1 | 0 | 0 | 3 | 2 | 3 | 3 | 14 | 4 | 9 | 7 | 5 | 1 | 9 | 7 | 5 | 1 | 0 | 0 | 3 |
10,788 | ray-project/ray | python/ray/tune/impl/tuner_internal.py | ray.tune.impl.tuner_internal.TunerInternal | from ray.air._internal.usage import AirEntrypoint
from ray.train.utils import _log_deprecation_warning
from ray.air._internal.uri_utils import URI
import math
from pathlib import Path
import pyarrow.fs
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Type, Union
from ray.tune.tune import _C... |
class TunerInternal:
'''The real implementation behind external facing ``Tuner``.
The external facing ``Tuner`` multiplexes between local Tuner and remote Tuner
depending on whether in Ray client mode.
In Ray client mode, external ``Tuner`` wraps ``TunerInternal`` into a remote actor,
which is guar... | 32 | 10 | 21 | 2 | 16 | 4 | 2 | 0.29 | 0 | 21 | 12 | 0 | 26 | 10 | 26 | 26 | 611 | 86 | 410 | 121 | 332 | 117 | 191 | 70 | 161 | 8 | 0 | 2 | 63 |
10,789 | ray-project/ray | python/ray/tune/integration/keras.py | ray.tune.integration.keras.TuneReportCallback | class TuneReportCallback:
"""Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead."""
def __new__(cls, *args, **kwargs):
raise DeprecationWarning(_DEPRECATION_MESSAGE) | class TuneReportCallback:
'''Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead.'''
def __new__(cls, *args, **kwargs):
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.67 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 3 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,790 | ray-project/ray | python/ray/tune/integration/keras.py | ray.tune.integration.keras.TuneReportCheckpointCallback | class TuneReportCheckpointCallback:
"""Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead."""
def __new__(cls, *args, **kwargs):
raise DeprecationWarning(_DEPRECATION_MESSAGE) | class TuneReportCheckpointCallback:
'''Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead.'''
def __new__(cls, *args, **kwargs):
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.67 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 3 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,791 | ray-project/ray | python/ray/tune/integration/keras.py | ray.tune.integration.keras._TuneCheckpointCallback | class _TuneCheckpointCallback:
"""Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead."""
def __new__(cls, *args, **kwargs):
raise DeprecationWarning(_DEPRECATION_MESSAGE) | class _TuneCheckpointCallback:
'''Deprecated.
Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead.'''
def __new__(cls, *args, **kwargs):
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 0.67 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 6 | 1 | 3 | 2 | 1 | 2 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,792 | ray-project/ray | python/ray/tune/integration/lightgbm.py | ray.tune.integration.lightgbm.TuneReportCallback | from ray.util.annotations import Deprecated
@Deprecated
class TuneReportCallback:
def __new__(cls: type, *args, **kwargs):
raise DeprecationWarning('`TuneReportCallback` is deprecated. Use `ray.tune.integration.lightgbm.TuneReportCheckpointCallback` instead.') | @Deprecated
class TuneReportCallback:
def __new__(cls: type, *args, **kwargs):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.17 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 7 | 0 | 6 | 2 | 4 | 1 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,793 | ray-project/ray | python/ray/tune/integration/pytorch_lightning.py | ray.tune.integration.pytorch_lightning.TuneCallback | from typing import Dict, List, Optional, Type, Union
@_override_ptl_hooks
class TuneCallback(Callback):
"""Base class for Tune's PyTorch Lightning callbacks.
Args:
on: When to trigger checkpoint creations. Must be one of
the PyTorch Lightning event hooks (less the ``on_``), e.g.
... | @_override_ptl_hooks
class TuneCallback(Callback):
'''Base class for Tune's PyTorch Lightning callbacks.
Args:
on: When to trigger checkpoint creations. Must be one of
the PyTorch Lightning event hooks (less the ``on_``), e.g.
"train_batch_start", or "train_end". Defaults to "val... | 4 | 1 | 9 | 2 | 7 | 1 | 3 | 0.5 | 1 | 4 | 0 | 2 | 2 | 1 | 2 | 2 | 27 | 6 | 14 | 5 | 11 | 7 | 11 | 5 | 8 | 4 | 1 | 2 | 5 |
10,794 | ray-project/ray | python/ray/tune/integration/pytorch_lightning.py | ray.tune.integration.pytorch_lightning.TuneReportCallback | from ray.util.annotations import Deprecated, PublicAPI
from typing import Dict, List, Optional, Type, Union
import warnings
from ray.util import log_once
@Deprecated
class TuneReportCallback(TuneReportCheckpointCallback):
def __init__(self, metrics: Optional[Union[str, List[str], Dict[str, str]]]=None, on: Union[... | @Deprecated
class TuneReportCallback(TuneReportCheckpointCallback):
def __init__(self, metrics: Optional[Union[str, List[str], Dict[str, str]]]=None, on: Union[str, List[str]]='validation_end'):
pass | 3 | 0 | 15 | 0 | 15 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 7 | 16 | 0 | 16 | 6 | 10 | 0 | 5 | 2 | 3 | 2 | 3 | 1 | 2 |
10,795 | ray-project/ray | python/ray/tune/integration/pytorch_lightning.py | ray.tune.integration.pytorch_lightning.TuneReportCheckpointCallback | from ray.tune import Checkpoint
import tempfile
from ray.util.annotations import Deprecated, PublicAPI
from contextlib import contextmanager
from typing import Dict, List, Optional, Type, Union
import ray.tune
import os
@PublicAPI
class TuneReportCheckpointCallback(TuneCallback):
"""PyTorch Lightning report and ch... | @PublicAPI
class TuneReportCheckpointCallback(TuneCallback):
'''PyTorch Lightning report and checkpoint callback
Saves checkpoints after each validation step. Also reports metrics to Tune,
which is needed for checkpoint registration.
Args:
metrics: Metrics to report to Tune. If this is a list,
... | 7 | 1 | 14 | 1 | 12 | 0 | 3 | 0.55 | 1 | 6 | 1 | 1 | 4 | 3 | 4 | 6 | 96 | 17 | 51 | 22 | 39 | 28 | 38 | 13 | 33 | 6 | 2 | 3 | 13 |
10,796 | ray-project/ray | python/ray/tune/integration/pytorch_lightning.py | ray.tune.integration.pytorch_lightning._TuneCheckpointCallback | class _TuneCheckpointCallback(TuneCallback):
def __init__(self, *args, **kwargs):
raise DeprecationWarning('`ray.tune.integration.pytorch_lightning._TuneCheckpointCallback` is deprecated.') | class _TuneCheckpointCallback(TuneCallback):
def __init__(self, *args, **kwargs):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 3 | 6 | 0 | 6 | 2 | 4 | 0 | 3 | 2 | 1 | 1 | 2 | 0 | 1 |
10,797 | ray-project/ray | python/ray/tune/integration/ray_train.py | ray.tune.integration.ray_train.TuneReportCallback | from ray.train._internal.session import get_session
from typing import Any, Dict, List, Optional
from ray.train import Checkpoint as RayTrainCheckpoint
from ray.train.v2.api.callback import UserCallback
from ray.tune.trainable.trainable_fn_utils import _in_tune_session
from ray.train.v2._internal.execution.context impo... | @DeveloperAPI
class TuneReportCallback(UserCallback):
'''Propagate metrics and checkpoint paths from Ray Train workers to Ray Tune.'''
def __init__(self):
pass
def after_report(self, run_context: TrainRunContext, metrics: List[Dict[str, Any]], checkpoint: Optional[RayTrainCheckpoint]):
pas... | 4 | 1 | 17 | 2 | 10 | 5 | 2 | 0.55 | 1 | 3 | 1 | 0 | 1 | 0 | 1 | 3 | 20 | 3 | 11 | 7 | 4 | 6 | 6 | 2 | 4 | 2 | 2 | 1 | 2 |
10,798 | ray-project/ray | python/ray/tune/integration/xgboost.py | ray.tune.integration.xgboost.TuneReportCallback | from ray.util.annotations import Deprecated, PublicAPI
@Deprecated
class TuneReportCallback:
def __new__(cls: type, *args, **kwargs):
raise DeprecationWarning('`TuneReportCallback` is deprecated. Use `ray.tune.integration.xgboost.TuneReportCheckpointCallback` instead.') | @Deprecated
class TuneReportCallback:
def __new__(cls: type, *args, **kwargs):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.17 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 7 | 0 | 6 | 2 | 4 | 1 | 3 | 2 | 1 | 1 | 0 | 0 | 1 |
10,799 | ray-project/ray | python/ray/tune/logger/aim.py | ray.tune.logger.aim.AimLoggerCallback | import numpy as np
from ray.util.annotations import PublicAPI
from ray.tune.utils import flatten_dict
from ray.air.constants import TRAINING_ITERATION
from ray.tune.result import TIME_TOTAL_S, TIMESTEPS_TOTAL
from typing import TYPE_CHECKING, Dict, List, Optional, Union
from ray.tune.logger.logger import LoggerCallback... | @PublicAPI
class AimLoggerCallback(LoggerCallback):
'''Aim Logger: logs metrics in Aim format.
Aim is an open-source, self-hosted ML experiment tracking tool.
It's good at tracking lots (thousands) of training runs, and it allows you to
compare them with a performant and well-designed UI.
Source: ht... | 8 | 3 | 21 | 3 | 17 | 2 | 3 | 0.35 | 1 | 7 | 0 | 0 | 6 | 5 | 6 | 56 | 162 | 25 | 102 | 41 | 89 | 36 | 61 | 35 | 54 | 6 | 6 | 2 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.