Skip to content

Commit

Permalink
Fix tile PTQ releaes 2.0.0 (#3282)
Browse files Browse the repository at this point in the history
* Fix tile PTQ optimization
  • Loading branch information
eugene123tw authored Apr 8, 2024
1 parent 7dfda8f commit 4ecb2a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/otx/core/model/entity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def transform_fn(self, data_batch: T_OTXBatchDataEntity) -> np.array:
model = self.model.model if isinstance(self.model, Tiler) else self.model
resized_image = model.resize(image, (model.w, model.h))
resized_image = model.input_transform(resized_image)
return self.model._change_layout(resized_image) # noqa: SLF001
return model._change_layout(resized_image) # noqa: SLF001

def _read_ptq_config_from_ir(self, ov_model: Model) -> dict[str, Any]:
"""Generates the PTQ (Post-Training Quantization) configuration from the meta data of the given OpenVINO model.
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/api/test_engine_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,7 @@ def test_engine_from_tile_recipe(
assert isinstance(ov_model.model, Tiler), "Model should be an instance of Tiler"
assert engine.datamodule.config.tile_config.tile_size[0] == ov_model.model.tile_size
assert engine.datamodule.config.tile_config.overlap == ov_model.model.tiles_overlap

# Test PTQ optimization with IR Model
optimized_model = engine.optimize(checkpoint=exported_model_path)
assert optimized_model.exists()

0 comments on commit 4ecb2a1

Please sign in to comment.