vllm.v1.sample.tpu.metadata ¶
   DEFAULT_SAMPLING_PARAMS  module-attribute  ¶
 DEFAULT_SAMPLING_PARAMS = dict(
    temperature=-1.0, min_p=0.0, top_k=0, top_p=1.0
)
  TPUSupportedSamplingMetadata  dataclass  ¶
 Source code in vllm/v1/sample/tpu/metadata.py
 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120  |  | 
  _generators  class-attribute instance-attribute  ¶
    logit_bias  class-attribute instance-attribute  ¶
    output_token_ids  class-attribute instance-attribute  ¶
    __init__ ¶
 __init__(
    temperature: Tensor = None,
    min_p: Tensor = None,
    top_k: Tensor = None,
    top_p: Tensor = None,
    all_greedy: bool = True,
    all_random: bool = False,
    logprobs: bool = False,
    no_penalties: bool = True,
    output_token_ids: list[list[int]] = (lambda: list())(),
    logit_bias: list[dict[int, float] | None] = (
        lambda: list()
    )(),
    _generators: dict[int, Generator] = (lambda: dict())(),
) -> None
  from_input_batch  classmethod  ¶
 from_input_batch(
    input_batch: InputBatch,
    padded_num_reqs: int,
    xla_device: device,
    generate_params_if_all_greedy: bool = False,
) -> TPUSupportedSamplingMetadata
Copy sampling tensors slices from input_batch to on device tensors.
InputBatch._make_sampling_metadata causes recompilation on XLA as it slices dynamic shapes on device tensors. This impl moves the dynamic ops to CPU and produces tensors of fixed padded_num_reqs size.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
 input_batch  |   InputBatch  |    The input batch containing sampling parameters.  |  required | 
 padded_num_reqs  |   int  |    The padded number of requests.  |  required | 
 xla_device  |   device  |    The XLA device.  |  required | 
 generate_params_if_all_greedy  |   bool  |    If True, generate sampling parameters even if all requests are greedy. this is useful for cases where we want to pre-compile a graph with sampling parameters, even if they are not strictly needed for greedy decoding.  |   False  |