Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
export command broken by missing metric_reporters (#271)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #271

Removed an if by mistake in D13829608

Reviewed By: bethebunny

Differential Revision: D13978522

fbshipit-source-id: 1adbdade1f5ca1241c15c9c3300e4a7163370be7
  • Loading branch information
Titousensei authored and facebook-github-bot committed Feb 6, 2019
1 parent f5af675 commit 10ec6b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pytext/task/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def test(self, test_path):
test_iter = self.data_handler.get_test_iter()
return self.trainer.test(test_iter, self.model, self.metric_reporter)

def export(self, model, export_path, metric_channels, export_onnx_path=None):
def export(self, model, export_path, metric_channels=None, export_onnx_path=None):
"""
Wrapper method to export PyTorch model to Caffe2 model using :class:`~Exporter`.
Expand All @@ -191,8 +191,9 @@ def export(self, model, export_path, metric_channels, export_onnx_path=None):
cuda_utils.CUDA_ENABLED = False
model = model.cpu()
if self.exporter:
print("Exporting metrics")
self.exporter.export_to_metrics(model, metric_channels)
if metric_channels:
print("Exporting metrics")
self.exporter.export_to_metrics(model, metric_channels)
print("Saving caffe2 model to: " + export_path)
self.exporter.export_to_caffe2(model, export_path, export_onnx_path)

Expand Down

0 comments on commit 10ec6b5

Please sign in to comment.