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

Method __getitem__

toolbench/train/train.py:210–222  ·  view source on GitHub ↗
(self, i)

Source from the content-addressed store, hash-verified

208 return len(self.raw_data)
209
210 def __getitem__(self, i) -> Dict[str, torch.Tensor]:
211 if i in self.cached_data_dict:
212 return self.cached_data_dict[i]
213
214 ret = preprocess([self.raw_data[i]["conversations"]], self.tokenizer, self.template)
215 ret = dict(
216 input_ids=ret["input_ids"][0],
217 labels=ret["labels"][0],
218 attention_mask=ret["attention_mask"][0],
219 )
220 self.cached_data_dict[i] = ret
221
222 return ret
223
224
225def make_supervised_data_module(

Callers

nothing calls this directly

Calls 1

preprocessFunction · 0.85

Tested by

no test coverage detected