transformers
transformers copied to clipboard
Added type hints for `Graphormer` pytorch version
@Rocketknight1 👋
- I added type hint for
graphormer
pytorch - checked formatting with black and ruff
if some checks on ci/cd do not, please do comment and correct
The documentation is not available anymore as the PR was closed or merged.
This looks pretty good! Is there a reason to use Union[torch.Tensor, torch.LongTensor]
instead of just torch.LongTensor
?
@Rocketknight1 Hi 👋
-
Union[torch.Tensor, torch.LongTensor]
is used because the file had a lot ofnn.embedding
instances which expects either IntTensor or LongTensor - so to avoid any confusion 😕 i used that
- nn.embedding docs
if still changes are required i would be happy to make it🙂
Hi @dewasahu2003, I think in most cases we just annotate those types as LongTensor
! Your version is probably more correct, but for simplicity just LongTensor
is fine, since that's what people usually use.
@Rocketknight1 Hi 👋
- if LongTensor is preferred then i would make changes along
- that would help the code to be 🤒 bloat free
Yep, I think replacing with LongTensor is slightly better, and does make the code a bit cleaner too.
Sure
Done. Thanks for the PR, we really appreciate it!