HumanCompatibleAI / evaluating-rewards

Library to compare and evaluate reward functions
https://arxiv.org/abs/2006.13900
Apache License 2.0
61 stars 7 forks source link

Could not find a version that satisfies the requirement tensorflow<1.16,>=1.15 #39

Open nbro opened 4 years ago

nbro commented 4 years ago

This problem may not be related to this specific package, but it can happen if you install this package, so I am opening the issue here too.

When I try to install this package with pip (version 19.0.3 with Python 3.8), I get the error

Could not find a version that satisfies the requirement tensorflow<1.16,>=1.15 (from evaluating-rewards==0.1.1) (from versions: 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1) No matching distribution found for tensorflow<1.16,>=1.15 (from evaluating-rewards==0.1.1)

I am using a 64-bit version of Python on a Mac OS Catalina (10.15.7). Meanwhile, this problem seems to be temporarily solved by changing the specific version of TensorFlow that is installed in the requirement.txt file to tensorflow==2.3.0. However, I have not confirmed that this problem is solved because I was not yet able to run any code in this repo, given that we apparently also need mojuco as a requirement for this package, but mojuco requires a license, and that's quite annoying.

AdamGleave commented 4 years ago

You should be able to run most of the code without MuJoCo, you can just change gym[mujoco] to gym. Most the environments in the paper require MuJoCo though so you won't be able to replicate the results.

I doubt it'll work with TensorFlow 2 though, perhaps if you put it into v1 compatibility mode. Eventually I hope to port to TFv2 or PyTorch, but that's a big job and isn't a priority right now. Try Python 3.7 -- I think there are pip wheels for TensorFlow 1.15 for that.

nbro commented 4 years ago

@AdamGleave Porting the code to TensorFlow 2 should not take that much time, given there are already scripts that automate this process to some extent, so I think you should really do it (if you have some time). I will see what I can do meanwhile.

AdamGleave commented 4 years ago

@AdamGleave Porting the code to TensorFlow 2 should not take that much time, given there are already scripts that automate this process to some extent, so I think you should really do it (if you have some time). I will see what I can do meanwhile.

"Should" being the key word there.

One major complication is that the RL library we use, Stable Baselines, is TFv1 or PyTorch (but no TFv2).

I'd welcome a PR starting on a port, but I doubt I'll have the bandwidth to do this myself in the near future.

nbro commented 4 years ago

@AdamGleave Is it possible to use baselines (rather than stable-baselines)? baselines apparently supports TF 2 too (see here). If it's not too complicated to use baselines rather stable-baselines, this may be a viable alternative.

AdamGleave commented 4 years ago

@AdamGleave Is it possible to use baselines (rather than stable-baselines)? baselines apparently supports TF 2 too (see here). If it's not too complicated to use baselines rather stable-baselines, this may be a viable alternative.

I'm OK with switching to baselines for this project, it would be a fairly minor change to the code. However, I've not had the opportunity to test out their TF2 branch. So would need to do some benchmarking to verify it doesn't introduce any regressions for this project.

nbro commented 4 years ago

Indeed, it doesn't work with tensorflow==2.3.0. I get the error ModuleNotFoundError: No module named 'tensorflow.contrib' (when trying to execute python -m evaluating_rewards.analysis.dissimilarity_heatmaps.plot_epic_heatmap) because stable-baselines tries to import that.

Is it possible to know if you then plan to make this package use baselines (rather than stable-baselines)? I would like to know if I can wait a few days, weeks, or months for the changes, or if I need to try to do it myself (which would be quite painful, because I am still not familiar with neither baselines or stable-baselines)?

AdamGleave commented 4 years ago

I'm not planning on switching to baselines, sorry, but would merge a PR that made that change along with other ports to TensorFlow 2.

Right now my priority is on adding some new experiments, and the codebase works OK for me (Python 3.7, Linux, TensorFlow 1.15). I will want to eventually clean it up and make it as usable as possible for a broader audience, but I won't be prioritizing that until the features are frozen.

AdamGleave commented 4 years ago

A workaround you could try is to use the Docker image which should avoid these dependency issues.

araffin commented 4 years ago

Related: https://github.com/hill-a/stable-baselines/issues/1012#issuecomment-704534519

"If you (or others) want to support and maintain a TF2 version, we would be also happy about it. But I have to warn you that it is quite time consuming."