Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .ci/scripts/test_huggingface_optimum_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def test_vit(model_id, model_dir, recipe, *, quantize=False, run_only=False):
parser.add_argument("--model", type=str, required=True)
parser.add_argument("--recipe", type=str, required=True)
parser.add_argument("--quantize", action="store_true", help="Enable quantization")
parser.add_argument("--model_dir", type=str, required=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit add help?

args = parser.parse_args()

model_to_model_id_and_test_function = {
Expand All @@ -294,11 +295,20 @@ def test_vit(model_id, model_dir, recipe, *, quantize=False, run_only=False):
f"Unknown model name: {args.model}. Available models: {model_to_model_id_and_test_function.keys()}"
)

with tempfile.TemporaryDirectory() as tmp_dir:
model_id, test_fn = model_to_model_id_and_test_function[args.model]
model_id, test_fn = model_to_model_id_and_test_function[args.model]
if args.model_dir is None:
with tempfile.TemporaryDirectory() as tmp_dir:
test_fn(
model_id=model_id,
model_dir=tmp_dir,
recipe=args.recipe,
quantize=args.quantize,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

de-dup across if/else

)
else:
test_fn(
model_id=model_id,
model_dir=tmp_dir,
model_dir=args.model_dir,
recipe=args.recipe,
quantize=args.quantize,
run_only=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this depend on the model_dir type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, I'll remove it

)
Loading