Skip to content

Commit

Permalink
fix examples(nmt/pfp) evaluation_store typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tianweidut committed Mar 24, 2023
1 parent 35bd7cc commit 694fb18
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ swcli model info ${version}

上面的`build`命令在`starwhale/example/nmt`中执行,也可以在其他目录中执行,但要合理设置 `swcli model eval`命令的`WORKDIR`参数。如果不想每次执行`eval`命令都指定`--runtime`参数,则可以先执行`swcli runtime activate --uri pytorch/version/latest`命令激活当前shell环境,或在一个已经激活Pytorch Runtime环境shell中执行评测。

nmt例子并不是多分类问题,无法使用 `starwhale.multi_classification` 修饰器,Starwhale SDK中也没有提供合适的修饰器自动处理cmp结果。本例中,我们使用 `self.evaluation.log_metrics` 函数,将report的结果存储到Starwhale Datastore中,这样在Standalone Instance 和 Cloud Instance中都能看到相关结果。用户可以使用 `evaluation` SDK上报各种评测结果数据。
nmt例子并不是多分类问题,无法使用 `starwhale.multi_classification` 修饰器,Starwhale SDK中也没有提供合适的修饰器自动处理cmp结果。本例中,我们使用 `self.evaluation_store.log_metrics` 函数,将report的结果存储到Starwhale Datastore中,这样在Standalone Instance 和 Cloud Instance中都能看到相关结果。用户可以使用 `evaluation` SDK上报各种评测结果数据。

cmp中核心代码:

Expand All @@ -105,7 +105,7 @@ def cmp(self, _data_loader):
bleu = calculate_bleu(result, [label])
print(f"bleu: {bleu}")
report = {"bleu_score": bleu}
self.evaluation.log_metrics(report)
self.evaluation_store.log_metrics(report)
```

在Standalone Instance中呈现评测结果:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ swcli model info ${version}

上面的`build`命令在`starwhale/example/PennFudanPed`中执行,也可以在其他目录中执行,但要合理设置 `swcli model eval`命令的`WORKDIR`参数。

PennFudanPed例子是多目标检测问题,无法使用 `starwhale.multi_classification` 修饰器,Starwhale SDK中也没有提供合适的修饰器自动处理cmp结果。本例中,我们使用 `self.evaluation.log_metrics` 函数,将report的结果存储到Starwhale Datastore中,这样在Standalone Instance 和 Cloud Instance中都能看到相关结果。用户可以使用 `evaluation` SDK上报各种评测结果数据。
PennFudanPed例子是多目标检测问题,无法使用 `starwhale.multi_classification` 修饰器,Starwhale SDK中也没有提供合适的修饰器自动处理cmp结果。本例中,我们使用 `self.evaluation_store.log_metrics` 函数,将report的结果存储到Starwhale Datastore中,这样在Standalone Instance 和 Cloud Instance中都能看到相关结果。用户可以使用 `evaluation` SDK上报各种评测结果数据。

cmp中核心代码:

Expand Down Expand Up @@ -214,7 +214,7 @@ def cmp(self, ppl_result):
for _idx, _label in enumerate(detector_metrics_map):
report[_iou][_label] = _stats[_idx]

self.evaluation.log_metrics(report)
self.evaluation_store.log_metrics(report)
```

在Standalone Instance中呈现评测结果:
Expand Down
2 changes: 1 addition & 1 deletion example/PennFudanPed/pfp/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def cmp(self, ppl_result):
for _idx, _label in enumerate(detector_metrics_map):
report[_iou][_label] = _stats[_idx]

self.evaluation.log_metrics(report)
self.evaluation_store.log_metrics(report)

def _load_model(self, device):
net = pretrained_model(
Expand Down
2 changes: 1 addition & 1 deletion example/nmt/nmt/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def cmp(self, _data_loader):
bleu = calculate_bleu(result, [label])
print(f"bleu: {bleu}")
report = {"bleu_score": bleu}
self.evaluation.log_metrics(report)
self.evaluation_store.log_metrics(report)

def _load_vocab(self):
# hack for torch load
Expand Down

0 comments on commit 694fb18

Please sign in to comment.