mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-11-18 09:54:10 +00:00
Fix reward of SimpleMultiObsEnv to always be float (#1676)
* Fix reward of SimpleMultiObsEnv to always be float Previously the reward was sometimes returned as an int. * changelog * Update changelog.rst * Update version.txt * Fix type annotation * Fix import --------- Co-authored-by: Quentin Gallouédec <45557362+qgallouedec@users.noreply.github.com> Co-authored-by: Antonin Raffin <antonin.raffin@ensta.org>
This commit is contained in:
parent
99712760c8
commit
1cd6ae42d5
4 changed files with 6 additions and 5 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
Changelog
|
Changelog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
Release 2.2.0a2 (WIP)
|
Release 2.2.0a3 (WIP)
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
@ -32,6 +32,7 @@ Bug Fixes:
|
||||||
- Calls ``callback.update_locals()`` before ``callback.on_rollout_end()`` in OnPolicyAlgorithm (@PatrickHelm)
|
- Calls ``callback.update_locals()`` before ``callback.on_rollout_end()`` in OnPolicyAlgorithm (@PatrickHelm)
|
||||||
- Fixed replay buffer device after loading in OffPolicyAlgorithm (@PatrickHelm)
|
- Fixed replay buffer device after loading in OffPolicyAlgorithm (@PatrickHelm)
|
||||||
- Fixed ``render_mode`` which was not properly loaded when using ``VecNormalize.load()``
|
- Fixed ``render_mode`` which was not properly loaded when using ``VecNormalize.load()``
|
||||||
|
- Fixed success reward dtype in ``SimpleMultiObsEnv`` (@NixGD)
|
||||||
|
|
||||||
|
|
||||||
Deprecations:
|
Deprecations:
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ class SimpleMultiObsEnv(gym.Env):
|
||||||
self.state -= self.num_col
|
self.state -= self.num_col
|
||||||
|
|
||||||
got_to_end = self.state == self.max_state
|
got_to_end = self.state == self.max_state
|
||||||
reward = 1 if got_to_end else reward
|
reward = 1.0 if got_to_end else reward
|
||||||
truncated = self.count > self.max_count
|
truncated = self.count > self.max_count
|
||||||
terminated = got_to_end
|
terminated = got_to_end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ from collections import defaultdict
|
||||||
from io import TextIOBase
|
from io import TextIOBase
|
||||||
from typing import Any, Dict, List, Mapping, Optional, Sequence, TextIO, Tuple, Union
|
from typing import Any, Dict, List, Mapping, Optional, Sequence, TextIO, Tuple, Union
|
||||||
|
|
||||||
|
import matplotlib.figure
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas
|
import pandas
|
||||||
import torch as th
|
import torch as th
|
||||||
from matplotlib import pyplot as plt
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from torch.utils.tensorboard import SummaryWriter
|
from torch.utils.tensorboard import SummaryWriter
|
||||||
|
|
@ -52,7 +52,7 @@ class Figure:
|
||||||
:param close: if true, close the figure after logging it
|
:param close: if true, close the figure after logging it
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, figure: plt.figure, close: bool):
|
def __init__(self, figure: matplotlib.figure.Figure, close: bool):
|
||||||
self.figure = figure
|
self.figure = figure
|
||||||
self.close = close
|
self.close = close
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
2.2.0a2
|
2.2.0a3
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue