ray-project / ray

Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
https://ray.io
Apache License 2.0
34.27k stars 5.81k forks source link

[RLlib] ray 2.6 relies on tf.bool which does not exist in tensorflow 2.13 #37895

Open PhilippWillms opened 1 year ago

PhilippWillms commented 1 year ago

What happened + What you expected to happen

Upgrading to ray 2.6 in order to use the new features shows API conflict with tensorfow 2.13.

from ray.rllib.algorithms.ppo import PPOConfig ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib__init.py:10: in from ray.rllib.env.vector_env import VectorEnv ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\env__init__.py:7: in from ray.rllib.env.policy_server_input import PolicyServerInput ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\env\policy_server_input.py:16: in from ray.rllib.offline.input_reader import InputReader ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\offline\init.py:2: in from ray.rllib.offline.dataset_reader import DatasetReader, get_dataset_and_shards ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\offline\dataset_reader.py:12: in from ray.rllib.offline.json_reader import from_json_data, postprocess_actions ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\offline\json_reader.py:23: in from ray.rllib.policy.policy import Policy ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\policy\init__.py:1: in from ray.rllib.policy.policy import Policy ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\policy\policy.py:68: in from ray.rllib.utils.tensor_dtype import get_np_dtype ....\anaconda3\envs\wksimrl\lib\site-packages\ray\rllib\utils\tensordtype.py:32: in np.bool: tf.bool, E AttributeError: module 'tensorflow' has no attribute 'bool'

Versions / Dependencies

ray==2.6.1, tensorflow==2.13.0, tensorflow-intel==2.13.0, keras==2.13.1

Reproduction script

Run any example of PPO learning

Issue Severity

Medium: It is a significant difficulty but I can work around it.

ArturNiederfahrenhorst commented 1 year ago

Hi @PhilippWillms At the moment, we do not explicitly support tensorflow 2.13. Almost all workloads run on tensorflow 2.11 as can be seen in the requirements.txt files. We will resolve this conflict once we upgrade to 2.13.

Is there a specific reason that makes 2.13 attractive? Some feature?

PhilippWillms commented 10 months ago

@ArturNiederfahrenhorst : After some time focusing on my custom environment logic, I am coming back to this topic.

I want to highlight the "hidden" hard requirement to have tensorflow installed, even though torch would be available. This is today - version ray 2.9.1 - still the case for the Trainer API, e.g. in from ray.rllib.agents.ppo import PPOTrainer.

Back at the initial point of discussion, I thought the root cause of the error message would be related to the other tensorflow version.