MCPcopy Create free account
hub / github.com/RingBDStack/GDAP / make_sortish_sampler

Method make_sortish_sampler

seq2seq/utils.py:166–170  ·  view source on GitHub ↗
(self, batch_size, distributed=False, shuffle=True, **kwargs)

Source from the content-addressed store, hash-verified

164 return self.get_char_lens(self.tgt_file)
165
166 def make_sortish_sampler(self, batch_size, distributed=False, shuffle=True, **kwargs):
167 if distributed:
168 return DistributedSortishSampler(self, batch_size, shuffle=shuffle, **kwargs)
169 else:
170 return SortishSampler(self.src_lens, batch_size, shuffle=shuffle)
171
172 def make_dynamic_sampler(self, max_tokens_per_batch=1024, **kwargs):
173 assert FAIRSEQ_AVAILABLE, "Dynamic batch size requires `pip install fairseq`"

Callers 1

make_dynamic_samplerMethod · 0.95

Calls 2

SortishSamplerClass · 0.85

Tested by

no test coverage detected