Skip to content

Commit

Permalink
CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
senwu committed Jan 24, 2021
1 parent 066ef3b commit a2bdd35
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,55 @@ Added
module_device={"input_module": -1, f"{task_name}_pred_head": 0},
scorer=Scorer(metrics=task_metrics[task_name]),
)
* `@senwu`_: Add require_prob_for_eval and require_pred_for_eval to optimize score
function performance.
(`#92 <https://github.com/SenWu/emmental/pull/92>`_)

.. note::

The current approach during score the model will store probs and preds which might
require a lot of memory resources especially for large datasets. The score function
is also used in training. To optimize the score function performance, this PR
introduces two new arguments in `EmmentalTask`: `require_prob_for_eval` and
`require_pred_for_eval` which automatically selects whether `return_probs` or
`return_preds`.

.. code:: python
task_name = "Task1"
EmmentalTask(
name=task_name,
module_pool=nn.ModuleDict(
{
"input_module": nn.Linear(2, 8),
f"{task_name}_pred_head": nn.Linear(8, 2),
}
),
task_flow=[
{
"name": "input",
"module": "input_module",
"inputs": [("_input_", "data")],
},
{
"name": f"{task_name}_pred_head",
"module": f"{task_name}_pred_head",
"inputs": [("input", 0)],
},
],
loss_func=partial(ce_loss, task_name),
output_func=partial(output, task_name),
action_outputs=[
(f"{task_name}_pred_head", 0),
("_input_", "data"),
(f"{task_name}_pred_head", 0),
],
module_device={"input_module": -1, f"{task_name}_pred_head": 0},
require_prob_for_eval=True,
require_pred_for_eval=True,
scorer=Scorer(metrics=task_metrics[task_name]),
)
Fixed
^^^^^
Expand Down

0 comments on commit a2bdd35

Please sign in to comment.