Skip to content

[Feature] Load pretrained MicroDuck policies - #4394

Open
vmoens wants to merge 5 commits into
mainfrom
codex/microduck-policy
Open

vmoens wants to merge 5 commits into
mainfrom
codex/microduck-policy

Conversation

@vmoens

@vmoens vmoens commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds MicroDuckPolicy as a focused public factory for the published recurrent MicroDuck walker.

  • Builds the task-conditioned encoder, GRU, and bounded Gaussian actor used by the checkpoint.
  • Reconstructs the ordered MicroDuck task library and action scale from local checkpoint metadata.
  • Optionally downloads the pinned published checkpoint from Hugging Face.
  • Documents the public class in the module reference with a runnable construction example.

API quality

Implementation-only network helpers are private. Public factory methods carry explicit return types. Imports remain at module scope except for the optional Hugging Face dependency and a documented lazy MicroDuckEnv import needed to avoid an env/modules cycle.

Tests

  • Reconstructs a two-task checkpoint, verifies frozen parameters and task metadata, and runs a recurrent actor forward pass.
  • MicroDuckPolicy doctest passes.

vmoens and others added 2 commits September 16, 2026 15:11
Adds MicroDuckPolicy under torchrl.modules.tensordict_module, exposing
TaskConditionedEncoder, GaussianHead, and a factory for the published
walker. MicroDuckPolicy.from_pretrained() downloads the pinned
walker.ckpt from torchrl/microduck-skills and returns
(frozen_actor, ordered_task_library, action_scale). from_checkpoint
accepts a local path for the same rebuild.

The factory mirrors examples.microduck.ppo_mujoco.make_models so loading
the published weights produces bit-identical parameters and outputs;
TaskConditionedEncoder and GaussianHead become canonical torchrl
modules (the gait residual head stays example-side since the published
walker did not use it).

Co-Authored-By: Claude <noreply@anthropic.com>
@pytorch-bot

pytorch-bot Bot commented Sep 16, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4394

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 057cdb2 with merge base 2d258fe (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 16, 2026
@github-actions github-actions Bot added Documentation Improvements or additions to documentation Modules Integrations/torch_geometric Integrations Feature New feature labels Sep 16, 2026
@vmoens vmoens added the ci/optdeps Run the full tests-optdeps suite on this PR label Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/optdeps Run the full tests-optdeps suite on this PR CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Documentation Improvements or additions to documentation Feature New feature Integrations/torch_geometric Integrations Modules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant