[Misc] Replace cuda hard code with current_platform (#16983)

Signed-off-by: shen-shanshan <467638484@qq.com>
This commit is contained in:
Shanshan Shen
2025-05-23 04:38:50 +00:00
committed by GitHub
parent 4be2255c81
commit 9c1baa5bc6
3 changed files with 11 additions and 7 deletions
+3 -2
View File
@@ -1221,8 +1221,9 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
ray.shutdown()
gc.collect()
from vllm.platforms import current_platform
if not current_platform.is_cpu():
torch.cuda.empty_cache()
empty_cache = current_platform.empty_cache
if empty_cache is not None:
empty_cache()
try:
torch._C._host_emptyCache()
except AttributeError: