From dd26cf3a34b159e6ad384403608aed17f436f3c6 Mon Sep 17 00:00:00 2001 From: chenxuyi Date: Mon, 28 Oct 2019 14:42:36 +0800 Subject: [PATCH] update propeller --- propeller/README.en.md | 9 ++++----- propeller/README.md | 9 ++++----- propeller/paddle/train/metrics.py | 6 ++++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/propeller/README.en.md b/propeller/README.en.md index 8ced3b6..a8b9767 100644 --- a/propeller/README.en.md +++ b/propeller/README.en.md @@ -21,7 +21,7 @@ Propeller provide the following benefits: ## install ```script -cd propeller && pip install . +pip install --user . ``` ## Getting Started @@ -71,7 +71,6 @@ cd propeller && pip install . # Start training! propeller.train_and_eval(BowModel, hparams, run_config, train_ds, eval_ds) ``` -More detail see example/toy/ ## Main Feature 1. train_and_eval @@ -91,9 +90,9 @@ More detail see example/toy/ 4. Summary To trace tensor histogram in training, simply: - ```python - propeller.summary.histogram('loss', tensor) - ``` +```python + propeller.summary.histogram('loss', tensor) +``` ## Contributing diff --git a/propeller/README.md b/propeller/README.md index 8e1bb38..004edad 100644 --- a/propeller/README.md +++ b/propeller/README.md @@ -21,7 +21,7 @@ Propeller 具有下列优势: ## install|安装 -cd propeller && pip install . +pip install --user . ## Getting Started|快速开始 ```python @@ -70,7 +70,6 @@ cd propeller && pip install . # 开始训练! propeller.train_and_eval(BowModel, hparams, run_config, train_ds, eval_ds) ``` -先洗详细请见example/toy/ ## 主要构件 1. train_and_eval @@ -89,10 +88,10 @@ cd propeller && pip install . 4. Summary 对训练过程中的某些参数进行log追踪,只需要: - ```python - propeller.summary.histogram('loss', tensor) +```python + propeller.summary.histogram('loss', tensor) - ``` +``` ## Contributing|贡献 diff --git a/propeller/paddle/train/metrics.py b/propeller/paddle/train/metrics.py index 3d14659..df5ce8e 100644 --- a/propeller/paddle/train/metrics.py +++ b/propeller/paddle/train/metrics.py @@ -256,8 +256,10 @@ class Mrr(Metrics): sorted( tup, key=lambda t: t[2], reverse=True)) if l != 0 ] - ranks = ranks[0] - return ranks + if len(ranks): + return ranks[0] + else: + return 0. mrr_for_qid = [ calc_func(tup) -- GitLab