Fix the TypeError issue in quantize.py (#19459)

### Description
<!-- Describe your changes. -->
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
Fix related bug as described in
https://github.com/microsoft/onnxruntime/issues/19430
This commit is contained in:
duanshengliu 2024-02-27 12:56:32 +08:00 committed by GitHub
parent 5bb58a10e7
commit 9e19684944
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -479,7 +479,7 @@ def quantize_static(
del dataloader
model = sq.transform(extra_options.get("SmoothQuantAlpha", 0.5), extra_options.get("SmoothQuantFolding", True))
sq_path = tempfile.TemporaryDirectory(prefix="ort.quant.")
model_input = Path(sq_path).joinpath("sq_model.onnx").as_posix()
model_input = Path(sq_path.name).joinpath("sq_model.onnx").as_posix()
model.save(model_input)
nodes_to_exclude.extend([i.name for i in model.model.graph.node if i.name not in orig_nodes])
model = load_model_with_shape_infer(Path(model_input)) # use smooth quant model for calibration