vllm.v1.sample.logits_processor.state
¶
Classes:
-
BatchUpdateBuilder–Helps track persistent batch state changes and build
-
LogitsProcessors–Encapsulates initialized logitsproc objects.
BatchUpdateBuilder
¶
Helps track persistent batch state changes and build a batch update data structure for logitsprocs Assumptions: * All information about requests removed from persistent batch during a step is aggregated in self._removed through calls to self.removed_append() at the beginning of a step. This must happen before the first time that self.removed, self.pop_removed() or self.peek_removed() are invoked in a given step * After the first time that self.removed, self.pop_removed() or self.peek_removed() are read in a step, no new removals are registered using self.removed_append() * Elements of self._removed are never directly modified, added or removed (i.e. modification is only via self.removed_append() and self.pop_removed()) Guarantees under above assumptions: * self.removed is always sorted in descending order * self.pop_removed() and self.peek_removed() both return the lowest removed request index in the current step
Methods:
-
get_and_reset–Generate a logitsprocs batch update data structure and reset
-
peek_removed–Return lowest removed request index.
-
pop_removed–Pop lowest removed request index.
-
removed_append–Register the removal of a request from the persistent batch.
-
reset–Returns True if there were any changes to the batch.
Attributes:
Source code in vllm/v1/sample/logits_processor/state.py
18 19 20 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
removed
property
¶
Removed request indices sorted in descending order
_ensure_removed_sorted()
¶
Sort removed request indices in descending order. Idempotent after first call in a given step, until reset.
Source code in vllm/v1/sample/logits_processor/state.py
get_and_reset(batch_size)
¶
Generate a logitsprocs batch update data structure and reset internal batch update builder state.
Parameters:
Returns:
-
BatchUpdate | None–Frozen logitsprocs batch update instance;
Noneif no updates
Source code in vllm/v1/sample/logits_processor/state.py
peek_removed()
¶
pop_removed()
¶
removed_append(index)
¶
Register the removal of a request from the persistent batch.
Must not be called after the first time self.removed, self.pop_removed() or self.peek_removed() are invoked.
Parameters:
Source code in vllm/v1/sample/logits_processor/state.py
reset()
¶
Returns True if there were any changes to the batch.
Source code in vllm/v1/sample/logits_processor/state.py
LogitsProcessors
¶
Encapsulates initialized logitsproc objects.
Attributes:
-
all(Iterator[LogitsProcessor]) –Iterator over all logits processors.
Source code in vllm/v1/sample/logits_processor/state.py
all
property
¶
Iterator over all logits processors.