diff --git a/python/llm/dev/benchmark/perplexity/run_wikitext.py b/python/llm/dev/benchmark/perplexity/run_wikitext.py index 92426a86..061c87ba 100644 --- a/python/llm/dev/benchmark/perplexity/run_wikitext.py +++ b/python/llm/dev/benchmark/perplexity/run_wikitext.py @@ -38,12 +38,24 @@ args = parser.parse_args() if args.precision == "fp16": # ipex fp16 from transformers import AutoModelForCausalLM - model = AutoModelForCausalLM.from_pretrained(args.model_path, use_cache=args.use_cache, trust_remote_code=True) + model = AutoModelForCausalLM.from_pretrained(args.model_path, + use_cache=args.use_cache, + trust_remote_code=True) model = model.half() +elif 'gptq' in args.model_path.lower(): # ipex-llm gptq + from ipex_llm.transformers import AutoModelForCausalLM + model = AutoModelForCausalLM.from_pretrained(args.model_path, + load_in_4bit=True, + torch_dtype=torch.float, + use_cache=args.use_cache, + trust_remote_code=True) else: # ipex-llm from ipex_llm.transformers import AutoModelForCausalLM - model = AutoModelForCausalLM.from_pretrained(args.model_path, load_in_low_bit=args.precision, - use_cache=args.use_cache, trust_remote_code=True, mixed_precision= args.mixed_precision) + model = AutoModelForCausalLM.from_pretrained(args.model_path, + load_in_low_bit=args.precision, + use_cache=args.use_cache, + trust_remote_code=True, + mixed_precision=args.mixed_precision) model = model.half() model = model.to(args.device) model = model.eval()