mirror of
https://github.com/karpathy/nanochat.git
synced 2026-03-14 17:03:13 +00:00
fix: clamp few-shot sample size to available data length
This commit is contained in:
parent
c7ba252142
commit
b12d1961de
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user