mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
fix runcpu when num_fewshot is greater than data
This commit is contained in:
parent
50bea28ef9
commit
cc8d819286
|
|
@ -174,7 +174,7 @@ def evaluate_example(idx, model, tokenizer, data, device, task_meta):
|
|||
|
||||
# Sample few-shot examples (excluding current item)
|
||||
fewshot_examples = []
|
||||
if num_fewshot > 0:
|
||||
if num_fewshot > 0 and len(data) > num_fewshot:
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user