Skip to content

Make action-policy objectives padding-aware - #71

Open
zjn20030811 wants to merge 1 commit into
MarkFzp:mainfrom
zjn20030811:fix/masked-diffusion-objective
Open

Make action-policy objectives padding-aware#71
zjn20030811 wants to merge 1 commit into
MarkFzp:mainfrom
zjn20030811:fix/masked-diffusion-objective

Conversation

@zjn20030811

Copy link
Copy Markdown

What changed

  • apply the same ImageNet normalization to DiffusionPolicy inputs that the ACT and CNNMLP policies already use;
  • compute ACT L1 and diffusion noise-prediction losses over valid action elements only, so episode-boundary padding cannot change the gradient scale;
  • keep the all-padding edge case finite and add focused regression tests.

Why

The diffusion branch received the loader's [0, 1] images without the feature normalization used by the other policies. Its masked loss then called mean() over the padded tensor, so two otherwise identical batches with different amounts of padding optimized different effective objectives. The shared masked reduction makes the objective invariant to chunk padding while preserving the standard mean when every timestep is valid.

This is separate from the existing open questions about dependency setup and does not duplicate an open pull request. It also resolves the behavior described in #48.

Validation

  • python -m pytest -q tests/test_losses.py (4 passed)
  • python -m py_compile policy.py losses.py
  • git diff --check

Normalize diffusion and ACT losses over valid action elements and apply consistent visual preprocessing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant