code: def accumulate_and_extract_features(
      batch, features_list, ssl_model, ssl_layer_num, device
  ):
      """Extract features (output of SSL model) and acculamte them on cpu to be used for clustering.
  
      Arguments
      ---------
          batch: tensor
              Single batch of data.
          features_list : list
              accumulate features list.
          ssl_model
              SSL-model used to  extract features used for clustering.
          ssl_layer_num: int
              specify output of which layer of the ssl_model should be used.
          device
              CPU or  GPU.
      """
      batch = batch.to(device)
      wavs, wav_lens = batch.sig
      wavs, wav_lens = (
          wavs.to(device),
          wav_lens.to(device),
      )
      feats = ssl_model(wavs, wav_lens)[ssl_layer_num].flatten(
          end_dim=-2
      )
      features_list.extend(feats.to("cpu").detach().numpy())
  
imports: import os
  import logging
  from tqdm.contrib import tqdm
  import joblib
label_desc: Use image node_id 1 for calling a global function with example usage: accumulate_and_extract_features(batch, features_list, ssl_model, ssl_layer_num, device) without return types