-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[air/output] Improve leaked mentions of Tune concepts #35003
Changes from 10 commits
b86cf6d
6612ac0
d513cef
32684ed
02480c9
32c5d3b
7d79292
a9cbf50
881975c
df10274
4b5b39a
fb648e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,12 +134,15 @@ def __init__( | |
callbacks: Optional[List[Callback]] = None, | ||
metric: Optional[str] = None, | ||
trial_checkpoint_config: Optional[CheckpointConfig] = None, | ||
_trainer_api: bool = False, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. explanation of what this is? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tried this before, and long story short, it's not very straightforward due to the fact that we need some of the information pretty early, but number of trials is only calculated later. It also can lead to confusing situations - e.g. it's totally valid to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, I just feel like passing such a generic sounding parameter all the way through so many components like Tuner, BackendExecutor, etc just to be able to show the right output message is kind of too heavy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're doing the same at the moment with This is not a logging configuration in my opinion. Users should not "configure" which output/error messages they want to see. It's more of a runtime context. Ray core has a runtime context object, I think we just need something similar for Ray AIR. |
||
): | ||
self._search_alg = search_alg or BasicVariantGenerator() | ||
self._placeholder_resolvers = placeholder_resolvers | ||
self._scheduler_alg = scheduler or FIFOScheduler() | ||
self._callbacks = CallbackList(callbacks or []) | ||
self._insufficient_resources_manager = _InsufficientResourcesManager() | ||
self._insufficient_resources_manager = _InsufficientResourcesManager( | ||
for_train=_trainer_api | ||
) | ||
self._pending_trial_queue_times = {} | ||
|
||
self._max_pending_trials = _get_max_pending_trials(self._search_alg) | ||
|
@@ -519,6 +522,11 @@ def resume( | |
trial_to_add.status = Trial.TERMINATED | ||
self.add_trial(trial_to_add) | ||
|
||
def update_max_pending_trials(self, max_pending_trials: Optional[int] = None): | ||
self._max_pending_trials = max_pending_trials or _get_max_pending_trials( | ||
self._search_alg | ||
) | ||
|
||
def update_pending_trial_resources( | ||
self, resources: Union[dict, PlacementGroupFactory] | ||
): | ||
|
@@ -1252,6 +1260,7 @@ def __init__( | |
callbacks: Optional[List[Callback]] = None, | ||
metric: Optional[str] = None, | ||
trial_checkpoint_config: Optional[CheckpointConfig] = None, | ||
_trainer_api: bool = False, | ||
# Deprecated | ||
local_checkpoint_dir: Optional[str] = None, | ||
): | ||
|
@@ -1287,6 +1296,7 @@ def __init__( | |
callbacks=callbacks, | ||
metric=metric, | ||
trial_checkpoint_config=trial_checkpoint_config, | ||
_trainer_api=_trainer_api, | ||
) | ||
|
||
self.trial_executor.setup( | ||
|
@@ -1308,6 +1318,10 @@ def _wrapped(self): | |
executor_whitelist_attr={"has_resources_for_trial", "pause_trial", "save"}, | ||
) | ||
|
||
def update_max_pending_trials(self, max_pending_trials: Optional[int] = None): | ||
super().update_max_pending_trials(max_pending_trials=max_pending_trials) | ||
self.trial_executor._max_staged_actors = self._max_pending_trials | ||
|
||
def _used_resources_string(self) -> str: | ||
return self.trial_executor.debug_string() | ||
|
||
|
@@ -1604,7 +1618,9 @@ def _get_max_pending_trials(search_alg: SearchAlgorithm) -> int: | |
# Use a minimum of 16 to trigger fast autoscaling | ||
# Scale up to at most the number of available cluster CPUs | ||
cluster_cpus = ray.cluster_resources().get("CPU", 1.0) | ||
max_pending_trials = max(16, int(cluster_cpus * 1.1)) | ||
max_pending_trials = min( | ||
max(search_alg.total_samples, 16), max(16, int(cluster_cpus * 1.1)) | ||
) | ||
|
||
if max_pending_trials > 128: | ||
logger.warning( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justinvyu can we have a chat about adding parameters like
_trainer_api
in Tuner :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we generally need a good idea how to pass this information.
To me it feels like there should be some time of context. We have different requirements for different ML jobs. Even rllib vs Train has different requirements (e.g. default metrics to show), and maybe even rllib's single algorithms.
We don't have that story, yet, so in order to unblock this work, I think we can go ahead with the private flags. But yes, we should resolve this (also for telemetry).