MCPcopy Create free account
hub / github.com/OpenLMLab/MOSS-RLHF / load_data

Method load_data

ppo/ppo_datahelper.py:300–312  ·  view source on GitHub ↗
(self, file_path: str)

Source from the content-addressed store, hash-verified

298
299
300 def load_data(self, file_path: str):
301 with open(file_path, 'r') as f:
302 data: List[List[str]] = json.load(f)
303
304 output: List[Tuple[List[str], str]] = []
305
306 for turn in data:
307 if not isinstance(turn, list) or len(turn) < 2 or not all(turn):
308 continue
309 output.append(turn)
310
311 del data
312 return output
313
314 def format(self, sample: Tuple[List[str], str]) -> Dict[str, Any]:
315 # original text concat special prompt: human prompt and assistant prompt

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected