vwxyzjn / cleanrl

High-quality single file implementation of Deep Reinforcement Learning algorithms with research-friendly features (PPO, DQN, C51, DDPG, TD3, SAC, PPG)
http://docs.cleanrl.dev
Other
5.26k stars 602 forks source link

Type hints #293

Open timoklein opened 1 year ago

timoklein commented 1 year ago

Description

As discussed on Discord, I've done basic type hints for PPO and DQN. Everything checks out with mypy 0.982 (mypy cleanrl/ppo.py --show-error-codes --ignore-missing-imports). Of course we can have a discussion about whether that's the checker that will be used if we go further down the road of implementing this. I'll put comments in noteworthy places.

The tests fail because tuple[int] or list[int] only works from Python 3.9 on.

Types of changes

Checklist:

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cleanrl ✅ Ready (Inspect) Visit Preview Oct 14, 2022 at 7:25AM (UTC)