| 368 | |
| 369 | |
| 370 | py::array build_mapping(const py::array_t<int64_t>& docs_, |
| 371 | const py::array_t<int>& sizes_, |
| 372 | const int num_epochs, |
| 373 | const uint64_t max_num_samples, |
| 374 | const int max_seq_length, |
| 375 | const double short_seq_prob, |
| 376 | const int seed, |
| 377 | const bool verbose) { |
| 378 | |
| 379 | if (sizes_.size() > std::numeric_limits<uint32_t>::max()) { |
| 380 | if (verbose) { |
| 381 | cout << " using uint64 for data mapping..." << endl << std::flush; |
| 382 | } |
| 383 | return build_mapping_impl<uint64_t>(docs_, sizes_, num_epochs, |
| 384 | max_num_samples, max_seq_length, |
| 385 | short_seq_prob, seed, verbose); |
| 386 | } else { |
| 387 | if (verbose) { |
| 388 | cout << " using uint32 for data mapping..." << endl << std::flush; |
| 389 | } |
| 390 | return build_mapping_impl<uint32_t>(docs_, sizes_, num_epochs, |
| 391 | max_num_samples, max_seq_length, |
| 392 | short_seq_prob, seed, verbose); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | template<typename DocIdx> |
| 397 | py::array build_blocks_mapping_impl(const py::array_t<int64_t>& docs_, |