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

Method get_weighted_samples

data_utils/datasets.py:886–891  ·  view source on GitHub ↗
(self, np_rng)

Source from the content-addressed store, hash-verified

884 self.weighting = None
885
886 def get_weighted_samples(self, np_rng):
887 if self.weighting is not None:
888 idx = np_rng.randint(self.total_len)
889 return bisect_right(self.weighting, idx)
890 else:
891 return np_rng.randint(self.ds_len)
892
893 def __len__(self):
894 return self.dataset_size

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected