gr2 / fix_shape.py
light_shirt
Deploy Qwen3-Embedding-0.6B INT8 OpenVINO
f687b59
Raw History Blame Contribute Delete
478 Bytes
# fix_shape.py
from openvino import Core, save_model
import sys
model_path = sys.argv[1] # 输入模型路径
output_path = sys.argv[2] if len(sys.argv) > 2 else model_path
core = Core()
model = core.read_model(model_path)
# 重设形状为固定 [1, 512]
model.reshape({
"input_ids": [1, 512],
"attention_mask": [1, 512],
"token_type_ids": [1, 512],
})
save_model(model, output_path, compress_to_fp16=False)
print(f"Fixed-shape model saved to: {output_path}")