29 #ifndef LBANN_CALLBACKS_LEARNING_RATE_HPP_INCLUDED 30 #define LBANN_CALLBACKS_LEARNING_RATE_HPP_INCLUDED 33 #include <unordered_map> 34 #include <unordered_set> 92 const std::unordered_set<weights*>&
get_weights() const noexcept
133 std::vector<std::string> weights_names);
140 std::string
name()
const override {
return "step learning rate"; }
157 const google::protobuf::Message&,
158 std::shared_ptr<lbann_summary>
const&);
169 std::vector<std::string> weights_names);
176 std::string
name()
const override {
return "step learning rate"; }
192 const google::protobuf::Message&,
193 std::shared_ptr<lbann_summary>
const&);
209 std::vector<std::string> weights_names);
216 std::string
name()
const override {
return "adaptive learning rate"; }
230 size_t m_cur_epoch = std::numeric_limits<size_t>::max();
232 EvalType m_last_score = std::numeric_limits<EvalType>::max();
236 bool m_adjust_learning_rate =
false;
241 const google::protobuf::Message&,
242 std::shared_ptr<lbann_summary>
const&);
257 std::vector<std::string> weights_names);
265 std::string
name()
const override {
return "drop fixed learning rate"; }
284 std::unique_ptr<callback_base>
286 const google::protobuf::Message&,
287 std::shared_ptr<lbann_summary>
const&);
307 std::vector<std::string> weights_names);
316 std::string
name()
const override {
return "linear growth learning rate"; }
338 std::unique_ptr<callback_base>
340 const google::protobuf::Message&,
341 std::shared_ptr<lbann_summary>
const&);
357 std::vector<std::string> weights_names);
365 std::string
name()
const override {
return "poly learning rate"; }
389 const google::protobuf::Message&,
390 std::shared_ptr<lbann_summary>
const&);
404 std::vector<std::string> weights_names);
413 std::string
name()
const override 415 return "optimizerwise adaptive learning rate";
429 std::unique_ptr<callback_base>
431 const google::protobuf::Message&,
432 std::shared_ptr<lbann_summary>
const&);
456 double initial_learning_rate = 0.0,
457 size_t warmup_steps = 0);
461 double initial_learning_rate,
463 std::vector<std::string> weight_names);
472 std::string
name()
const override {
return "cosine decay learning rate"; }
495 std::unique_ptr<callback_base>
497 const google::protobuf::Message&,
498 std::shared_ptr<lbann_summary>
const&);
503 #endif // LBANN_CALLBACKS_LEARNING_RATE_HPP_INCLUDED std::string name() const override
Return this callback's name.
static void update_global_learning_rate(float rate) noexcept
std::unique_ptr< callback_base > build_poly_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
std::unique_ptr< callback_base > build_cosine_decay_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
size_t m_warmup_steps
Number of warmup steps.
cosine_decay_learning_rate * copy() const override
std::string name() const override
Return this callback's name.
std::vector< std::string > const & get_weights_names() const
std::unique_ptr< callback_base > build_adaptive_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
std::string name() const override
Return this callback's name.
float m_target
Target learning rate to reach.
learning_rate & operator=(const learning_rate &)=default
std::vector< std::string > m_weights_names
std::string name() const override
Return this callback's name.
float m_inc
Amount to increase each epoch.
std::string name() const override
Return this callback's name.
std::string name() const override
Return this callback's name.
double m_p
The exponent to compute new learning rate in poly policy.
float m_lr_min
The learning rate after cosine decay.
size_t m_decay_steps
The number of steps for decay.
const std::unordered_set< weights * > & get_weights() const noexcept
size_t m_delay
Number of epochs to delay before starting growth.
Abstract base class for gradient-based optimization algorithms.
drop_fixed_learning_rate * copy() const override
std::unique_ptr< callback_base > build_optimizerwise_adaptive_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
Base class for callbacks during training/testing.
virtual float optimizer_schedule(model *m, optimizer &opt)
std::unordered_set< weights * > m_weights
Abstract base class for neural network models.
adaptive_learning_rate * copy() const override
virtual float global_schedule(model *m)
float m_amt
Amount to decrease the learning rate by.
static float get_current_global_learning_rate() noexcept
std::unique_ptr< callback_base > build_set_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
void on_epoch_end(model *m) override
linear_growth_learning_rate * copy() const override
virtual void write_specific_proto(lbann_data::Callback &proto) const =0
Add callback specific data to prototext.
std::unique_ptr< callback_base > build_drop_fixed_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
set_learning_rate * copy() const override
float m_initial_lr
The initial learning rate for warmup. Relevant only if m_warmup_steps > 0.
std::vector< size_t > m_drop_epochs
float m_lr_max
The starting learning rate before decay.
virtual void on_backward_prop_end(model *m)
Called when a model ends backward propagation.
float m_end_lr
The final learning rate.
std::string name() const override
Return this callback's name.
size_t m_num_epochs
Number of epochs over which to scale the learning rate.
void on_backward_prop_end(model *m) override
poly_learning_rate * copy() const override
static float m_cur_global_lr
optimizerwise_adaptive_learning_rate * copy() const override
std::unique_ptr< callback_base > build_step_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
size_t m_num_epochs
The number of epochs for training.
std::string name() const override
Return this callback's name.
step_learning_rate * copy() const override
float m_base_lr
Initial learning rate.
size_t m_max_iter
The maximum number of iterations until which the learning rate changes.
void setup(model *m) override
std::unique_ptr< callback_base > build_linear_growth_learning_rate_callback_from_pbuf(const google::protobuf::Message &, std::shared_ptr< lbann_summary > const &)
float m_start_lr
The initial learning rate.