Skip to content

Commit

Permalink
Modify gptq example logic (#1545)
Browse files Browse the repository at this point in the history
Signed-off-by: YIYANGCAI <yiyang.cai@intel.com>
  • Loading branch information
YIYANGCAI authored Jan 17, 2024
1 parent 2835bdb commit e951e7a
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,17 @@ def eval_func(model):
if args.ipex:
user_model = load(os.path.abspath(os.path.expanduser(args.output_dir)))
else:
user_model, _ = get_user_model()
kwargs = {'weight_only': True} if args.approach == 'weight_only' else {}
user_model = load(os.path.abspath(os.path.expanduser(args.output_dir)), user_model, **kwargs)
if args.gptq_debug:
user_model = torch.load(os.path.join(args.output_dir, "gptq_best_model.pt"))
else:
user_model, _ = get_user_model()
kwargs = {'weight_only': True} if args.approach == 'weight_only' else {}
user_model = load(os.path.abspath(os.path.expanduser(args.output_dir)), user_model, **kwargs)
else:
user_model, _ = get_user_model()

if args.accuracy:
user_model.eval()
if args.gptq_debug:
user_model = torch.load(os.path.join(args.output_dir, "gptq_best_model.pt"))
if args.code_generation:
from intel_extension_for_transformers.llm.evaluation.lm_code_eval import evaluate
from transformers import AutoTokenizer
Expand Down

0 comments on commit e951e7a

Please sign in to comment.