code: def test_saveable_dataloader(tmpdir, device):
      from speechbrain.dataio.dataloader import SaveableDataLoader
  
      save_file = tmpdir + "/dataloader.ckpt"
      dataset = torch.randn(10, 1, device=device)
      dataloader = SaveableDataLoader(dataset, collate_fn=None)
      data_iterator = iter(dataloader)
      first_item = next(data_iterator)
      assert first_item == dataset[0]
      # Save here:
      dataloader._speechbrain_save(save_file)
      second_item = next(data_iterator)
      assert second_item == dataset[1]
      # Now make a new dataloader and recover:
      new_dataloader = SaveableDataLoader(dataset, collate_fn=None)
      new_dataloader._speechbrain_load(save_file, end_of_epoch=False)
      new_data_iterator = iter(new_dataloader)
      second_second_item = next(new_data_iterator)
      assert second_second_item == second_item
  
imports: import torch
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_saveable_dataloader(tmpdir, device) without return types