This commit is contained in:
Suraj-Self 2026-03-27 11:46:36 +08:00 committed by GitHub
commit ed9170925f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -177,7 +177,7 @@ def evaluate_example(idx, model, tokenizer, data, device, task_meta):
if num_fewshot > 0:
rng = random.Random(1234 + idx)
available_indices = [i for i in range(len(data)) if i != idx]
fewshot_indices = rng.sample(available_indices, num_fewshot)
fewshot_indices = rng.sample(available_indices, min(num_fewshot, len(available_indices)))
fewshot_examples = [data[i] for i in fewshot_indices]
# Render prompts and batch sequences based on task type