MCPcopy Create free account
hub / github.com/THUDM/GLM / getidx

Method getidx

data_utils/datasets.py:815–820  ·  view source on GitHub ↗
(self, data_idx)

Source from the content-addressed store, hash-verified

813 return {'text': np.array(tokens), "loss_mask": np.array(loss_mask)}
814
815 def getidx(self, data_idx):
816 data = self.ds[data_idx]
817 tokens, loss_masks = data['tokens'], data['loss_masks']
818 tokens = tokens + [self.tokenizer.get_command('eos').Id]
819 loss_masks = loss_masks + [1]
820 return tokens, loss_masks
821
822 def pad_seq(self, seq, pad_id=None):
823 total_tokens = self.max_seq_len + 1

Callers 1

__getitem__Method · 0.95

Calls 1

get_commandMethod · 0.80

Tested by

no test coverage detected