Conversation
|
Two problems I have encountered:
|
python/paddle/fluid/trainer.py
Outdated
| accumulated_loss += loss[0] | ||
| count += 1 | ||
|
|
||
| return accumulated_loss / count |
There was a problem hiding this comment.
Should we return Accuracy as well?
|
Based on our discussion, we define the 1st element in the returned tuple as (loss, accuracy, f1_score, ...) |
|
After a discussion with @wangkuiyi and @daming-lu , we have reached two conclusions:
|
| order in program | ||
| """ | ||
|
|
||
| return self._test_by_executor(reader, feed_order, self.test_outputs) |
There was a problem hiding this comment.
Why put all code into a separate function?
There was a problem hiding this comment.
Maybe in the future, we need to support _test_by_parralle_executor. Here is a reserved interface for switching between multiple executors.
| # The declaration of 'next_word' must be after the invoking of inference_program, | ||
| # or the data input order of train program would be [next_word, firstw, secondw, | ||
| # thirdw, forthw], which is not correct. | ||
| predict_word = inference_program(is_sparse) |
There was a problem hiding this comment.
I think we can also specify the feed order in the
trainer.train(....., feed_order=['firstw', 'secondw', 'thirdw', 'forthw', 'next_word'])
|
|
||
| def _test_by_executor(self, reader, feed_order, fetch_list): | ||
| with executor.scope_guard(self.scope): | ||
| feed_var_list = build_feed_var_list(self.test_program, feed_order) |
There was a problem hiding this comment.
Trainer. train takes in feed_order, Will it be possible to re-use the feed_order so we don't need to calculate it?
Fixes #10363