DLR-RM / DLR-RM/stable-baselines3
[Bug]: ReplayBuffer cannot detect the real memory constraints in Kubernetes.
- Dominant language
- Python
- Stars
- 13.8k
- Forks
- 2.2k
- Avg merge
- 1h 35m
- Merged PRs (30d)
- 2
Description
### 🐛 Bug
In stable_baselines3/common/buffers.py, around line 200, it uses psutil to determine available memories, which fails to detect the actually available memory.
```py
# in the `__init__` of `ReplayBuffer`
if psutil is not None:
mem_available = psutil.virtual_memory().available
```
My server has over 700G memory but only 64 G available in my k8s container. I ran a training script, which is estimated to require 30 G memory. As a consequence, it is terminated silently. If warned earlier by StableBaslines3, other users may be spared of this potential problem.
### To Reproduce
_No response_
### Relevant log output / Error message
```shell
```
### System Info
_No response_
### Checklist
- [x] My issue does not relate to a custom gym environment. (Use the custom gym env template instead)
- [x] I have checked that there is no similar [issue](https://github.com/DLR-RM/stable-baselines3/issues) in the repo
- [x] I have read the [documentation](https://stable-baselines3.readthedocs.io/en/master/)
- [x] I have provided a [minimal and working](https://github.com/DLR-RM/stable-baselines3/issues/982#issuecomment-1197044014) example to reproduce the bug
- [x] I've used the [markdown code blocks](https://help.github.com/en/articles/creating-and-highlighting-code-blocks) for both code and stack traces.
Contributor guide
Assessment
This issue has not been assessed yet.