def get_batch_iterator(self, dataset, max_tokens=None, max_sentences=None, max_positions=None, ignore_invalid_inputs=False, required_batch_size_multiple=1, seed=1, num_shards=1, shard_id=0, num_workers=0):
    assert isinstance(dataset, FairseqDataset)
    with data_utils.numpy_seed(seed):
        indices = dataset.ordered_indices()
    indices = data_utils.filter_by_size(indices, dataset.size, max_positions, raise_exception=(not ignore_invalid_inputs))
    batch_sampler = data_utils.batch_by_size(indices, dataset.num_tokens, max_tokens=max_tokens, max_sentences=max_sentences, required_batch_size_multiple=required_batch_size_multiple)
    return ptt_iterators.WeightedEpochBatchIterator(dataset=dataset, collate_fn=dataset.collater, batch_sampler=batch_sampler, seed=seed, num_shards=num_shards, shard_id=shard_id, num_workers=num_workers, weights=self.loss_weights)
def get_batch_iterator(self, dataset, max_tokens=None, max_sentences=None, max_positions=None, ignore_invalid_inputs=False, required_batch_size_multiple=1, seed=1, num_shards=1, shard_id=0, num_workers=0):
    assert isinstance(dataset, FairseqDataset)
    with data_utils.numpy_seed(seed):
        indices = dataset.ordered_indices()
    indices = data_utils.filter_by_size(indices, dataset.size, max_positions, raise_exception=(not ignore_invalid_inputs))
    batch_sampler = data_utils.batch_by_size(indices, dataset.num_tokens, max_tokens=max_tokens, max_sentences=max_sentences, required_batch_size_multiple=required_batch_size_multiple)
    return ptt_iterators.WeightedEpochBatchIterator(dataset=dataset, collate_fn=dataset.collater, batch_sampler=batch_sampler, seed=seed, num_shards=num_shards, shard_id=shard_id, num_workers=num_workers, weights=self.loss_weights)