Skip to content

Commit

Permalink
fix 3.x IPEX examples failed with evaluate (#1816)
Browse files Browse the repository at this point in the history
Signed-off-by: Cheng, Zixuan <[email protected]>
  • Loading branch information
violetch24 authored May 27, 2024
1 parent 54f039d commit e82674a
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import datasets
from torch.nn.functional import pad
from torch.utils.data import DataLoader
from transformers import AutoModelForCausalLM, AutoModel, AutoTokenizer
from transformers import AutoModelForCausalLM, AutoConfig, AutoTokenizer

parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -377,7 +377,9 @@ def run_fn(model):

from neural_compressor.torch.quantization import load
tokenizer = AutoTokenizer.from_pretrained(args.model)
config = AutoConfig.from_pretrained(args.model)
user_model = load(os.path.abspath(os.path.expanduser(args.output_dir)))
setattr(user_model, "config", config)
else:
user_model, tokenizer = get_user_model()

Expand Down

0 comments on commit e82674a

Please sign in to comment.