MCPcopy Create free account
hub / github.com/OpenBMB/ToolBench / __init__

Method __init__

toolbench/train/train.py:172–181  ·  view source on GitHub ↗
(self, raw_data, tokenizer: transformers.PreTrainedTokenizer, template="tool-llama")

Source from the content-addressed store, hash-verified

170 """Dataset for supervised fine-tuning."""
171
172 def __init__(self, raw_data, tokenizer: transformers.PreTrainedTokenizer, template="tool-llama"):
173 super(SupervisedDataset, self).__init__()
174
175 rank0_print("Formatting inputs...")
176 sources = [example["conversations"] for example in raw_data]
177 self.template = template
178 data_dict = preprocess(sources, tokenizer, self.template)
179 self.input_ids = data_dict["input_ids"]
180 self.labels = data_dict["labels"]
181 self.attention_mask = data_dict["attention_mask"]
182
183 def __len__(self):
184 return len(self.input_ids)

Callers 1

__init__Method · 0.45

Calls 2

rank0_printFunction · 0.85
preprocessFunction · 0.85

Tested by

no test coverage detected