Closed senwu closed 2 years ago
Merging #114 (651f4eb) into master (03c80bc) will increase coverage by
0.91%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #114 +/- ##
==========================================
+ Coverage 91.21% 92.12% +0.91%
==========================================
Files 40 40
Lines 1991 2018 +27
Branches 425 431 +6
==========================================
+ Hits 1816 1859 +43
+ Misses 101 94 -7
+ Partials 74 65 -9
Flag | Coverage Δ | |
---|---|---|
unittests | 92.12% <100.00%> (+0.91%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
src/emmental/__init__.py | 100.00% <100.00%> (ø) |
|
src/emmental/learner.py | 78.32% <100.00%> (ø) |
|
src/emmental/model.py | 93.78% <100.00%> (+5.43%) |
:arrow_up: |
src/emmental/schedulers/mixed_scheduler.py | 100.00% <100.00%> (ø) |
|
src/emmental/schedulers/round_robin_scheduler.py | 100.00% <100.00%> (ø) |
|
src/emmental/schedulers/scheduler.py | 100.00% <100.00%> (ø) |
|
src/emmental/schedulers/sequential_scheduler.py | 100.00% <100.00%> (ø) |
|
src/emmental/task.py | 100.00% <100.00%> (ø) |
Description of the proposed changes
To make Emmental more extendable and easy to use for downstream tasks.
Action
andBatch
to make the APIs more modularized.Action
are objects that populate thetask_flow
sequence. It has three attributes: name, module and inputs where name is the name of the action, module is the module name of the action and inputs is the inputs to the action. By introducing a class for specifying actions in thetask_flow
, we standardize its definition. Moreover,Action
enables more user flexibility in specifying a task flow as we can now support a wider-range of formats for the input attribute of atask_flow
as discussed in (2).Batch
is the object that is returned from the EmmentalScheduler
. EachBatch
object has 6 attributes: uids (uids of the samples), X_dict (input features of the samples), Y_dict (output of the samples), task_to_label_dict (the task to label mapping), data_name (name of the dataset that samples come from), and split (the split information). By defining theBatch
class, we unify and standardize the training scheduler interface by ensuring a consistent output format for all schedulers.task_flow
more flexible by supporting more formats for specifying inputs to each module.input1
's output as input for current action.Few emmental.EmmentalTaskFlowAction examples:
This design also can be applied to action_outputs, here are few example:
Test plan
Pass the existing tests.
Checklist