Skip to content

Commit

Permalink
[air] Do not warn of checkpoint_dir if it's coming from us (base_tr…
Browse files Browse the repository at this point in the history
…ainer). (ray-project#26259)

Currently, the following information will be printed even the user is not directly using a tune function. This is confusing and not actionable.

```
 "`checkpoint_dir` in `func(config, checkpoint_dir)` is "
                    "being deprecated. "
                    "To save and load checkpoint in trainable functions, "
                    "please use the `ray.air.session` API:\n\n"
                    "from ray.air import session\n\n"
                    "def train(config):\n"
                    "    # ...\n"
                    '    session.report({"metric": metric}, checkpoint=checkpoint)\n\n'
                    "For more information please see "
                    "https://docs.ray.io/en/master/ray-air/key-concepts.html#session\n"
```

The new logic check if `base_trainer` is in the call stack and only adds the warning message when it is not. The new logic will be removed once internally we migrate to use `session` API.
  • Loading branch information
xwjiang2010 committed Jul 4, 2022
1 parent 11a24d6 commit b08a968
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/ray/train/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def train_func(config, checkpoint_dir=None):
# stdout messages and the results directory.
train_func.__name__ = trainer_cls.__name__

trainable_cls = wrap_function(train_func)
trainable_cls = wrap_function(train_func, warn=False)

class TrainTrainable(trainable_cls):
"""Add default resources to the Trainable."""
Expand Down

0 comments on commit b08a968

Please sign in to comment.