class_docstr: This CacheCollateFn is used to accelerate the processing of the data generated using the Cache.
  
  During the chunking phase, there is no need to return any data from the DataLoader reducing some time.
  
  Additionally, if the user makes their __getitem__ asynchronous, the collate executes them in parallel.
class_docstr_tok: ["This","CacheCollateFn","is","used","to","accelerate","the","processing","of","the","data","generated","using","the","Cache",".","During","the","chunking","phase",",","there","is","no","need","to","return","any","data","from","the","DataLoader","reducing","some","time",".","Additionally",",","if","the","user","makes","their","__getitem__","asynchronous",",","the","collate","executes","them","in","parallel","."]
code: def __call__(self, items: List[Any]) -> Any:
      if all(item is None for item in items):
          return None
  
      # If the __getitem__ method is asynchornous, collect all the items.
      if all(inspect.iscoroutine(item) for item in items):
          loop = asyncio.new_event_loop()
          asyncio.set_event_loop(loop)
          items = loop.run_until_complete(asyncio.gather(*items))
  
      return self.collate_fn(
          [item for item in items if item is not None]
      )
  
imports: import asyncio
  import inspect
  import logging
  import os
  from importlib import reload
  from typing import Any, Callable, Dict, List, Optional, Union
  import torch
  from torch.utils.data import Dataset, IterableDataset
  from torch.utils.data._utils.collate import default_collate
  from torch.utils.data._utils.fetch import _BaseDatasetFetcher
  from torch.utils.data.dataloader import DataLoader, _BaseDataLoaderIter, _DatasetKind, _MultiProcessingDataLoaderIter, _SingleProcessDataLoaderIter
  from torch.utils.data.sampler import BatchSampler, Sampler
  from lightning.data.streaming import Cache
  from lightning.data.streaming.combined import CombinedStreamingDataset
  from lightning.data.streaming.constants import _DEFAULT_CHUNK_BYTES, _TORCH_GREATER_EQUAL_2_1_0, _VIZ_TRACKER_AVAILABLE
  from lightning.data.streaming.dataset import StreamingDataset
  from lightning.data.streaming.sampler import CacheBatchSampler
  from lightning.data.utilities.env import _DistributedEnv
label_desc: Use image node_id 2 for calling the CacheCollateFn obj's underlying member method code with example usage: obj.__call__(items) and returns: self, None