feat(mixer): use timm mixer instead of custom mixer - #274
Open
yhisaki wants to merge 3 commits into
Open
Conversation
Signed-off-by: Y.Hisaki <yhisaki31@gmail.com>
|
Since retraining is required, it is likely to take some time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the custom MLP-Mixer implementation with the standard
MixerBlockprovided bytimm.The scene encoders and turn-indicator trajectory encoder now use the same upstream implementation, reducing duplicated code and making the Mixer architecture easier to understand and maintain.
Changes
Replace the custom
diffusion_planner.model.module.mixer.MixerBlockwithtimm.models.mlp_mixer.MixerBlock.Remove the custom
mixer.pymodule.Update the following encoders to use the
timmMixer interface:EgoEncoderNeighborEncoderLaneEncoderLineEncoderTrajectoryEncoderSimplify encoder constructors by removing the custom
tokens_mlp_dimandchannels_mlp_dimarguments.Use each encoder's embedding dimension as the Mixer channel dimension and the corresponding sequence length as the token dimension.
Use
timm'sMlpimplementation for single-token and auxiliary MLP encoders where applicable.Apply
drop_path_ratethrough the residualDropPathmechanism provided by thetimmMixer block.Motivation
The previous Mixer implementation duplicated functionality already available in
timmand required project-specific constructor arguments.Using the upstream implementation:
Behavioral changes
This is not a parameter-for-parameter replacement of the previous Mixer block.
The
timmimplementation uses its standard token- and channel-MLP expansion ratios and appliesdrop_path_rateas stochastic depth on the residual branches. Therefore, the internal parameter shapes and regularization behavior differ from those of the previous custom implementation.