mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-10-14 23:58:11 +08:00
shuffle few shot examples
Former-commit-id: 2c9c14c122382e640dfa41a3799628c764c99457
This commit is contained in:
parent
28062c71b5
commit
9564ddbb48
@ -8,6 +8,7 @@ import os
|
|||||||
import fire
|
import fire
|
||||||
import json
|
import json
|
||||||
import torch
|
import torch
|
||||||
|
import random
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Tuple
|
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Tuple
|
||||||
@ -48,6 +49,7 @@ class EvalTemplate:
|
|||||||
history = [self.parse_example(support_set[k]) for k in range(len(support_set))]
|
history = [self.parse_example(support_set[k]) for k in range(len(support_set))]
|
||||||
|
|
||||||
if len(history):
|
if len(history):
|
||||||
|
random.shuffle(history)
|
||||||
temp = history.pop(0)
|
temp = history.pop(0)
|
||||||
history.insert(0, (self.system.format(subject=subject_name) + temp[0], temp[1]))
|
history.insert(0, (self.system.format(subject=subject_name) + temp[0], temp[1]))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user