Skip to content

Commit

Permalink
remove phi3 empty cache (intel#10997)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored May 13, 2024
1 parent 99255fe commit 1b3c7a6
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions python/llm/src/ipex_llm/transformers/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,6 @@ def is_linear_module(module):
return result, (in_features, out_features, mp_group)


def empty_cache_post(module, input, output):
try:
torch.xpu.empty_cache()
except: # cpu
pass


def convert_gptq(module, awq=False, llm_awq=False, act_order=False):
from ipex_llm.transformers.low_bit_linear import get_block_size
Q4_1 = get_block_size("asym_int4")
Expand Down Expand Up @@ -1524,8 +1517,6 @@ def safe_bmm_fwd(*args, **kwargs):
from ipex_llm.transformers.models.phi3 import model_forward_wrapper
model_forward = model_forward_wrapper(module.Phi3Model.forward)
convert_forward(model, module.Phi3Model, model_forward)
# Empty cache after the first attention to run long context.
model.model.layers[0].self_attn.register_forward_hook(empty_cache_post)
elif model.config.model_type == 'yuan':
modeling_module_name = model.__class__.__module__
module = importlib.import_module(modeling_module_name)
Expand Down

0 comments on commit 1b3c7a6

Please sign in to comment.