class_docstr: Implementation of a model for inference composable with ragged batching.
class_docstr_tok: ["Implementation","of","a","model","for","inference","composable","with","ragged","batching","."]
docstr: Given a sequence and the number of new tokens in the sequence, determine the
  number of new KV blocks needed to support the sequence. This method is
  used to help the engine provide schedulability APIs and can be used as a helper
  for ``maybe_allocate_kv``.
  
  Args:
      sequence (DSSequenceDescriptor): The sequence for which to allocate KV-storage.
      max_new_tokens (int): Maximum number of tokens to hypothetically schedule.
      max_new_blocks (int): Maximum number of blocks to hypothetically allocate.
  
  Returns:
      Tuple[int, torch.Tensor]: The tuple of number of tokens scheduled and number
          of blocks allocated (per KV cache). In general, only one of these numbers will
          match the corresponding input argument, but this is not guaranteed.
docstr_tok: ["Given","a","sequence","and","the","number","of","new","tokens","in","the","sequence",",","determine","the","number","of","new","KV","blocks","needed","to","support","the","sequence",".","This","method","is","used","to","help","the","engine","provide","schedulability","APIs","and","can","be","used","as","a","helper","for","``","maybe_allocate_kv","``",".","Args",":","sequence","(","DSSequenceDescriptor",")",":","The","sequence","for","which","to","allocate","KV-storage",".","max_new_tokens","(","int",")",":","Maximum","number","of","tokens","to","hypothetically","schedule",".","max_new_blocks","(","int",")",":","Maximum","number","of","blocks","to","hypothetically","allocate",".","Returns",":","Tuple","[","int",",","torch.Tensor","]",":","The","tuple","of","number","of","tokens","scheduled","and","number","of","blocks","allocated","(","per","KV","cache",")",".","In","general",",","only","one","of","these","numbers","will","match","the","corresponding","input","argument",",","but","this","is","not","guaranteed","."]
code: def get_kv_requirements(
      self,
      sequence: DSSequenceDescriptor,
      max_new_tokens: int,
      max_new_blocks: Tuple[int, ...],
  ) -> Tuple[int, torch.Tensor]:
      """
      Given a sequence and the number of new tokens in the sequence, determine the
      number of new KV blocks needed to support the sequence. This method is
      used to help the engine provide schedulability APIs and can be used as a helper
      for ``maybe_allocate_kv``.
  
      Args:
          sequence (DSSequenceDescriptor): The sequence for which to allocate KV-storage.
          max_new_tokens (int): Maximum number of tokens to hypothetically schedule.
          max_new_blocks (int): Maximum number of blocks to hypothetically allocate.
  
      Returns:
          Tuple[int, torch.Tensor]: The tuple of number of tokens scheduled and number
              of blocks allocated (per KV cache). In general, only one of these numbers will
              match the corresponding input argument, but this is not guaranteed.
      """
      raise NotImplementedError()
  
imports: from abc import ABC, abstractmethod
  from typing import Iterable, Optional, Tuple, Type
  import torch
  import deepspeed.comm
  from ..ragged import DSStateManager, RaggedBatchWrapper
  from ..ragged.manager_configs import KVCacheConfig
  from ..ragged import DSSequenceDescriptor
  from ..model_implementations.layer_container_base import LayerContainer
  from ..config_v2 import RaggedInferenceEngineConfig
  from .flat_model_helpers import ModelMetadata
label_desc: Use image node_id 11 for calling the DSInferenceModelBase obj's underlying member method code with example usage: obj.get_kv_requirements(sequence, max_new_tokens, max_new_blocks) without return types