[Rllib] Torch Backwards Compatibility (#16813)

This commit is contained in:
Amog Kamsetty 2021-07-01 19:17:54 -07:00 committed by GitHub
parent 521a05834d
commit 33f31f53c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -516,8 +516,13 @@ class RolloutWorker(ParallelIteratorWorker):
torch.version.cuda) >= 10.2:
os.environ["CUBLAS_WORKSPACE_CONFIG"] = "4096:8"
else:
# Not all Operations support this.
torch.use_deterministic_algorithms(True)
from distutils.version import LooseVersion
if LooseVersion(
torch.__version__) >= LooseVersion("1.8.0"):
# Not all Operations support this.
torch.use_deterministic_algorithms(True)
else:
torch.set_determinstic(True)
# This is only for Convolution no problem.
torch.backends.cudnn.deterministic = True
# Tf2.x.