Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 0 additions & 15 deletions tests/post_training/pipelines/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ class RunInfo:
time_compression: Optional[float] = None
num_compress_nodes: Optional[NumCompressNodes] = None
stats_from_output = StatsFromOutput()
fp32_model_size: Optional[float] = None
int8_model_size: Optional[float] = None

@staticmethod
def format_time(time_elapsed):
Expand Down Expand Up @@ -214,9 +212,6 @@ def get_result_dict(self) -> dict[str, str]:
"Metric name": self.metric_name,
"Metric value": self.metric_value,
"Metric diff": self.metric_diff,
"Model size Mb (FP32)": self.fp32_model_size,
"Model size Mb (INT8)": self.int8_model_size,
"Compression rate:": self.fp32_model_size / self.int8_model_size,
**self.num_compress_nodes.get_data(),
"Compr. time": self.format_time(self.time_compression),
**self.stats_from_output.get_stats(),
Expand All @@ -229,15 +224,6 @@ def get_result_dict(self) -> dict[str, str]:
return result


def get_model_size(path: Path, m_type: str = "Mb") -> float:
model_size = path.stat().st_size
for t in ["bytes", "Kb", "Mb"]:
if m_type == t:
break
model_size /= 1024
return model_size


class BaseTestPipeline(ABC):
"""
Base class to test compression algorithms.
Expand Down Expand Up @@ -548,7 +534,6 @@ def save_compressed_model(self) -> None:
elif self.backend == BackendType.ONNX:
onnx_path = self.output_model_dir / "model.onnx"
onnx.save(self.compressed_model, str(onnx_path))
self.run_info.int8_model_size = get_model_size(onnx_path)
ov_model = ov.convert_model(onnx_path)
ov.serialize(ov_model, self.path_compressed_ir)
elif self.backend in OV_BACKENDS:
Expand Down
2 changes: 0 additions & 2 deletions tests/post_training/pipelines/image_classification_timm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from tests.post_training.pipelines.base import OV_BACKENDS
from tests.post_training.pipelines.base import PT_BACKENDS
from tests.post_training.pipelines.base import BackendType
from tests.post_training.pipelines.base import get_model_size
from tests.post_training.pipelines.image_classification_base import ImageClassificationBase

# Disable using aten::scaled_dot_product_attention
Expand Down Expand Up @@ -51,7 +50,6 @@ def prepare_model(self) -> None:
torch.onnx.export(
timm_model, self.dummy_tensor, onnx_path, export_params=True, opset_version=13, **additional_kwargs
)
self.run_info.fp32_model_size = get_model_size(onnx_path)
self.model = onnx.load(onnx_path)
self.input_name = self.model.graph.input[0].name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from tests.post_training.pipelines.base import FX_BACKENDS
from tests.post_training.pipelines.base import PT_BACKENDS
from tests.post_training.pipelines.base import BackendType
from tests.post_training.pipelines.base import get_model_size
from tests.post_training.pipelines.image_classification_base import ImageClassificationBase


Expand Down Expand Up @@ -98,7 +97,6 @@ def prepare_model(self) -> None:
torch.onnx.export(
model, self.dummy_tensor, onnx_path, export_params=True, opset_version=13, **additional_kwargs
)
self.run_info.fp32_model_size = get_model_size(onnx_path)
self.model = onnx.load(onnx_path)
self.input_name = self.model.graph.input[0].name

Expand Down