Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Semantic Conflict about variable 'max_len' #6

Open
JJJYmmm opened this issue Sep 2, 2023 · 0 comments
Open

Semantic Conflict about variable 'max_len' #6

JJJYmmm opened this issue Sep 2, 2023 · 0 comments

Comments

@JJJYmmm
Copy link

JJJYmmm commented Sep 2, 2023

Hi Shariatnia, thanks for your tutorial!
I have some question about variable max_len.
I see max_len first in class Tokenizer,I think the role of it is to limit the maximum number of objects.

labels = labels.astype('int')[:self.max_len]

bboxes = self.quantize(bboxes)[:self.max_len]

But in function collect_fn used for dataloader,I think max_len is to limit the maximum length of input sequence.

if max_len: # [B,max_seq_len,dim] -> [B,max_len,dim]
        pad = torch.ones(seq_batch.size(0), max_len -
                         seq_batch.size(1)).fill_(pad_idx).long()
        seq_batch = torch.cat([seq_batch, pad], dim=1)

I have checked the inputs of the two variables and both came from CFG.max_len,so it's not a coincidence.

I think the variable in the second place should be 5 times that in the first place (excluding eos and bos), because an object corresponds to 5 tokens. I don't know if I'm right,Looking forward to your reply.

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

No branches or pull requests

1 participant