Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nncf model export bug #1346

Merged
merged 2 commits into from
Nov 8, 2022
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
Prev Previous commit
Use public method for model_info
  • Loading branch information
Ashwin Vaidya committed Nov 8, 2022

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
commit 3dae12fdcbc11452ae2c454ee78c53f2e9698e38
4 changes: 2 additions & 2 deletions external/anomaly/tasks/inference.py
Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ def export(self, export_type: ExportType, output_model: ModelEntity) -> None:
output_model.set_data("label_schema.json", label_schema_to_bytes(self.task_environment.label_schema))
self._set_metadata(output_model)

def _model_info(self) -> Dict:
def model_info(self) -> Dict:
"""Return model info to save the model weights.

Returns:
@@ -282,7 +282,7 @@ def save_model(self, output_model: ModelEntity) -> None:
output_model (ModelEntity): Output model onto which the weights are saved.
"""
logger.info("Saving the model weights.")
model_info = self._model_info()
model_info = self.model_info()
buffer = io.BytesIO()
torch.save(model_info, buffer)
output_model.set_data("weights.pth", buffer.getvalue())
2 changes: 1 addition & 1 deletion external/anomaly/tasks/nncf.py
Original file line number Diff line number Diff line change
@@ -201,7 +201,7 @@ def optimize(

logger.info("Training completed.")

def _model_info(self) -> Dict:
def model_info(self) -> Dict:
"""Return model info to save the model weights.

Returns: