@@ -93,11 +93,11 @@ def measure(self) -> None:
9393 device = self .device_
9494
9595 # we measure the torch peak memory usage via allocated_bytes,
96- # rather than `torch.cuda .memory_reserved()` .
97- # After `torch.cuda .reset_peak_memory_stats()`,
98- # `torch.cuda .memory_reserved()` will keep growing, and only shrink
96+ # rather than `torch.accelerator .memory_reserved()` .
97+ # After `torch.accelerator .reset_peak_memory_stats()`,
98+ # `torch.accelerator .memory_reserved()` will keep growing, and only shrink
9999 # when we call `torch.accelerator.empty_cache()` or OOM happens.
100- self .torch_peak = current_platform .memory_stats (device ).get (
100+ self .torch_peak = torch . accelerator .memory_stats (device ).get (
101101 "allocated_bytes.all.peak" , 0
102102 )
103103
@@ -123,10 +123,10 @@ def measure(self) -> None:
123123
124124 self .cuda_memory = self .total_memory - self .free_memory
125125
126- # torch.cuda .memory_reserved() is how many bytes
126+ # torch.accelerator .memory_reserved() is how many bytes
127127 # PyTorch gets from cuda (by calling cudaMalloc, etc.)
128128 # this is used to measure the non-torch memory usage
129- self .torch_memory = current_platform .memory_reserved (device )
129+ self .torch_memory = torch . accelerator .memory_reserved (device )
130130
131131 self .non_torch_memory = self .cuda_memory - self .torch_memory
132132 self .timestamp = time .time ()
@@ -243,15 +243,15 @@ def memory_profiling(
243243 The memory used for loading weights (a.) is directly given from the
244244 argument `weights_memory`.
245245
246- The increase of `torch.cuda .memory_stats()["allocated_bytes.all.peak"]`
246+ The increase of `torch.accelerator .memory_stats()["allocated_bytes.all.peak"]`
247247 during profiling gives (b.).
248248
249249 The increase of `non_torch_memory` from creating the current vLLM instance
250250 until after profiling to get (c.).
251251 """
252252 gc .collect ()
253253 torch .accelerator .empty_cache ()
254- current_platform .reset_peak_memory_stats (baseline_snapshot .device_ )
254+ torch . accelerator .reset_peak_memory_stats (baseline_snapshot .device_ )
255255
256256 result = MemoryProfilingResult (
257257 before_create = baseline_snapshot ,
0 commit comments