File size: 635 Bytes
906ccdd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from .dataloader import DataLoader
from . import dataloader_registry
import json


@dataloader_registry.register("tasksolving/responsegen/gpt-3.5")
@dataloader_registry.register("tasksolving/responsegen/gpt-4")
class ResponseGenLoader(DataLoader):
    def __init__(self, path: str):
        super().__init__(path)

    def load(self):
        with open(self.path) as f:
            for line in f:
                line = json.loads(line)
                self.examples.append(
                    {
                        "input": line["input"],
                        "answer": line["answer"],
                    }
                )