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

[BUG] <title>token截断导致训练label被删除 #662

Open
2 tasks done
tong-1989 opened this issue Nov 11, 2024 · 2 comments
Open
2 tasks done

[BUG] <title>token截断导致训练label被删除 #662

tong-1989 opened this issue Nov 11, 2024 · 2 comments

Comments

@tong-1989
Copy link

tong-1989 commented Nov 11, 2024

是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?

  • 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions

该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?

  • 我已经搜索过FAQ | I have searched FAQ

当前行为 | Current Behavior

img
在做finetune的时候,dataset.py下data_collator方法,会对数据做截断,丢掉max_length之后的tokens。这样在做监督训练的会后,会把模型学习的label截掉,导致报错"No tokens available to compute loss."

期望行为 | Expected Behavior

是否在做token截断的时候只对input做,不影响label的获取

复现方法 | Steps To Reproduce

No response

运行环境 | Environment

- OS:
- Python:
- Transformers:
- PyTorch:
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):

备注 | Anything else?

No response

@LDLINGLINGLING
Copy link
Collaborator

你好,个人认为这里很难改,因为不好同时兼顾自动判断有效token长度和个人的显存。

@DankoZhang
Copy link

用swift框架吧,直接删除超长的数据

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

3 participants