From 9f265af306ba20ea401ed693917829b761b78d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Serrano=20Mu=C3=B1oz?= Date: Thu, 20 Jun 2024 22:07:05 -0400 Subject: [PATCH] Fix torch deprecated warning --- skrl/resources/schedulers/torch/kl_adaptive.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skrl/resources/schedulers/torch/kl_adaptive.py b/skrl/resources/schedulers/torch/kl_adaptive.py index 0c97f50f..0a32eed3 100644 --- a/skrl/resources/schedulers/torch/kl_adaptive.py +++ b/skrl/resources/schedulers/torch/kl_adaptive.py @@ -1,5 +1,7 @@ from typing import Optional, Union +from packaging import version + import torch from torch.optim.lr_scheduler import _LRScheduler @@ -50,6 +52,8 @@ def __init__(self, :param verbose: Verbose mode (default: ``False``) :type verbose: bool, optional """ + if version.parse(torch.__version__) >= version.parse("2.2"): + verbose = "deprecated" super().__init__(optimizer, last_epoch, verbose) self.kl_threshold = kl_threshold