Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
plusbang committed Aug 23, 2024
1 parent 4dc044b commit 147f163
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
1 change: 1 addition & 0 deletions python/llm/src/ipex_llm/transformers/npu_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ def from_pretrained(cls, *args, **kwargs):
),
)
from ipex_llm.transformers.npu_models.convert_mp import optimize_llm

with torch.no_grad():
cls.load_convert(qtype, model, "cpu", *args, **kwargs)
create_npu_kernels(model)
Expand Down
7 changes: 0 additions & 7 deletions python/llm/src/ipex_llm/transformers/npu_models/convert_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ def convert_forward(m, target_m, new_forward):
convert_forward(sub_m, target_m, new_forward)


def optimize_llm_pre(model: torch.nn.Module):
if model.config.model_type == "qwen2" and model.config.intermediate_size == 18944:
# for qwen2-7B
from ipex_llm.transformers.npu_models.qwen2_mp import split_mlp
model.apply(split_mlp)


def optimize_llm(
model: torch.nn.Module,
max_output_len=1024,
Expand Down
3 changes: 1 addition & 2 deletions python/llm/src/ipex_llm/transformers/npu_models/qwen2_mp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from transformers.modeling_outputs import BaseModelOutputWithPast
from ipex_llm.transformers.npu_models.mp_models_base import run_model
from ipex_llm.transformers.npu_models.mp_models_base import LLMBaseNNFactory
from ipex_llm.transformers.npu_models.common import reshape_lm_head_input
from transformers.modeling_outputs import CausalLMOutputWithPast
from torch.nn import CrossEntropyLoss

Expand Down Expand Up @@ -198,7 +197,7 @@ def __init__(
new_value_states = self.convert_to_fp16(curr_key_values[i][1])

self.compile()

def build_decoder(
self,
hidden_states,
Expand Down

0 comments on commit 147f163

Please sign in to comment.