MCPcopy Create free account
hub / github.com/MLSysU/TD-Pipe / __init__

Method __init__

TD_Pipe/sequence.py:111–137  ·  view source on GitHub ↗
(
        self,
        seq_id: int,
        prompt: str,
        prompt_token_ids: List[int],
        block_size: int,
        predict_output_len: int = 0,
    )

Source from the content-addressed store, hash-verified

109 """
110
111 def __init__(
112 self,
113 seq_id: int,
114 prompt: str,
115 prompt_token_ids: List[int],
116 block_size: int,
117 predict_output_len: int = 0,
118 ) -> None:
119 self.seq_id = seq_id
120 self.prompt = prompt
121 self.block_size = block_size
122
123 self.data = SequenceData(prompt_token_ids)
124 self.output_logprobs: SampleLogprobs = []
125 self.output_text = ""
126
127 self.logical_token_blocks: List[LogicalTokenBlock] = []
128 # Initialize the logical token blocks with the prompt token ids.
129 self._append_tokens_to_blocks(prompt_token_ids)
130 self.status = SequenceStatus.WAITING
131
132 # Used for incremental detokenization
133 self.prefix_offset = 0
134 self.read_offset = 0
135 # Input + output tokens
136 self.tokens: Optional[List[str]] = None
137 self.predict_output_len = predict_output_len
138
139 def _append_logical_block(self) -> None:
140 block = LogicalTokenBlock(

Callers

nothing calls this directly

Calls 2

SequenceDataClass · 0.85

Tested by

no test coverage detected