code: def get_streams(
      waveform,
      speaker,
      dense_model,
      quantizer_model,
      f0_normalizer,
      f0_quantizer,
      need_f0,
      deduplicate,
      f0_code_ratio,
  ):
      if waveform.ndim > 1:
          waveform = waveform.mean(0)
  
      dense_features = dense_model(waveform)
      units = quantizer_model(dense_features)
  
      if deduplicate:
          units, durations = torch.unique_consecutive(
              units, return_counts=True
          )
      else:
          durations = torch.ones_like(units)
  
      if need_f0:
          f0 = get_f0(waveform.cpu().numpy())
          f0 = torch.from_numpy(f0).float()
  
          if f0_normalizer:
              f0 = f0_normalizer(f0, speaker)
          tol = 5 * f0_code_ratio
          f0 = align_f0_to_durations(f0, durations, f0_code_ratio, tol)
          if f0_quantizer:
              f0 = f0_quantizer(f0)
      else:
          f0 = None
  
      return units, durations, f0, dense_features
  
file_path: textlesslib/textless/data/speech_encoder.py
imports: import torch
  import torch.nn
  import torchaudio
  from typing import Optional, Callable, Dict
  from textless import dispatch_dense_model, dispatch_quantizer
  from textless import dispatch_dense_model
  from textless.data.f0_preprocess import get_f0, align_f0_to_durations, F0_FRAME_SPACE
  from .collater_utils import wrap_bos_eos
label_desc: Use image node_id 1 for calling a global function with example usage: get_streams(waveform, speaker, dense_model, quantizer_model, f0_normalizer, f0_quantizer, need_f0, deduplicate, f0_code_ratio) and returns: units,  durations,  f0,  dense_features