diff --git a/ignite/engine/engine.py b/ignite/engine/engine.py
index 52febd51..9f17ac9a 100644
--- a/ignite/engine/engine.py
+++ b/ignite/engine/engine.py
@@ -863,19 +863,20 @@ class Engine:
         # if input data is torch dataloader we replace batch sampler by a batch sampler
         # such that its random sampling indices are reproducible by prefetching them before data iteration
         if isinstance(self.state.dataloader, torch.utils.data.DataLoader):
-
-            if (self._dataloader_len is not None) and hasattr(self.state.dataloader.sampler, "epoch"):
-                if self._dataloader_len != self.state.epoch_length:
-                    warnings.warn("When defined engine's epoch length is different of input dataloader length, "
-                                  "distributed sampler indices can not be setup in a reproducible manner")
-
-            batch_sampler = self.state.dataloader.batch_sampler
-            if not isinstance(batch_sampler, ReproducibleBatchSampler):
-                self.state.dataloader = _update_dataloader(self.state.dataloader,
-                                                           ReproducibleBatchSampler(batch_sampler))
+            _dataloader_kind = self.state.dataloader._dataset_kind
+            if _dataloader_kind == torch.utils.data.dataloader._DatasetKind.Map:
+                if (self._dataloader_len is not None) and hasattr(self.state.dataloader.sampler, "epoch"):
+                    if self._dataloader_len != self.state.epoch_length:
+                        warnings.warn("When defined engine's epoch length is different of input dataloader length, "
+                                      "distributed sampler indices can not be setup in a reproducible manner")
+
+                batch_sampler = self.state.dataloader.batch_sampler
+                if not isinstance(batch_sampler, ReproducibleBatchSampler):
+                    self.state.dataloader = _update_dataloader(self.state.dataloader,
+                                                               ReproducibleBatchSampler(batch_sampler))
 
         iteration = self.state.iteration
-        self._dataloader_iter = self._from_iteration(self.state.dataloader, iteration, self.state.epoch_length)
+        self._dataloader_iter = self._from_iteration(self.state.dataloader, iteration)
 
         # Below we define initial counter value for _run_once_on_dataset to measure a single epoch
         if self.state.epoch_length is not None:
@@ -883,12 +884,17 @@ class Engine:
         self._init_iter.append(iteration)
 
     @staticmethod
-    def _from_iteration(data, iteration, epoch_length):
+    def _from_iteration(data, iteration):
         if isinstance(data, torch.utils.data.DataLoader):
-            iteration %= len(data.batch_sampler)
-            if iteration > 0:
-                # batch sampler is ReproducibleBatchSampler
-                data.batch_sampler.start_iteration = iteration
+            try:
+                # following is unsafe for IterableDatasets
+                iteration %= len(data.batch_sampler)
+                if iteration > 0:
+                    # batch sampler is ReproducibleBatchSampler
+                    data.batch_sampler.start_iteration = iteration
+            except TypeError:
+                # Probably we can do nothing with DataLoader built upon IterableDatasets
+                pass
             data_iter = iter(data)
         else:
             if hasattr(data, "__len__"):

Issue with DataLoader with _dataset_kind = Iterable
The following code wont work:
```python
import torch

class MyIterableDataset(torch.utils.data.IterableDataset):
    def __init__(self, start, end):
        super(MyIterableDataset).__init__()
        assert end > start, "this example code only works with end >= start"
        self.start = start
        self.end = end

    def __iter__(self):
        return iter(range(self.start, self.end))

ds = MyIterableDataset(0, 1000)
data_loader = torch.utils.data.DataLoader(ds, num_workers=2)

from ignite.engine import Engine

def foo(e, b):
    print("{}-{}: {}".format(e.state.epoch, e.state.iteration, b))

engine = Engine(foo)
engine.run(data_loader, epoch_length=10)
```
and gives the error
```


ValueErrorTraceback (most recent call last)
<ipython-input-19-1c8004fbf46e> in <module>
     21 
     22 engine = Engine(foo)
---> 23 engine.run(data_loader, epoch_length=10)

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in run(self, data, max_epochs, epoch_length, seed)
    848 
    849         self.state.dataloader = data
--> 850         return self._internal_run()
    851 
    852     def _setup_engine(self):

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in _internal_run(self)
    950             self._dataloader_iter = self._dataloader_len = None
    951             self.logger.error("Engine run is terminating due to exception: %s.", str(e))
--> 952             self._handle_exception(e)
    953 
    954         self._dataloader_iter = self._dataloader_len = None

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in _handle_exception(self, e)
    714             self._fire_event(Events.EXCEPTION_RAISED, e)
    715         else:
--> 716             raise e
    717 
    718     def state_dict(self):

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in _internal_run(self)
    933 
    934                 if self._dataloader_iter is None:
--> 935                     self._setup_engine()
    936 
    937                 hours, mins, secs = self._run_once_on_dataset()

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in _setup_engine(self)
    873             if not isinstance(batch_sampler, ReproducibleBatchSampler):
    874                 self.state.dataloader = _update_dataloader(self.state.dataloader,
--> 875                                                            ReproducibleBatchSampler(batch_sampler))
    876 
    877         iteration = self.state.iteration

/opt/conda/lib/python3.7/site-packages/ignite/engine/engine.py in _update_dataloader(dataloader, new_batch_sampler)
    963     params = {k: getattr(dataloader, k) for k in params_keys}
    964     params['batch_sampler'] = new_batch_sampler
--> 965     return torch.utils.data.DataLoader(**params)
    966 
    967 

/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py in __init__(self, dataset, batch_size, shuffle, sampler, batch_sampler, num_workers, collate_fn, pin_memory, drop_last, timeout, worker_init_fn, multiprocessing_context)
    182                 raise ValueError(
    183                     "DataLoader with IterableDataset: expected unspecified "
--> 184                     "batch_sampler option, but got batch_sampler={}".format(batch_sampler))
    185         else:
    186             self._dataset_kind = _DatasetKind.Map

ValueError: DataLoader with IterableDataset: expected unspecified batch_sampler option, but got batch_sampler=<ignite.engine.engine.ReproducibleBatchSampler object at 0x7f6000e3fad0>
```

Patching it like [here](https://github.com/pytorch/ignite/issues/618#issuecomment-577183132) can be a workaround:
```python
engine.run(map(lambda x: x, data_loader), epoch_length=10)
```
diff --git a/tests/ignite/engine/test_engine.py b/tests/ignite/engine/test_engine.py
index 638415bf..40aeea13 100644
--- a/tests/ignite/engine/test_engine.py
+++ b/tests/ignite/engine/test_engine.py
@@ -496,3 +496,30 @@ def test_multinode_distrib_cpu(distributed_context_multi_node_gloo):
 def test_multinode_distrib_gpu(distributed_context_multi_node_nccl):
     _test_run_check_triggered_events_on_iterator()
     _test_run_check_triggered_events()
+
+
+def test_engine_with_iterable_dataloader():
+
+    class MyIterableDataset(torch.utils.data.IterableDataset):
+        def __init__(self, start, end):
+            super(MyIterableDataset).__init__()
+            assert end > start, "this example code only works with end >= start"
+            self.start = start
+            self.end = end
+
+        def __iter__(self):
+            return iter(range(self.start, self.end))
+
+    ds = MyIterableDataset(0, 1000)
+    data_loader = torch.utils.data.DataLoader(ds, num_workers=2)
+
+    counter = [0]
+
+    def foo(e, b):
+        print("{}-{}: {}".format(e.state.epoch, e.state.iteration, b))
+        counter[0] += 1
+
+    engine = Engine(foo)
+    engine.run(data_loader, epoch_length=10, max_epochs=5)
+
+    assert counter[0] == 50

pip install -e .
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc pip install torch torchvision -f https://download.pytorch.org/whl/cpu/torch_stable.html -U
3.7
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
exceptiongroup==1.2.2
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
numpy==1.21.6
packaging==24.0
Pillow==9.5.0
pluggy==1.2.0
pytest==7.4.4
-e git+https://github.com/pytorch/ignite.git@a94725b83b8d6aefc9382f08e40c19976e3f8fc1#egg=pytorch_ignite
requests==2.31.0
tomli==2.0.1
torch==1.13.1+cpu
torchvision==0.14.1+cpu
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: ignite
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - charset-normalizer==3.4.1
      - exceptiongroup==1.2.2
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - numpy==1.21.6
      - packaging==24.0
      - pillow==9.5.0
      - pluggy==1.2.0
      - pytest==7.4.4
      - requests==2.31.0
      - tomli==2.0.1
      - torch==1.13.1+cpu
      - torchvision==0.14.1+cpu
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/ignite

tests/ignite/engine/test_engine.py::test_engine_with_iterable_dataloader
tests/ignite/engine/test_engine.py::test_terminate tests/ignite/engine/test_engine.py::test_invalid_process_raises_with_invalid_signature tests/ignite/engine/test_engine.py::test_current_epoch_counter_increases_every_epoch tests/ignite/engine/test_engine.py::test_current_iteration_counter_increases_every_iteration tests/ignite/engine/test_engine.py::test_stopping_criterion_is_max_epochs tests/ignite/engine/test_engine.py::test_terminate_at_end_of_epoch_stops_run tests/ignite/engine/test_engine.py::test_terminate_at_start_of_epoch_stops_run_after_completing_iteration tests/ignite/engine/test_engine.py::test_terminate_stops_run_mid_epoch tests/ignite/engine/test_engine.py::test_terminate_epoch_stops_mid_epoch tests/ignite/engine/test_engine.py::test_iteration_events_are_fired tests/ignite/engine/test_engine.py::test_last_event_name tests/ignite/engine/test_engine.py::test_reset_should_terminate tests/ignite/engine/test_engine.py::test_batch_values tests/ignite/engine/test_engine.py::test_state_repr tests/ignite/engine/test_engine.py::test_alter_batch tests/ignite/engine/test_engine.py::test__is_done tests/ignite/engine/test_engine.py::test__setup_engine tests/ignite/engine/test_engine.py::test_run_asserts tests/ignite/engine/test_engine.py::test_state_get_event_attrib_value tests/ignite/engine/test_engine.py::test_run_check_triggered_events tests/ignite/engine/test_engine.py::test_run_check_triggered_events_on_iterator
ignite/engine/engine.py
ignite/engine/engine.py