Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
plusbang committed Dec 2, 2024
1 parent ae24f5e commit 1397294
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/llm/src/ipex_llm/transformers/npu_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,18 @@ def load_low_bit(cls, pretrained_model_name_or_path: str, *model_args, **kwargs)
if enable_cpp_backend:
from .npu_models.npu_llm_cpp import load_model_from_file
from .npu_models.convert import generate
import json
dummy_model = torch.nn.Module()
try:
model_ptr = load_model_from_file(pretrained_model_name_or_path)
dummy_model.config = PretrainedConfig.from_dict(config_dict)
dummy_model.model_ptr = model_ptr
dummy_model.save_directory = pretrained_model_name_or_path
dummy_model.kv_len = config_dict['kv_len']
dummy_model.vocab_size = config_dict['vocab_size']
except:
invalidInputError(False,
"False to InitLLMPipeline.")
dummy_model.eval()
# patch generate function
import types
dummy_model.generate = types.MethodType(generate, dummy_model)
Expand Down

0 comments on commit 1397294

Please sign in to comment.