Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[Retiarii] Rename APIs and refine documentation #3404

Merged
merged 9 commits into from
Mar 3, 2021

Conversation

ultmaster
Copy link
Contributor

No description provided.

@ultmaster ultmaster marked this pull request as ready for review March 1, 2021 03:50

Create a Trainer and Exploration Strategy
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Create a Evaluator and Exploration Strategy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a -> an

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will revise the doc in another pr

@@ -0,0 +1,2 @@
from .base import PyTorchImageClassificationTrainer, PyTorchMultiModelTrainer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not change Trainer to Evaluator?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base file is deprecated. These are not public APIs.



class Lightning(TrainingConfig):
class Lightning(ModelEvaluator):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between ModelEvaluator, Evaluator and Trainer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed modelevaluator -> evaluator. Trainer is a concept in oneshot only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can deprecate the concept of trainer and rename DartsTrainer -> DARTS, EnasTrainer -> ENAS? Leave that for discussion.

Comment on lines +184 to +202
if model_id not in evaluator_slot:
phy_model.evaluator.kwargs['model_kwargs'].append(new_node.graph.model.evaluator.kwargs.copy())
evaluator_slot[model_id] = len(phy_model.evaluator.kwargs['model_kwargs']) - 1
slot = evaluator_slot[model_id]
phy_model.evaluator.kwargs['model_kwargs'][slot]['model_id'] = model_id
phy_model.evaluator.kwargs['model_kwargs'][slot]['use_input'] = False
phy_model.evaluator.kwargs['model_kwargs'][slot]['use_output'] = False
else:
slot = training_config_slot[model_id]
slot = evaluator_slot[model_id]
# If a model's inputs/outputs are not used in the multi-model
# the codegen and trainer should not generate and use them
# "use_input" and "use_output" are used to mark whether
# an input/output of a model is used in a multi-model
if new_node.operation.type == '_inputs':
input_slot_mapping[new_node] = slot
phy_model.training_config.kwargs['model_kwargs'][slot]['use_input'] = True
phy_model.evaluator.kwargs['model_kwargs'][slot]['use_input'] = True
if new_node.operation.type == '_outputs':
output_slot_mapping[new_node] = slot
phy_model.training_config.kwargs['model_kwargs'][slot]['use_output'] = True
phy_model.evaluator.kwargs['model_kwargs'][slot]['use_output'] = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzhua could you please help review this part?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem if evaluator has the same structure with training_config.

@ultmaster ultmaster merged commit cae4308 into microsoft:master Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants