class_docstr: A worker class that executes (a partition of) the model on a GPU.
  
  Each worker is associated with a single GPU. The worker is responsible for
  maintaining the KV cache and executing the model on the GPU. In case of
  distributed inference, each worker is assigned a partition of the model.
code: def __init__(
      self,
      model_config: ModelConfig,
      # parallel_config: ParallelConfig,
      scheduler_config: SchedulerConfig,
      rank: Optional[int] = None,
      # distributed_init_method: Optional[str] = None,
      kv_cache: Optional[Dict] = None,
  ) -> None:
      self.model_config = model_config
      # self.parallel_config = parallel_config
      self.scheduler_config = scheduler_config
      self.rank = rank
      # self.distributed_init_method = distributed_init_method
  
      # Uninitialized cache engine. Will be initialized by
      # self.init_cache_engine().
      self.cache_config = None
      self.block_size = None
      self.sliding_window = None
      self.cache_engine = None
      self.cache_events = None
      self.gpu_cache = None
  
      self.kv_cache = kv_cache
  
imports: import os
  from typing import Dict, List, Tuple, Optional
  import torch
  import torch.distributed
  import warnings
  import numpy
  import random
  from bigdl.llm.vllm.config import ModelConfig, SchedulerConfig
  from bigdl.llm.vllm.model_executor.model_loader import get_model
  from bigdl.llm.vllm.model_executor.input_metadata import InputMetadata
  from bigdl.llm.vllm.sampling_params import SamplingParams
  from bigdl.llm.vllm.sequence import SequenceData, SamplerOutput, SequenceGroupMetadata
  from bigdl.llm.utils.common import invalidInputError
  from bigdl.llm.vllm.model_executor.utils import set_random_seed
label_desc: Use image node_id 1 to create a new Worker object  with example: obj = Worker(model_config, scheduler_config, rank, kv_cache)