[Hardware] Replace torch.cuda.empty_cache with torch.accelerator.empty_cache (#30681)
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com> Signed-off-by: Kunshang Ji <jikunshang95@gmail.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
co-authored by
Harry Mellor
parent
5dc3538736
commit
16d2ad1d38
@@ -1916,14 +1916,14 @@ def cleanup_dist_env_and_memory(shutdown_ray: bool = False):
|
||||
gc.collect()
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
empty_cache = current_platform.empty_cache
|
||||
if empty_cache is not None:
|
||||
empty_cache()
|
||||
try:
|
||||
if not current_platform.is_cpu():
|
||||
if not current_platform.is_cpu():
|
||||
torch.accelerator.empty_cache()
|
||||
try:
|
||||
torch._C._host_emptyCache()
|
||||
except AttributeError:
|
||||
logger.warning("torch._C._host_emptyCache() only available in Pytorch >=2.5")
|
||||
except AttributeError:
|
||||
logger.warning(
|
||||
"torch._C._host_emptyCache() only available in Pytorch >=2.5"
|
||||
)
|
||||
|
||||
|
||||
def in_the_same_node_as(
|
||||
|
||||
Reference in New Issue
Block a user