Skip to content

Commit

Permalink
add mixed_precision argument on ppl wikitext evaluation (#11813)
Browse files Browse the repository at this point in the history
* fix: delete ipex extension import in ppl wikitext evaluation

* feat: add mixed_precision argument on ppl wikitext evaluation

* fix: delete mix_precision command in perplex evaluation for wikitext

* fix: remove fp16 mixed-presicion argument

* fix: Add a space.

---------

Co-authored-by: Jinhe Tang <[email protected]>
  • Loading branch information
cranechu0131 and JinheTang authored Aug 15, 2024
1 parent 828ab16 commit 28d1c97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/llm/dev/benchmark/perplexity/run_wikitext.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import argparse
import torch
from tqdm import tqdm
from datasets import concatenate_datasets, load_dataset
from datasets import load_dataset
from ipex_llm.utils.common import invalidInputError


Expand All @@ -34,6 +34,7 @@
parser.add_argument("--precision", type=str, default="sym_int4")
parser.add_argument("--use-cache", action="store_true")
parser.add_argument("--max_length", type=int, default=None)
parser.add_argument("--mixed_precision", action="store_true")
args = parser.parse_args()

if args.precision == "fp16": # ipex fp16
Expand All @@ -43,7 +44,7 @@
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)
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()
Expand Down

0 comments on commit 28d1c97

Please sign in to comment.