[NPU] fix conflict between empty_cache and use_mem_pool (#21507)
This commit is contained in:
@@ -1108,6 +1108,10 @@ class ModelRunner(ModelRunnerKVCacheMixin):
|
||||
self.remote_instance_transfer_engine_weight_info = (
|
||||
self.loader.remote_instance_transfer_engine_weight_info
|
||||
)
|
||||
# Cache needs to be cleared after loading model weights (in the self.loader.load_model function).
|
||||
# To avoid conflict with memory_saver_adapter.region, empty_cache operation is now moved here.
|
||||
if _is_npu:
|
||||
torch.npu.empty_cache()
|
||||
monkey_patch_vllm_parallel_state(reverse=True)
|
||||
|
||||
# Publish metadata to ModelExpress if running as seed source
|
||||
|
||||
@@ -707,8 +707,6 @@ class DefaultModelLoader(BaseModelLoader):
|
||||
# parameters onto device for processing and back off after.
|
||||
with device_loading_context(module, target_device):
|
||||
quant_method.process_weights_after_loading(module)
|
||||
if _is_npu:
|
||||
torch.npu.empty_cache()
|
||||
|
||||
|
||||
class LayeredModelLoader(DefaultModelLoader):
|
||||
|
||||
@@ -365,7 +365,7 @@ def get_int_env_var(name: str, default: int = 0) -> int:
|
||||
|
||||
|
||||
def support_triton(backend: str) -> bool:
|
||||
return backend not in ["torch_native", "intel_amx"]
|
||||
return backend not in ["torch_native", "intel_amx", "ascend"]
|
||||
|
||||
|
||||
_ENABLE_TORCH_INFERENCE_MODE = get_bool_env_var(
|
||||
|
||||
Reference in New Issue
Block a user