Closed jak3122 closed 1 month ago
Hello,
why do you want to set net_arch=None
?
In my training script I have CLI args, including an optional net_arch
arg:
net_arch: Tuple[int, ...] | None = None
Which I then pass to the sb3 model:
model = PPO(
policy_type,
env,
policy_kwargs=dict(
net_arch=args.net_arch,
...
)
)
Since the documentation says that net_arch
can be None
, I would expect this to work, and have None
indicate the default net_arch
, which it does, except for loading the saved model.
I also realize it's possible to just omit net_arch
from policy_kwargs
instead, like this:
policy_kwargs = dict()
if args.net_arch is not None:
policy_kwargs["net_arch"] = args.net_arch
model = PPO(
policy_type,
env,
policy_kwargs=policy_kwargs
)
But then for anyone like me who happens to save a model with net_arch
manually set to None
, then the model will not load.
Since the documentation says that net_arch can be None, I would expect this to work, and have None indicate the default net_arch, which it does, except for loading the saved mode
I would be happy to receive a PR that solves this issue =)
Although in your case, I would indeed recommend not populating the net_arch
instead of passing None
.
š Bug
I've run into this issue a few times, since I use command line args in a wrapper script where I default
net_arch
toNone
, and I pass that topolicy_kwargs
.I was able to fix it locally by changing this line from
to
To Reproduce
Relevant log output / Error message
System Info
Checklist