code: def _is_sequence_finished(unfinished_sequences: torch.Tensor) -> bool:
      if dist.is_initialized() and dist.get_world_size() > 1:
          # consider DP
          unfinished_sequences = unfinished_sequences.clone()
          dist.all_reduce(unfinished_sequences)
      return unfinished_sequences.max() == 0
  
file_path: ColossalAI/applications/Chat/coati/models/generation.py
imports: from typing import Any, Callable, Optional
  import torch
  import torch.distributed
  from transformers import PreTrainedTokenizer
  from .base import Actor
label_desc: Use image node_id 2 for calling a global function with example usage: _is_sequence_finished(unfinished_sequences) and returns: unknown