From d359cda5fae1c9a6fe54ba12b940572edfbf87ac Mon Sep 17 00:00:00 2001 From: Woosuk Kwon Date: Sun, 26 Mar 2023 08:00:39 +0000 Subject: [PATCH] Minor --- cacheflow/master/block_manager.py | 6 +++--- cacheflow/models/sample.py | 1 + cacheflow/sequence.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cacheflow/master/block_manager.py b/cacheflow/master/block_manager.py index 6d749b1a44d94..571ee247eedd5 100644 --- a/cacheflow/master/block_manager.py +++ b/cacheflow/master/block_manager.py @@ -7,7 +7,7 @@ from cacheflow.sequence import SequenceStatus from cacheflow.utils import Device -class BlockManager: +class BlockAllocator: def __init__( self, @@ -65,8 +65,8 @@ class BlockSpaceManager: self.num_total_gpu_blocks = num_gpu_blocks self.num_total_cpu_blocks = num_cpu_blocks - self.gpu_allocator = BlockManager(Device.GPU, block_size, num_gpu_blocks) - self.cpu_allocator = BlockManager(Device.CPU, block_size, num_cpu_blocks) + self.gpu_allocator = BlockAllocator(Device.GPU, block_size, num_gpu_blocks) + self.cpu_allocator = BlockAllocator(Device.CPU, block_size, num_cpu_blocks) # Mapping: seq_id -> BlockTable. self.block_tables: Dict[int, BlockTable] = {} diff --git a/cacheflow/models/sample.py b/cacheflow/models/sample.py index 371986a751777..8cbe73365a3f5 100644 --- a/cacheflow/models/sample.py +++ b/cacheflow/models/sample.py @@ -8,6 +8,7 @@ from cacheflow.sampling_params import SamplingParams from cacheflow.sequence import SequenceOutputs from cacheflow.parallel_utils.tensor_parallel import gather_from_tensor_model_parallel_region + class Sampler(nn.Module): def __init__(self) -> None: diff --git a/cacheflow/sequence.py b/cacheflow/sequence.py index 471052fbd5a94..8cdd977237f1e 100644 --- a/cacheflow/sequence.py +++ b/cacheflow/sequence.py @@ -30,7 +30,7 @@ class Sequence: self.status = SequenceStatus.PENDING self.output_logprobs: List[Dict[int, float]] = [] - self.cumulative_logprobs = 1.0 + self.cumulative_logprobs = 0.0 def add_block(self) -> None: block = LogicalTokenBlock(