MCPcopy Create free account
hub / github.com/ContextualAI/HALOs / get_flat_data

Method get_flat_data

train/dataloader.py:695–710  ·  view source on GitHub ↗

Return a flat list of examples given a list of prompts.

(self, prompts)

Source from the content-addressed store, hash-verified

693 Dataloader for losses that do require pairwise preferences (e.g., DPO).
694 """
695 def get_flat_data(self, prompts):
696 """
697 Return a flat list of examples given a list of prompts.
698 """
699 flat_data = []
700
701 for prompt in prompts:
702 example = self.full_data[prompt]
703
704 if self.max_prompt_count:
705 example.pairs = self.rng.sample(example.pairs, min(self.max_prompt_count, len(example.pairs)))
706
707 for pair in example.pairs:
708 flat_data.append((example, pair))
709
710 return flat_data
711
712 def __iter__(self):
713 epoch_idx = 0

Callers

nothing calls this directly

Calls 1

sampleMethod · 0.80

Tested by

no test coverage detected