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

问题 #137

Open
wuguangshuo opened this issue Feb 7, 2024 · 0 comments
Open

问题 #137

wuguangshuo opened this issue Feb 7, 2024 · 0 comments

Comments

@wuguangshuo
Copy link

def __call__(self, batch):
    lengths = [len(instance["input_ids"]) for instance in batch]
    batch_max_len = max(lengths)

    input_ids_batch, labels_batch = [], []
    for instance in batch:
        input_ids = instance["input_ids"]
        labels = instance["labels"]

        padding_len = batch_max_len - len(input_ids)
        input_ids = input_ids + [self.pad_token_id] * padding_len
        labels = labels + [-100] * padding_len

        input_ids_batch.append(input_ids)
        labels_batch.append(labels)
        
   input_ids不应该在左面填充pad吗   
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