Fix undefined mask variable in TransformerTemporalModel.forward()#179
Open
Mr-Neutr0n wants to merge 1 commit intoTMElyralab:mainfrom
Open
Fix undefined mask variable in TransformerTemporalModel.forward()#179Mr-Neutr0n wants to merge 1 commit intoTMElyralab:mainfrom
Mr-Neutr0n wants to merge 1 commit intoTMElyralab:mainfrom
Conversation
When vision_conditon_frames_sample_index is None and need_temporal_weight is False, the code referenced an undefined variable `mask`. The mask variable is only defined in the branch where vision_conditon_frames_sample_index is not None. Since in this else branch there is no vision conditioning, all frames should be treated equally with no masking, so the output should simply be residual + hidden_states.
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
NameErrorcaused by referencing an undefinedmaskvariable inmusev/models/temporal_transformer.pyat line 301.vision_conditon_frames_sample_index is None(orkeep_content_condition is False) andneed_temporal_weight is False, the code falls into theelsebranch wheremaskwas never defined — it is only created inside theif vision_conditon_frames_sample_index is not None and self.keep_content_conditionblock.residual + mask * hidden_statestoresidual + hidden_states.Details
The four branches of the output computation should be:
vision_conditon_frames_sample_indexneed_temporal_weightresidual + abs(temporal_weight) * mask * hidden_statesresidual + mask * hidden_statesresidual + abs(temporal_weight) * hidden_statesresidual + hidden_states(was:residual + mask * hidden_states— bug)The first three branches are correct. The fourth incorrectly referenced
maskwhich does not exist in that scope, causing aNameErrorat runtime.Test plan
maskis only assigned in theifbranchneed_temporal_weight=Falseand no vision conditioning frames to confirm noNameError