CNTK icon indicating copy to clipboard operation
CNTK copied to clipboard

[Python API] How to set gradUpdateType=rmsprop for momentum_sgd learner?

Open main76 opened this issue 9 years ago • 0 comments

While using BrainScript, my SGD block is like this:

SGD=[
    ...
    epochSize=0 
    minibatchSize=10
    learningRatesPerSample=0.00005*40:0.000001*60:0.0000001
    momentumPerMB=0.9
    dropoutRate=0.0
    maxEpochs=100

    gradUpdateType=rmsprop
    rms_wgt_inc=1.2
    rms_wgt_dec=0.75
    rms_wgt_max=1
    rms_wgt_min=1
    rms_gamma=0.99
    ...
    gradientClippingWithTruncation=true
    clippingThresholdPerSample=0.1
]

I instantiate the learner and trainer by using:

lr_per_sample = learning_rate_schedule([(40,0.00005),(60,0.00001),(1,0.000001)], UnitType.sample)
momentum = momentum_schedule(0.9)
learner = momentum_sgd(z.parameters, lr_per_sample, momentum, 
    gradient_clipping_with_truncation=True, 
    gradient_clipping_threshold_per_sample=0.1)
pp = ProgressPrinter(tag='Training', num_epochs=max_epochs, log_to_file=os.path.join(output_path, log_name))
trainer = Trainer(z, criterion, learner, pp)

But I do not find a way to set the gradUpdateType to rmsProp, and apply the parameters for it. And if I instantiate the learner by using:

rms_gamma=0.99
rms_wgt_inc=1.2
rms_wgt_dec=0.75
rms_wgt_max=1
rms_wgt_min=1
learner = rmsprop(z.parameters, lr_per_sample, 
    rms_gamma, rms_wgt_inc, rms_wgt_dec, rms_wgt_max, rms_wgt_min,
    gradient_clipping_with_truncation=True, 
    gradient_clipping_threshold_per_sample=0.1)

the momentum cannot be set.

main76 avatar Apr 25 '17 07:04 main76