[Bug] gaussian_actor: use_tanh_squash is documented and stored but never read (tanh squashing cannot be disabled)
Ticket Type
Bug Report (Something isn't working)
Environment & System Info
- LeRobot version: main @ 9a6bb61
- Platform: Linux-6.8.0-138-generic-x86_64
- Python version: 3.12.12
- PyTorch version: 2.11.0+cu128
- Using GPU in script?: No (CPU-only reproduction)Description
GaussianActorConfig documents that tanh squashing can be disabled:
By default the actor output is a tanh-squashed diagonal Gaussian
(``TanhMultivariateNormalDiag``); the tanh squashing can be disabled via
``policy_kwargs.use_tanh_squash``.(configuration_gaussian_actor.py class docstring; the flag is PolicyConfig.use_tanh_squash, default True.)
The flag is forwarded into Policy.__init__ and stored, but never read anywhere:
modeling_gaussian_actor.py:411—use_tanh_squash: bool = Falseconstructor argumentmodeling_gaussian_actor.py:421—self.use_tanh_squash = use_tanh_squash(last reference in the repo)modeling_gaussian_actor.pyforwardunconditionally buildsTanhMultivariateNormalDiag(loc=means, scale_diag=std)
A repo-wide grep -n use_tanh_squash finds only the two config sites, these two modeling sites, and config-default assertions in tests/policies/test_gaussian_actor_config.py (which test the config value, not the behavior).
Context & Reproduction
512 samples from policy.actor with observations scaled ×50 (so pre-squash means sit far outside [-1, 1]; an actually-unsquashed Gaussian would exceed the bounds):
use_tanh_squash=True: max|action|=0.9987 actions beyond [-1,1]: False
use_tanh_squash=False: max|action|=0.9975 actions beyond [-1,1]: FalseSetting use_tanh_squash=False changes nothing: actions stay tanh-bounded and the log-prob keeps the tanh correction. Users who disable it silently keep the squashed policy. Default-config users are unaffected, so this is latent — but the docstring currently promises behavior that does not exist.
Relevant logs or stack trace
None (silent no-op rather than a crash).
Additional Info / Workarounds
Happy to PR either direction, but this needs a maintainer decision:
- Implement the flag: build an unbounded Normal when
use_tanh_squash=False— larger change; action rescaling to the environment bounds would need to move into the policy/processor, and the SAC entropy/temperature semantics (use_backup_entropy) should be revisited for unsquashed actions. - Remove the flag and fix the docstring so the config stops promising a dead knob — small, safe change.
Leaning toward (2) unless squash-free training is on the roadmap. Related smell, same file: Policy.__init__ defaults (std_min=-5, std_max=2) don't match PolicyConfig (1e-5, 10) — inert today because the config always supplies them, but similarly misleading.
Source: huggingface/lerobot