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

Fix knowledge_distillation=False error #1264

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

billvsme
Copy link
Contributor

@billvsme billvsme commented Nov 27, 2024

When I was fine-tuning bge-en-icl, I got an error when use --knowledge_distillation False

error like:

[rank0]:     if len(teacher_scores) > 0 and len(passages) > 0:
[rank0]: typeError: object of type 'NoneType' has no len()

I found that the reason is that when knowledge_distillation=False teacher_scores it becomes None.

if self.args.knowledge_distillation:
if 'pos_scores' in batch_raw_data and batch_raw_data['pos_scores'][i] is not None:
teacher_scores.append(batch_raw_data['pos_scores'][i][pos_idx])
for neg_idx in neg_idxs:
if 'neg_scores' in batch_raw_data and batch_raw_data['neg_scores'][i] is not None:
teacher_scores.append(batch_raw_data['neg_scores'][i][neg_idx])
else:
teacher_scores = None

if len(teacher_scores) > 0 and len(passages) > 0:
assert len(teacher_scores) == len(passages)

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.

1 participant