| 229 | |
| 230 | |
| 231 | def _add_regularization_args(parser): |
| 232 | group = parser.add_argument_group(title='regularization') |
| 233 | |
| 234 | group.add_argument('--attention-dropout', type=float, default=0.1, |
| 235 | help='Post attention dropout ptobability.') |
| 236 | group.add_argument('--hidden-dropout', type=float, default=0.1, |
| 237 | help='Dropout probability for hidden state transformer.') |
| 238 | group.add_argument('--weight-decay', type=float, default=0.01, |
| 239 | help='Weight decay coefficient for L2 regularization.') |
| 240 | group.add_argument('--clip-grad', type=float, default=1.0, |
| 241 | help='Gradient clipping based on global L2 norm.') |
| 242 | group.add_argument('--adam-beta1', type=float, default=0.9, |
| 243 | help='First coefficient for computing running averages of' |
| 244 | 'gradient and its square') |
| 245 | group.add_argument('--adam-beta2', type=float, default=0.999, |
| 246 | help='Second coefficient for computing running averages of' |
| 247 | 'gradient and its square') |
| 248 | group.add_argument('--adam-eps', type=float, default=1e-08, |
| 249 | help='Term added to the denominator to improve' |
| 250 | 'numerical stability') |
| 251 | |
| 252 | return parser |
| 253 | |
| 254 | |
| 255 | def _add_training_args(parser): |