26 #ifndef LBANN_EXECUTION_ALGORITHMS_LTFB_RANDOM_PAIRWISE_EXCHANGE_HPP_INCLUDED 27 #define LBANN_EXECUTION_ALGORITHMS_LTFB_RANDOM_PAIRWISE_EXCHANGE_HPP_INCLUDED 33 #include <google/protobuf/message.h> 38 #include <unordered_map> 61 :
public Cloneable<RandomPairwiseExchange, MetaLearningStrategy>
72 :
public Cloneable<HasAbstractFunction<ExchangeStrategy>>
95 virtual std::unique_ptr<model>
131 std::unique_ptr<ExchangeStrategy> comm_algo,
132 std::unique_ptr<MutationStrategy> mutate_algo);
144 std::unordered_map<std::string, metric_strategy>
metrics,
145 std::unique_ptr<ExchangeStrategy> comm_algo,
146 std::unique_ptr<MutationStrategy> mutate_algo);
167 std::unordered_map<std::string, EvalType>
184 std::unordered_map<std::string, EvalType>
const& local_scores,
185 std::unordered_map<std::string, EvalType>
const& partner_scores)
const;
193 std::unordered_map<std::string, metric_strategy>
m_metrics;
222 :
public Cloneable<SendRecvWeights, RandomPairwiseExchange::ExchangeStrategy>
235 bool exchange_hyperparameters);
244 bool exchange_hyperparameters);
250 El::Int partner_trainer,
259 :
public Cloneable<CheckpointFile, RandomPairwiseExchange::ExchangeStrategy>
266 std::string
const& ckpt_basedir);
268 std::string
const& ckpt_basedir);
269 std::unique_ptr<model>
277 :
public Cloneable<CheckpointBinary, RandomPairwiseExchange::ExchangeStrategy>
286 El::Int partner_trainer,
297 std::unique_ptr<ltfb::RandomPairwiseExchange>
298 make(google::protobuf::Message
const&);
303 #endif // LBANN_EXECUTION_ALGORITHMS_LTFB_RANDOM_PAIRWISE_EXCHANGE_HPP_INCLUDED
ExchangeStrategy(std::set< std::string > weights_names)
Construct with weights names.
Inject polymorphic clone functions into hierarchies.
virtual std::unique_ptr< model > get_partner_model(model const &m, El::Int partner_trainer, size_t step)=0
Get the model from a partner trainer.
int get_partner_trainer(lbann_comm const &c) const noexcept
Generate a new trainer partner from the comm.
std::unordered_map< std::string, EvalType > evaluate_model(model &m, LTFBExecutionContext &ctxt, data_coordinator &dc) const
Get the value of the given metric from the model.
~RandomPairwiseExchange()=default
std::unique_ptr< MutationStrategy > m_mutate_algo
The strategy for mutation of a model.
std::set< std::string > m_weights_names
See lbann::callbacks::ltfb::communication_algorithm::checkpoint_file.
Exchange model weights directly using sendrecvs.
virtual ~ExchangeStrategy()=default
void select_next(model &m, ltfb::LTFBExecutionContext &ctxt, data_coordinator &dc) const final
Engage in a tournament with a partner trainer.
RandomPairwiseExchange(std::string metric_name, metric_strategy winner_strategy, std::unique_ptr< ExchangeStrategy > comm_algo, std::unique_ptr< MutationStrategy > mutate_algo)
Constructor.
std::set< std::string > const & weights_names() const noexcept
Access weights_names.
Abstract base class for neural network models.
std::unique_ptr< ltfb::RandomPairwiseExchange > make(google::protobuf::Message const &)
Concrete builder for RandomPairwiseExchange.
std::unique_ptr< ExchangeStrategy > m_comm_algo
The strategy for exchanging two models.
bool exchange_hyperparams_
A method for exchanging models with a partner trainer.
std::string ckpt_basedir_
std::unordered_map< std::string, metric_strategy > m_metrics
The list of metric/strategy pairs.
The original LTFB algorithm.
bool local_is_better(std::unordered_map< std::string, EvalType > const &local_scores, std::unordered_map< std::string, EvalType > const &partner_scores) const
Evaluate the output of two models according to the input metric strategies.