ray-project / ray

Ray is a unified framework for scaling AI and Python applications. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
32.97k stars 5.58k forks source link

[RLlib] `rllib example run` does not work #41082

Open Yelinz opened 10 months ago

Yelinz commented 10 months ago

What happened + What you expected to happen

Im following the Learning Ray book and got to the rllib chapter. I was trying to follow examples, but with ray 2.8.0 and torch. Instead of the suggested 2.2.0, thinking a few deprecations wont stop me. Trying to execute rllib example run cartpole-ppo resulted in an error, where im not sure whats wrong and why it is trying to do something with wandb. I also didnt find anything that could help in the documentation or past issues.

I even tried the minimal setup from the documentation and the command does not work.

poetry run rllib example run cartpole-ppo
>>> Attempting to download example file https://raw.githubusercontent.com/ray-project/ray/master/rllib/tuned_examples/ppo/cartpole-ppo.yaml...
b'cartpole-ppo:\n    env: CartPole-v1\n    run: PPO\n    stop:\n        sampler_results/episode_reward_mean: 150\n        timesteps_total: 100000\n    config:\n        # Works for both torch and tf2.\n        framework: torch\n        gamma: 0.99\n        lr: 0.0003\n        num_workers: 1\n        num_sgd_iter: 6\n        vf_loss_coeff: 0.01\n        model:\n            fcnet_hiddens: [32]\n            fcnet_activation: linear\n            vf_share_layers: true\n'
  Status code: 200
  Downloaded example file to /tmp/tmpv4q1n2un.yaml
2023-11-12 18:09:05,765 INFO worker.py:1673 -- Started a local Ray instance.
<lots of warnings which have been excluded>
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ rllib/scripts.py:105 in run                                                                      │
│                                                                                                  │
│   102 │   example_file, temp_file = download_example_file(example_file)                          │
│   103 │   stop = example.get("stop")                                                             │
│   104 │                                                                                          │
│ ❱ 105 │   train_module.file(                                                                     │
│   106 │   │   config_file=example_file,                                                          │
│   107 │   │   stop=stop,                                                                         │
│   108 │   │   checkpoint_freq=1,                                                                 │
│                                                                                                  │
│ ╭───────────────────────────────── locals ─────────────────────────────────╮                     │
│ │      example = {                                                         │                     │
│ │                │   'file': 'tuned_examples/ppo/cartpole-ppo.yaml',       │                     │
│ │                │   'description': 'Run PPO on CartPole-v1.'              │                     │
│ │                }                                                         │                     │
│ │ example_file = '/tmp/tmpv4q1n2un.yaml'                                   │                     │
│ │   example_id = 'cartpole-ppo'                                            │                     │
│ │         stop = None                                                      │                     │
│ │    temp_file = <tempfile._TemporaryFileWrapper object at 0x7fa3ecf4dc30> │                     │
│ ╰──────────────────────────────────────────────────────────────────────────╯                     │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ rllib/train.py:222 in file                                                                       │
│                                                                                                  │
│   219 │   if temp_file:                                                                          │
│   220 │   │   temp_file.close()                                                                  │
│   221 │                                                                                          │
│ ❱ 222 │   run_rllib_experiments(                                                                 │
│   223 │   │   experiments=experiments,                                                           │
│   224 │   │   v=v,                                                                               │
│   225 │   │   vv=vv,                                                                             │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                    algo = 'PPO'                                                              │ │
│ │               callbacks = [                                                                  │ │
│ │                           │   <ray.air.integrations.wandb.WandbLoggerCallback object at      │ │
│ │                           0x7fa3ecf4dcc0>,                                                   │ │
│ │                           │   <ray.tune.experimental.output.TuneTerminalReporter object at   │ │
│ │                           0x7fa4cf6be230>,                                                   │ │
│ │                           │   <ray.tune.logger.csv.CSVLoggerCallback object at               │ │
│ │                           0x7fa4cf6be2c0>,                                                   │ │
│ │                           │   <ray.tune.logger.json.JsonLoggerCallback object at             │ │
│ │                           0x7fa4cf6bef20>,                                                   │ │
│ │                           │   <ray.tune.logger.tensorboardx.TBXLoggerCallback object at      │ │
│ │                           0x7fa4cf6bf190>                                                    │ │
│ │                           ]                                                                  │ │
│ │       checkpoint_at_end = True                                                               │ │
│ │       checkpoint_config = {                                                                  │ │
│ │                           │   'checkpoint_frequency': 1,                                     │ │
│ │                           │   'checkpoint_at_end': True,                                     │ │
│ │                           │   'num_to_keep': None,                                           │ │
│ │                           │   'checkpoint_score_attribute': 'training_iteration'             │ │
│ │                           }                                                                  │ │
│ │         checkpoint_freq = 1                                                                  │ │
│ │   checkpoint_score_attr = 'training_iteration'                                               │ │
│ │             config_file = '/tmp/tmpv4q1n2un.yaml'                                            │ │
│ │                     env = <typer.models.OptionInfo object at 0x7fa3ecf13ac0>                 │ │
│ │                exp_name = 'cartpole-ppo'                                                     │ │
│ │              experiment = {                                                                  │ │
│ │                           │   'run': 'PPO',                                                  │ │
│ │                           │   'stop': {                                                      │ │
│ │                           │   │   'sampler_results/episode_reward_mean': 150,                │ │
│ │                           │   │   'timesteps_total': 100000                                  │ │
│ │                           │   },                                                             │ │
│ │                           │   'config': {                                                    │ │
│ │                           │   │   'framework': 'tf2',                                        │ │
│ │                           │   │   'gamma': 0.99,                                             │ │
│ │                           │   │   'lr': 0.0003,                                              │ │
│ │                           │   │   'num_workers': 1,                                          │ │
│ │                           │   │   'num_sgd_iter': 6,                                         │ │
│ │                           │   │   'vf_loss_coeff': 0.01,                                     │ │
│ │                           │   │   'model': {                                                 │ │
│ │                           │   │   │   'fcnet_hiddens': [32],                                 │ │
│ │                           │   │   │   'fcnet_activation': 'linear',                          │ │
│ │                           │   │   │   'vf_share_layers': True                                │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'log_level': 'INFO',                                       │ │
│ │                           │   │   'env': <typer.models.OptionInfo object at 0x7fa3ecf13ac0>  │ │
│ │                           │   },                                                             │ │
│ │                           │   'checkpoint_config':                                           │ │
│ │                           CheckpointConfig(checkpoint_score_attribute='training_iteration',  │ │
│ │                           checkpoint_frequency=1, checkpoint_at_end=True)                    │ │
│ │                           }                                                                  │ │
│ │             experiments = {                                                                  │ │
│ │                           │   'cartpole-ppo': {                                              │ │
│ │                           │   │   'run': 'PPO',                                              │ │
│ │                           │   │   'stop': {                                                  │ │
│ │                           │   │   │   'sampler_results/episode_reward_mean': 150,            │ │
│ │                           │   │   │   'timesteps_total': 100000                              │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'config': {                                                │ │
│ │                           │   │   │   'framework': 'tf2',                                    │ │
│ │                           │   │   │   'gamma': 0.99,                                         │ │
│ │                           │   │   │   'lr': 0.0003,                                          │ │
│ │                           │   │   │   'num_workers': 1,                                      │ │
│ │                           │   │   │   'num_sgd_iter': 6,                                     │ │
│ │                           │   │   │   'vf_loss_coeff': 0.01,                                 │ │
│ │                           │   │   │   'model': {                                             │ │
│ │                           │   │   │   │   'fcnet_hiddens': [32],                             │ │
│ │                           │   │   │   │   'fcnet_activation': 'linear',                      │ │
│ │                           │   │   │   │   'vf_share_layers': True                            │ │
│ │                           │   │   │   },                                                     │ │
│ │                           │   │   │   'log_level': 'INFO',                                   │ │
│ │                           │   │   │   'env': <typer.models.OptionInfo object at              │ │
│ │                           0x7fa3ecf13ac0>                                                    │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'checkpoint_config':                                       │ │
│ │                           CheckpointConfig(checkpoint_score_attribute='training_iteration',  │ │
│ │                           checkpoint_frequency=1, checkpoint_at_end=True)                    │ │
│ │                           │   }                                                              │ │
│ │                           }                                                                  │ │
│ │               file_type = <SupportedFileType.yaml: 'yaml'>                                   │ │
│ │               framework = 'tf2'                                                              │ │
│ │    keep_checkpoints_num = None                                                               │ │
│ │              local_mode = False                                                              │ │
│ │                 project = <typer.models.OptionInfo object at 0x7fa3ecf4c100>                 │ │
│ │             ray_address = None                                                               │ │
│ │            ray_num_cpus = None                                                               │ │
│ │            ray_num_gpus = None                                                               │ │
│ │           ray_num_nodes = None                                                               │ │
│ │ ray_object_store_memory = None                                                               │ │
│ │                  ray_ui = False                                                              │ │
│ │                  resume = False                                                              │ │
│ │               scheduler = 'FIFO'                                                             │ │
│ │        scheduler_config = '{}'                                                               │ │
│ │                    stop = None                                                               │ │
│ │               temp_file = None                                                               │ │
│ │                   trace = False                                                              │ │
│ │                       v = True                                                               │ │
│ │                      vv = False                                                              │ │
│ │               wandb_key = <typer.models.OptionInfo object at 0x7fa3ecf4c0d0>                 │ │
│ │           wandb_project = <typer.models.OptionInfo object at 0x7fa3ecf4c100>                 │ │
│ │          wandb_run_name = <typer.models.OptionInfo object at 0x7fa3ecf4c130>                 │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ rllib/train.py:421 in run_rllib_experiments                                                      │
│                                                                                                  │
│   418 │                                                                                          │
│   419 │   # Run the Tune experiment and return the trials.                                       │
│   420 │   scheduler_config = json.loads(scheduler_config)                                        │
│ ❱ 421 │   trials = run_experiments(                                                              │
│   422 │   │   experiments,                                                                       │
│   423 │   │   scheduler=create_scheduler(scheduler, **scheduler_config),                         │
│   424 │   │   resume=resume,                                                                     │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                    algo = 'PPO'                                                              │ │
│ │               callbacks = [                                                                  │ │
│ │                           │   <ray.air.integrations.wandb.WandbLoggerCallback object at      │ │
│ │                           0x7fa3ecf4dcc0>,                                                   │ │
│ │                           │   <ray.tune.experimental.output.TuneTerminalReporter object at   │ │
│ │                           0x7fa4cf6be230>,                                                   │ │
│ │                           │   <ray.tune.logger.csv.CSVLoggerCallback object at               │ │
│ │                           0x7fa4cf6be2c0>,                                                   │ │
│ │                           │   <ray.tune.logger.json.JsonLoggerCallback object at             │ │
│ │                           0x7fa4cf6bef20>,                                                   │ │
│ │                           │   <ray.tune.logger.tensorboardx.TBXLoggerCallback object at      │ │
│ │                           0x7fa4cf6bf190>                                                    │ │
│ │                           ]                                                                  │ │
│ │                     exp = {                                                                  │ │
│ │                           │   'run': 'PPO',                                                  │ │
│ │                           │   'stop': {                                                      │ │
│ │                           │   │   'sampler_results/episode_reward_mean': 150,                │ │
│ │                           │   │   'timesteps_total': 100000                                  │ │
│ │                           │   },                                                             │ │
│ │                           │   'config': {                                                    │ │
│ │                           │   │   'framework': 'tf2',                                        │ │
│ │                           │   │   'gamma': 0.99,                                             │ │
│ │                           │   │   'lr': 0.0003,                                              │ │
│ │                           │   │   'num_workers': 1,                                          │ │
│ │                           │   │   'num_sgd_iter': 6,                                         │ │
│ │                           │   │   'vf_loss_coeff': 0.01,                                     │ │
│ │                           │   │   'model': {                                                 │ │
│ │                           │   │   │   'fcnet_hiddens': [32],                                 │ │
│ │                           │   │   │   'fcnet_activation': 'linear',                          │ │
│ │                           │   │   │   'vf_share_layers': True                                │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'log_level': 'INFO',                                       │ │
│ │                           │   │   'env': <typer.models.OptionInfo object at 0x7fa3ecf13ac0>  │ │
│ │                           │   },                                                             │ │
│ │                           │   'checkpoint_config':                                           │ │
│ │                           CheckpointConfig(checkpoint_score_attribute='training_iteration',  │ │
│ │                           checkpoint_frequency=1, checkpoint_at_end=True)                    │ │
│ │                           }                                                                  │ │
│ │             experiments = {                                                                  │ │
│ │                           │   'cartpole-ppo': {                                              │ │
│ │                           │   │   'run': 'PPO',                                              │ │
│ │                           │   │   'stop': {                                                  │ │
│ │                           │   │   │   'sampler_results/episode_reward_mean': 150,            │ │
│ │                           │   │   │   'timesteps_total': 100000                              │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'config': {                                                │ │
│ │                           │   │   │   'framework': 'tf2',                                    │ │
│ │                           │   │   │   'gamma': 0.99,                                         │ │
│ │                           │   │   │   'lr': 0.0003,                                          │ │
│ │                           │   │   │   'num_workers': 1,                                      │ │
│ │                           │   │   │   'num_sgd_iter': 6,                                     │ │
│ │                           │   │   │   'vf_loss_coeff': 0.01,                                 │ │
│ │                           │   │   │   'model': {                                             │ │
│ │                           │   │   │   │   'fcnet_hiddens': [32],                             │ │
│ │                           │   │   │   │   'fcnet_activation': 'linear',                      │ │
│ │                           │   │   │   │   'vf_share_layers': True                            │ │
│ │                           │   │   │   },                                                     │ │
│ │                           │   │   │   'log_level': 'INFO',                                   │ │
│ │                           │   │   │   'env': <typer.models.OptionInfo object at              │ │
│ │                           0x7fa3ecf13ac0>                                                    │ │
│ │                           │   │   },                                                         │ │
│ │                           │   │   'checkpoint_config':                                       │ │
│ │                           CheckpointConfig(checkpoint_score_attribute='training_iteration',  │ │
│ │                           checkpoint_frequency=1, checkpoint_at_end=True)                    │ │
│ │                           │   }                                                              │ │
│ │                           }                                                                  │ │
│ │               framework = 'tf2'                                                              │ │
│ │                  input_ = None                                                               │ │
│ │              local_mode = False                                                              │ │
│ │             ray_address = None                                                               │ │
│ │            ray_num_cpus = None                                                               │ │
│ │            ray_num_gpus = None                                                               │ │
│ │           ray_num_nodes = None                                                               │ │
│ │ ray_object_store_memory = None                                                               │ │
│ │                  ray_ui = False                                                              │ │
│ │                  resume = False                                                              │ │
│ │               scheduler = 'FIFO'                                                             │ │
│ │        scheduler_config = {}                                                                 │ │
│ │                   trace = False                                                              │ │
│ │                       v = True                                                               │ │
│ │                 verbose = 3                                                                  │ │
│ │                      vv = False                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ tune/tune.py:1150 in run_experiments                                                             │
│                                                                                                  │
│   1147 │   experiments = _convert_to_experiment_list(experiments)                                │
│   1148 │                                                                                         │
│   1149 │   if concurrent:                                                                        │
│ ❱ 1150 │   │   return run(                                                                       │
│   1151 │   │   │   experiments,                                                                  │
│   1152 │   │   │   server_port=server_port,                                                      │
│   1153 │   │   │   verbose=verbose,                                                              │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │               _remote = False                                                                │ │
│ │             callbacks = [                                                                    │ │
│ │                         │   <ray.air.integrations.wandb.WandbLoggerCallback object at        │ │
│ │                         0x7fa3ecf4dcc0>,                                                     │ │
│ │                         │   <ray.tune.experimental.output.TuneTerminalReporter object at     │ │
│ │                         0x7fa4cf6be230>,                                                     │ │
│ │                         │   <ray.tune.logger.csv.CSVLoggerCallback object at                 │ │
│ │                         0x7fa4cf6be2c0>,                                                     │ │
│ │                         │   <ray.tune.logger.json.JsonLoggerCallback object at               │ │
│ │                         0x7fa4cf6bef20>,                                                     │ │
│ │                         │   <ray.tune.logger.tensorboardx.TBXLoggerCallback object at        │ │
│ │                         0x7fa4cf6bf190>                                                      │ │
│ │                         ]                                                                    │ │
│ │            concurrent = True                                                                 │ │
│ │           experiments = [                                                                    │ │
│ │                         │   <ray.tune.experiment.experiment.Experiment object at             │ │
│ │                         0x7fa4d6f833d0>                                                      │ │
│ │                         ]                                                                    │ │
│ │     progress_reporter = None                                                                 │ │
│ │ raise_on_failed_trial = True                                                                 │ │
│ │                resume = False                                                                │ │
│ │          reuse_actors = None                                                                 │ │
│ │             scheduler = <ray.tune.schedulers.trial_scheduler.FIFOScheduler object at         │ │
│ │                         0x7fa3ecf4df30>                                                      │ │
│ │           server_port = None                                                                 │ │
│ │               verbose = 3                                                                    │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ tune/tune.py:962 in run                                                                          │
│                                                                                                  │
│    959 │   │   │   runner.update_pending_trial_resources(resources_per_trial)                    │
│    960 │                                                                                         │
│    961 │   # Calls setup on callbacks                                                            │
│ ❱  962 │   runner.setup_experiments(                                                             │
│    963 │   │   experiments=experiments, total_num_samples=search_alg.total_samples               │
│    964 │   )                                                                                     │
│    965                                                                                           │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                  _entrypoint = <AirEntrypoint.TUNE_RUN_EXPERIMENTS: 'tune.run_experiments'>  │ │
│ │   _experiment_checkpoint_dir = None                                                          │ │
│ │                      _remote = False                                                         │ │
│ │         _remote_string_queue = None                                                          │ │
│ │                air_verbosity = 2                                                             │ │
│ │                    all_start = 1699808946.5988293                                            │ │
│ │                    callbacks = [                                                             │ │
│ │                                │   <ray.air.integrations.wandb.WandbLoggerCallback object at │ │
│ │                                0x7fa3ecf4dcc0>,                                              │ │
│ │                                │   <ray.tune.experimental.output.TuneTerminalReporter object │ │
│ │                                at 0x7fa4cf6be230>,                                           │ │
│ │                                │   <ray.tune.logger.csv.CSVLoggerCallback object at          │ │
│ │                                0x7fa4cf6be2c0>,                                              │ │
│ │                                │   <ray.tune.logger.json.JsonLoggerCallback object at        │ │
│ │                                0x7fa4cf6bef20>,                                              │ │
│ │                                │   <ray.tune.logger.tensorboardx.TBXLoggerCallback object at │ │
│ │                                0x7fa4cf6bf190>                                               │ │
│ │                                ]                                                             │ │
│ │           chdir_to_trial_dir = 'DEPRECATED'                                                  │ │
│ │            checkpoint_at_end = False                                                         │ │
│ │            checkpoint_config = CheckpointConfig()                                            │ │
│ │              checkpoint_freq = 0                                                             │ │
│ │        checkpoint_score_attr = None                                                          │ │
│ │                       config = {}                                                            │ │
│ │            error_message_map = {                                                             │ │
│ │                                │   'entrypoint': 'tune.run_experiments(...)',                │ │
│ │                                │   'search_space_arg': 'experiment=Experiment(config)',      │ │
│ │                                │   'restore_entrypoint': 'tune.run_experiments(...,          │ │
│ │                                resume=True)'                                                 │ │
│ │                                }                                                             │ │
│ │                          exp = <ray.tune.experiment.experiment.Experiment object at          │ │
│ │                                0x7fa4d6f833d0>                                               │ │
│ │ experiment_interrupted_event = <threading.Event object at 0x7fa4cf6bf100>                    │ │
│ │                  experiments = [                                                             │ │
│ │                                │   <ray.tune.experiment.experiment.Experiment object at      │ │
│ │                                0x7fa4d6f833d0>                                               │ │
│ │                                ]                                                             │ │
│ │               export_formats = None                                                          │ │
│ │                    fail_fast = False                                                         │ │
│ │                            i = 0                                                             │ │
│ │                is_local_mode = False                                                         │ │
│ │         keep_checkpoints_num = None                                                          │ │
│ │                    local_dir = None                                                          │ │
│ │                  log_to_file = False                                                         │ │
│ │        max_concurrent_trials = None                                                          │ │
│ │                 max_failures = 0                                                             │ │
│ │                       metric = None                                                          │ │
│ │                         mode = None                                                          │ │
│ │                         name = None                                                          │ │
│ │                  num_samples = 1                                                             │ │
│ │        placeholder_resolvers = defaultdict(<class 'list'>, {})                               │ │
│ │             progress_metrics = None                                                          │ │
│ │            progress_reporter = None                                                          │ │
│ │        raise_on_failed_trial = True                                                          │ │
│ │          resources_per_trial = None                                                          │ │
│ │                      restore = None                                                          │ │
│ │                       resume = False                                                         │ │
│ │                 reuse_actors = False                                                         │ │
│ │            run_or_experiment = [                                                             │ │
│ │                                │   <ray.tune.experiment.experiment.Experiment object at      │ │
│ │                                0x7fa4d6f833d0>                                               │ │
│ │                                ]                                                             │ │
│ │                       runner = <ray.tune.execution.tune_controller.TuneController object at  │ │
│ │                                0x7fa4cf6bf1f0>                                               │ │
│ │                runner_kwargs = {                                                             │ │
│ │                                │   'search_alg':                                             │ │
│ │                                <ray.tune.search.basic_variant.BasicVariantGenerator object   │ │
│ │                                at 0x7fa4cf6be260>,                                           │ │
│ │                                │   'placeholder_resolvers': defaultdict(<class 'list'>, {}), │ │
│ │                                │   'scheduler':                                              │ │
│ │                                <ray.tune.schedulers.trial_scheduler.FIFOScheduler object at  │ │
│ │                                0x7fa3ecf4df30>,                                              │ │
│ │                                │   'stopper': None,                                          │ │
│ │                                │   'resume': False,                                          │ │
│ │                                │   'server_port': None,                                      │ │
│ │                                │   'fail_fast': False,                                       │ │
│ │                                │   'callbacks': [                                            │ │
│ │                                │   │   <ray.air.integrations.wandb.WandbLoggerCallback       │ │
│ │                                object at 0x7fa3ecf4dcc0>,                                    │ │
│ │                                │   │   <ray.tune.experimental.output.TuneTerminalReporter    │ │
│ │                                object at 0x7fa4cf6be230>,                                    │ │
│ │                                │   │   <ray.tune.logger.csv.CSVLoggerCallback object at      │ │
│ │                                0x7fa4cf6be2c0>,                                              │ │
│ │                                │   │   <ray.tune.logger.json.JsonLoggerCallback object at    │ │
│ │                                0x7fa4cf6bef20>,                                              │ │
│ │                                │   │   <ray.tune.logger.tensorboardx.TBXLoggerCallback       │ │
│ │                                object at 0x7fa4cf6bf190>                                     │ │
│ │                                │   ],                                                        │ │
│ │                                │   'metric': None,                                           │ │
│ │                                │   'trial_checkpoint_config':                                │ │
│ │                                CheckpointConfig(checkpoint_score_attribute='training_iterat… │ │
│ │                                checkpoint_frequency=1, checkpoint_at_end=True),              │ │
│ │                                │   ... +3                                                    │ │
│ │                                }                                                             │ │
│ │                    scheduler = <ray.tune.schedulers.trial_scheduler.FIFOScheduler object at  │ │
│ │                                0x7fa3ecf4df30>                                               │ │
│ │                   search_alg = <ray.tune.search.basic_variant.BasicVariantGenerator object   │ │
│ │                                at 0x7fa4cf6be260>                                            │ │
│ │                  server_port = None                                                          │ │
│ │                         stop = None                                                          │ │
│ │           storage_filesystem = None                                                          │ │
│ │                 storage_path = None                                                          │ │
│ │                  sync_config = SyncConfig(                                                   │ │
│ │                                │   sync_period=300,                                          │ │
│ │                                │   sync_timeout=1800,                                        │ │
│ │                                │   sync_artifacts=False,                                     │ │
│ │                                │   sync_artifacts_on_checkpoint=True,                        │ │
│ │                                │   upload_dir='DEPRECATED',                                  │ │
│ │                                │   syncer='DEPRECATED',                                      │ │
│ │                                │   sync_on_checkpoint='DEPRECATED'                           │ │
│ │                                )                                                             │ │
│ │                time_budget_s = None                                                          │ │
│ │                    trainable = [                                                             │ │
│ │                                │   <ray.tune.experiment.experiment.Experiment object at      │ │
│ │                                0x7fa4d6f833d0>                                               │ │
│ │                                ]                                                             │ │
│ │        trial_dirname_creator = None                                                          │ │
│ │           trial_name_creator = None                                                          │ │
│ │                      verbose = 3                                                             │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ tune/execution/tune_controller.py:308 in setup_experiments                                       │
│                                                                                                  │
│    305 │   │   experiment = experiments[0]                                                       │
│    306 │   │   spec = experiment.public_spec if experiment else {}                               │
│    307 │   │   spec["total_num_samples"] = total_num_samples                                     │
│ ❱  308 │   │   self._callbacks.setup(**spec)                                                     │
│    309 │                                                                                         │
│    310 │   def end_experiment_callbacks(self) -> None:                                           │
│    311 │   │   """Calls ``on_experiment_end`` method in callbacks."""                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │        experiment = <ray.tune.experiment.experiment.Experiment object at 0x7fa4d6f833d0>     │ │
│ │       experiments = [<ray.tune.experiment.experiment.Experiment object at 0x7fa4d6f833d0>]   │ │
│ │              self = <ray.tune.execution.tune_controller.TuneController object at             │ │
│ │                     0x7fa4cf6bf1f0>                                                          │ │
│ │              spec = {                                                                        │ │
│ │                     │   'stop': {                                                            │ │
│ │                     │   │   'sampler_results/episode_reward_mean': 150,                      │ │
│ │                     │   │   'timesteps_total': 100000                                        │ │
│ │                     │   },                                                                   │ │
│ │                     │   'time_budget_s': None,                                               │ │
│ │                     │   'num_samples': 1,                                                    │ │
│ │                     │   'total_num_samples': 1                                               │ │
│ │                     }                                                                        │ │
│ │ total_num_samples = 1                                                                        │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ tune/callback.py:388 in setup                                                                    │
│                                                                                                  │
│   385 │   │   │   │   │   )                                                                      │
│   386 │   │   │   │   │   callback.setup()                                                       │
│   387 │   │   │   │   else:                                                                      │
│ ❱ 388 │   │   │   │   │   raise e                                                                │
│   389 │                                                                                          │
│   390 │   def on_step_begin(self, **info):                                                       │
│   391 │   │   for callback in self._callbacks:                                                   │
│                                                                                                  │
│ ╭─────────────────────────────────────── locals ───────────────────────────────────────╮         │
│ │ callback = <ray.air.integrations.wandb.WandbLoggerCallback object at 0x7fa3ecf4dcc0> │         │
│ │     info = {                                                                         │         │
│ │            │   'stop': {                                                             │         │
│ │            │   │   'sampler_results/episode_reward_mean': 150,                       │         │
│ │            │   │   'timesteps_total': 100000                                         │         │
│ │            │   },                                                                    │         │
│ │            │   'time_budget_s': None,                                                │         │
│ │            │   'num_samples': 1,                                                     │         │
│ │            │   'total_num_samples': 1                                                │         │
│ │            }                                                                         │         │
│ │     self = <ray.tune.callback.CallbackList object at 0x7fa4cf707e50>                 │         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────╯         │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ tune/callback.py:377 in setup                                                                    │
│                                                                                                  │
│   374 │   def setup(self, **info):                                                               │
│   375 │   │   for callback in self._callbacks:                                                   │
│   376 │   │   │   try:                                                                           │
│ ❱ 377 │   │   │   │   callback.setup(**info)                                                     │
│   378 │   │   │   except TypeError as e:                                                         │
│   379 │   │   │   │   if "argument" in str(e):                                                   │
│   380 │   │   │   │   │   warnings.warn(                                                         │
│                                                                                                  │
│ ╭─────────────────────────────────────── locals ───────────────────────────────────────╮         │
│ │ callback = <ray.air.integrations.wandb.WandbLoggerCallback object at 0x7fa3ecf4dcc0> │         │
│ │     info = {                                                                         │         │
│ │            │   'stop': {                                                             │         │
│ │            │   │   'sampler_results/episode_reward_mean': 150,                       │         │
│ │            │   │   'timesteps_total': 100000                                         │         │
│ │            │   },                                                                    │         │
│ │            │   'time_budget_s': None,                                                │         │
│ │            │   'num_samples': 1,                                                     │         │
│ │            │   'total_num_samples': 1                                                │         │
│ │            }                                                                         │         │
│ │     self = <ray.tune.callback.CallbackList object at 0x7fa4cf707e50>                 │         │
│ ╰──────────────────────────────────────────────────────────────────────────────────────╯         │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ air/integrations/wandb.py:574 in setup                                                           │
│                                                                                                  │
│   571 │   │   self.api_key_file = (                                                              │
│   572 │   │   │   os.path.expanduser(self.api_key_path) if self.api_key_path else None           │
│   573 │   │   )                                                                                  │
│ ❱ 574 │   │   _set_api_key(self.api_key_file, self.api_key)                                      │
│   575 │   │                                                                                      │
│   576 │   │   self.project = _get_wandb_project(self.project)                                    │
│   577 │   │   if not self.project:                                                               │
│                                                                                                  │
│ ╭────────────────────────────────────── locals ──────────────────────────────────────╮           │
│ │   args = ()                                                                        │           │
│ │ kwargs = {                                                                         │           │
│ │          │   'stop': {                                                             │           │
│ │          │   │   'sampler_results/episode_reward_mean': 150,                       │           │
│ │          │   │   'timesteps_total': 100000                                         │           │
│ │          │   },                                                                    │           │
│ │          │   'time_budget_s': None,                                                │           │
│ │          │   'num_samples': 1,                                                     │           │
│ │          │   'total_num_samples': 1                                                │           │
│ │          }                                                                         │           │
│ │   self = <ray.air.integrations.wandb.WandbLoggerCallback object at 0x7fa3ecf4dcc0> │           │
│ ╰────────────────────────────────────────────────────────────────────────────────────╯           │
│                                                                                                  │
│ /home/yz/.cache/pypoetry/virtualenvs/learn-ray-JyhaRFPZ-py3.10/lib/python3.10/site-packages/ray/ │
│ air/integrations/wandb.py:321 in _set_api_key                                                    │
│                                                                                                  │
│   318 │   │   │   │   │   exc_info=e,                                                            │
│   319 │   │   │   │   )                                                                          │
│   320 │   if api_key:                                                                            │
│ ❱ 321 │   │   os.environ[WANDB_ENV_VAR] = api_key                                                │
│   322 │   elif not os.environ.get(WANDB_ENV_VAR):                                                │
│   323 │   │   raise ValueError(                                                                  │
│   324 │   │   │   "No WandB API key found. Either set the {} environment "                       │
│                                                                                                  │
│ ╭───────────────────────────── locals ──────────────────────────────╮                            │
│ │      api_key = <typer.models.OptionInfo object at 0x7fa3ecf4c0d0> │                            │
│ │ api_key_file = None                                               │                            │
│ ╰───────────────────────────────────────────────────────────────────╯                            │
│                                                                                                  │
│ /usr/lib/python3.10/os.py:685 in __setitem__                                                     │
│                                                                                                  │
│    682 │                                                                                         │
│    683 │   def __setitem__(self, key, value):                                                    │
│    684 │   │   key = self.encodekey(key)                                                         │
│ ❱  685 │   │   value = self.encodevalue(value)                                                   │
│    686 │   │   putenv(key, value)                                                                │
│    687 │   │   self._data[key] = value                                                           │
│    688                                                                                           │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │   key = b'WANDB_API_KEY'                                                                     │ │
│ │  self = environ({                                                                            │ │
│ │         │   'DESKTOP_SESSION': 'pop',                                                        │ │
│ │         │   'GIO_LAUNCHED_DESKTOP_FILE': '/usr/share/applications/code.desktop',             │ │
│ │         │   'GTK_MODULES': 'gail:atk-bridge',                                                │ │
│ │         │   'GNOME_SHELL_SESSION_MODE': 'pop',                                               │ │
│ │         │   'LC_MONETARY': 'de_CH.UTF-8',                                                    │ │
│ │         │   'SYSTEMD_EXEC_PID': '1306',                                                      │ │
│ │         │   'DBUS_SESSION_BUS_ADDRESS': 'unix:path=/run/user/1000/bus',                      │ │
│ │         │   'GDMSESSION': 'pop',                                                             │ │
│ │         │   'VSCODE_GIT_ASKPASS_MAIN':                                                       │ │
│ │         '/usr/share/code/resources/app/extensions/git/dist/askpass-main.js',                 │ │
│ │         │   'TERM': 'xterm-256color',                                                        │ │
│ │         │   ... +68                                                                          │ │
│ │         })                                                                                   │ │
│ │ value = <typer.models.OptionInfo object at 0x7fa3ecf4c0d0>                                   │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /usr/lib/python3.10/os.py:757 in encode                                                          │
│                                                                                                  │
│    754 │   │   encoding = sys.getfilesystemencoding()                                            │
│    755 │   │   def encode(value):                                                                │
│    756 │   │   │   if not isinstance(value, str):                                                │
│ ❱  757 │   │   │   │   raise TypeError("str expected, not %s" % type(value).__name__)            │
│    758 │   │   │   return value.encode(encoding, 'surrogateescape')                              │
│    759 │   │   def decode(value):                                                                │
│    760 │   │   │   return value.decode(encoding, 'surrogateescape')                              │
│                                                                                                  │
│ ╭─────────────────────────── locals ────────────────────────────╮                                │
│ │ encoding = 'utf-8'                                            │                                │
│ │    value = <typer.models.OptionInfo object at 0x7fa3ecf4c0d0> │                                │
│ ╰───────────────────────────────────────────────────────────────╯                                │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: str expected, not OptionInfo

Versions / Dependencies

Using PopOS 22.04, poetry minimal repro deps

python = "^3.10"
ray = {extras = ["rllib"], version = "^2.8.0"}
torch = "2.0.0"

Reproduction script

poetry add ray[rllib] torch==2.0.0
poetry run rllib example run cartpole-ppo

Issue Severity

None

niels-phare commented 7 months ago

I just ran into this as well by following the Learning Ray book.