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

Allow flexibility for users to pass attention_mask in data_collator #2234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

YerongLi
Copy link

Allow flexibility for users to pass attention_mask in data_collator. If batch[0] contains attention_mask, assign it to the result.

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

PR information

Write the detail information belongs to this PR.
If batch[0] contains attention_mask, assign it to the result.

Experiment results

Paste your experiment result here(if needed).

Allow flexibility for users to pass attention_mask in data loader. If batch[0] contains attention_mask, assign it to the result.
@YerongLi
Copy link
Author

@Jintao-Huang

@Jintao-Huang
Copy link
Collaborator

thanks for your PR

torch.ones((inputs_embeds[i].shape[0]), dtype=torch.int64) for i in range(len(inputs_embeds))
]
if 'attention_mask' in batch[0]:
res['attention_mask'] = batch[0]['attention_mask']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The batch size may be greater than 1.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let me think about how to deal with batch size greater than 1.

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.

2 participants