Skip to content

fix: correct torch.torch.int32 typo to torch.int32#1258

Open
Mr-Neutr0n wants to merge 1 commit intoOpenGVLab:mainfrom
Mr-Neutr0n:fix/torch-int32-typo
Open

fix: correct torch.torch.int32 typo to torch.int32#1258
Mr-Neutr0n wants to merge 1 commit intoOpenGVLab:mainfrom
Mr-Neutr0n:fix/torch-int32-typo

Conversation

@Mr-Neutr0n
Copy link

Summary

  • Fix typo torch.torch.int32 to torch.int32 in internvl_chat/internvl/model/internlm2/modeling_internlm2.py (line 87)

Details

In the _get_unpad_data function, the dtype argument to torch.cumsum is specified as torch.torch.int32. This works at runtime by accident because torch.torch resolves circularly back to the torch module itself (i.e., torch.torch is torch evaluates to True), so torch.torch.int32 ends up being the same object as torch.int32.

However, this is clearly a typo and will cause failures under static type checkers (e.g., mypy, pyright) since torch.torch is not part of the public API. This PR corrects it to torch.int32.

Note that line 84 in the same function already uses the correct torch.int32:

seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)

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