code: def test_create_data_index_stride32(self):
      chunk_size = 64
      pad_id = 0
      stride = 32
      sentence1 = torch.arange(0, 200, 2, dtype=torch.int64)
      padded_size = chunk_size - (len(sentence1) % chunk_size)
      gt1 = np.pad(
          sentence1,
          (0, padded_size),
          "constant",
          constant_values=pad_id,
      )
  
      sentence2 = torch.arange(1, 500, 2, dtype=torch.int64)
      padded_size = chunk_size - (len(sentence2) % chunk_size)
      gt2 = np.pad(
          sentence2,
          (0, padded_size),
          "constant",
          constant_values=pad_id,
      )
  
      data_file = "/tmp/test"
      index_file = data_file + ".idx"
      bin_file = data_file + ".bin"
      try:
          builder = MMapRetrievalIndexedDatasetBuilder(
              bin_file,
              chunk_size,
              pad_id,
              False,
              dtype=np.int64,
              stride=stride,
          )
          builder.add_item(sentence1)
          builder.add_item(sentence2)
          builder.finalize(index_file)
          # load the data
          ds = MMapRetrievalIndexedDataset(data_file)
          assert np.array_equal(ds.get(0), gt1)
          assert np.array_equal(ds.get(1), gt2)
          fetch1, fetch2 = ds[0:2]
          assert np.array_equal(fetch1, gt1)
          assert np.array_equal(fetch2, gt2)
          chunk_id = ds.get_chunk_id(0, 64)
          assert chunk_id == 2
          assert ds.from_chunk_id_to_doc_id(0) == 0
          assert ds.from_chunk_id_to_doc_id(1) == 0
          assert ds.from_chunk_id_to_doc_id(2) == 0
          with pytest.raises(ValueError):
              ds.get_chunk_id(0, 128)
          assert np.array_equal(
              ds.get_chunk(chunk_id), gt1[64 : 64 + 64]
          )
          chunk_id = ds.get_chunk_id(1, 0)
          assert chunk_id == 3
          assert ds.from_chunk_id_to_doc_id(3) == 1
          assert ds.from_chunk_id_to_doc_id(4) == 1
          assert ds.from_chunk_id_to_doc_id(5) == 1
          assert ds.from_chunk_id_to_doc_id(6) == 1
          assert ds.from_chunk_id_to_doc_id(7) == 1
          assert ds.from_chunk_id_to_doc_id(8) == 1
          assert ds.from_chunk_id_to_doc_id(9) == 1
          with pytest.raises(ValueError):
              ds.from_chunk_id_to_doc_id(10)
          assert np.array_equal(ds.get_chunk(chunk_id), gt2[0:64])
          assert np.array_equal(
              ds.get_chunk(chunk_id + 1),
              gt2[stride : stride + chunk_size],
          )
          assert np.array_equal(
              ds.get_chunk(chunk_id + 2),
              gt2[stride * 2 : stride * 2 + chunk_size],
          )
          assert np.array_equal(
              ds.get_chunk(chunk_id + 3),
              gt2[stride * 3 : stride * 3 + chunk_size],
          )
          assert ds.get_chunk_id(1, 64) == 5
          assert ds.get_chunk_id(1, 128) == 7
          assert ds.get_chunk_id(1, 192) == 9
          with pytest.raises(ValueError):
              ds.get_chunk_id(0, 256)
      finally:
          os.remove(index_file)
          os.remove(bin_file)
  
imports: import os
  import numpy
  import pytest
  import torch
  from numpy.testing import assert_array_equal
  from omegaconf import OmegaConf
  from scripts.nlp_language_modeling.build_knn_map_index import build_map, dedup
  from nemo.collections.nlp.data.language_modeling.megatron.indexed_retrieval_dataset import KNNIndex, MMapRetrievalIndexedDataset, MMapRetrievalIndexedDatasetBuilder, merge_knn_files
  from nemo.collections.nlp.data.language_modeling.megatron.retro_dataset import RETRODataset
label_desc: Use image node_id 3 for calling the TestRetrievalIndexFiles obj's underlying member method code with example usage: obj.test_create_data_index_stride32() without return types