Skip to content

Commit

Permalink
fix nlp benchmark
Browse files Browse the repository at this point in the history
Signed-off-by: Kaihui-intel <[email protected]>
  • Loading branch information
Kaihui-intel committed Jul 29, 2024
1 parent 61d9325 commit c760cf1
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,10 @@ def get_example_inputs(tokenizer):
prepare_model(*example_inputs)
# convert
converted_model = convert(prepare_model)
# inference
from torch._inductor import config

config.freezing = True
opt_model = torch.compile(converted_model)

opt_model.config = user_model.config # for lm eval
user_model = opt_model


# save
if args.output_dir:
user_model.save(example_inputs=example_inputs, output_dir = args.output_dir)
converted_model.save(example_inputs=example_inputs, output_dir = args.output_dir)



Expand All @@ -112,7 +104,15 @@ def get_example_inputs(tokenizer):
model = load(args.output_dir)

model.config = user_model.config # for lm eval
user_model = model

# Compile the quantized model and replace the Q/DQ pattern with Q-operator
from torch._inductor import config

config.freezing = True
opt_model = torch.compile(model)

opt_model.config = user_model.config # for lm eval
user_model = opt_model

if args.accuracy:

Expand Down

0 comments on commit c760cf1

Please sign in to comment.