プリンキピア

第14章コンピュータビジョン

14.14.6. Training and Validating the Model14.14.6 モデルを訓練し検証する

Now we can train and validate the model. The following hyperparameters are all tunable. For example, the number of epochs can be increased. Because lr_period and lr_decay are set to 2 and 0.9, respectively, the learning rate of the optimization algorithm will be multiplied by 0.9 after every 2 epochs.
英語のヒント
これで、モデルを訓練し検証できる。次のハイパーパラメータはすべて調整できる。たとえば、エポック数を増やせる。lr_periodとlr_decayはそれぞれ2と0.9に設定されているので、最適化アルゴリズムの学習率は2エポックごとに0.9倍される。
devices, num_epochs, lr, wd = d2l.try_all_gpus(), 10, 1e-4, 1e-4
lr_period, lr_decay, net = 2, 0.9, get_net(devices)
train(net, train_iter, valid_iter, num_epochs, lr, wd, devices, lr_period,
      lr_decay)
train loss 1.240, valid loss 1.545
577.5 examples/sec on [device(type='cuda', index=0), device(type='cuda', index=1)]