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
  whether or not additional KV-storage is needed and allocate it if so.
  
  Args:
      sequence (DSSequenceDescriptor): The sequence for which to allocate KV-storage.
      n_new_tokens (int): The number of new tokens in the sequence.
docstr_tok: ["Given","a","sequence","and","the","number","of","new","tokens","in","the","sequence",",","determine","whether","or","not","additional","KV-storage","is","needed","and","allocate","it","if","so",".","Args",":","sequence","(","DSSequenceDescriptor",")",":","The","sequence","for","which","to","allocate","KV-storage",".","n_new_tokens","(","int",")",":","The","number","of","new","tokens","in","the","sequence","."]
code: def maybe_allocate_kv(
      self, sequence: DSSequenceDescriptor, n_new_tokens: int
  ) -> None:
      """
      Given a sequence and the number of new tokens in the sequence, determine
      whether or not additional KV-storage is needed and allocate it if so.
  
      Args:
          sequence (DSSequenceDescriptor): The sequence for which to allocate KV-storage.
          n_new_tokens (int): The number of new tokens in the sequence.
      """
      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 12 for calling the DSInferenceModelBase obj's underlying member method code with example usage: obj.maybe_allocate_kv(sequence, n_new_tokens) without return types