MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / format

Method format

trinity/buffer/schema/formatter.py:82–96  ·  view source on GitHub ↗
(self, sample: Dict)

Source from the content-addressed store, hash-verified

80 raise ValueError(f"Unsupported prompt_type: {self.prompt_type}")
81
82 def format(self, sample: Dict) -> Experience:
83 if self.prompt_type == PromptType.PLAINTEXT:
84 prompt = sample[self.prompt_key]
85 inputs = self.processor_or_tokenizer(
86 text=prompt,
87 return_tensors="pt",
88 return_dict=True,
89 )
90 token_ids = inputs.pop("input_ids")[0]
91 return Experience(
92 tokens=token_ids,
93 prompt_length=1,
94 )
95 else:
96 raise ValueError(f"Unsupported prompt_type: {self.prompt_type}")
97
98
99class SFTFormatter(ExperienceFormatter):

Callers 4

_convert_batchMethod · 0.45
_convert_batchMethod · 0.45
load_from_datasetMethod · 0.45
operationMethod · 0.45

Calls 1

ExperienceClass · 0.90

Tested by

no test coverage detected