pytorch / pytorch/tutorials

misleading variable name in transformer tutorial

Open
#1,944 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

intro
Dominant language
Python
Stars
9.3k
Forks
4.4k
Avg merge
1d 21h
Merged PRs (30d)
4

Description

https://github.com/pytorch/tutorials/blob/master/beginner_source/transformer_tutorial.py#L300

batch_size is a bad variable name, because it is not the dimension usually referred to as the batch size.. Instead, it is the sequence length associated with a particular batch. I suggest using batch_seq_len for clarity.

cc @suraj813

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open beginner_source/transformer_tutorial.py around line 300 and inspect the variable named batch_size. Rename it to batch_seq_len consistently, then verify the tutorial no longer uses the misleading name for this sequence-length value.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.