microsoft / CNTK

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit
https://docs.microsoft.com/cognitive-toolkit/
Other
17.51k stars 4.28k forks source link

ValueError: learning_rate type (<class 'float'>) not supported. learning_rate must be a training schedule (output of learning_rate_schedule() function) #1058

Closed arijit17 closed 7 years ago

arijit17 commented 7 years ago

Hi!

I'm running this example: https://github.com/Microsoft/CNTK/blob/master/Tutorials/CNTK_101_LogisticRegression.ipynb On Windows 10, 64 bit, on CPU. I built CNTK from source exactly like the way described in Wiki.

When running the example:

# Instantiate the trainer object to drive the model training
learning_rate = 0.02
learner = sgd(z.parameters, lr=learning_rate)
trainer = Trainer(z, loss, eval_error, [learner])
I'm getting error:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-78dcd8830e76> in <module>()
      1 # Instantiate the trainer object to drive the model training
      2 learning_rate = 0.02
----> 3 learner = sgd(z.parameters, lr=learning_rate)
      4 trainer = Trainer(z, loss, eval_error, [learner])

C:\src\cntk\bindings\python\cntk\utils\swig_helper.py in wrapper(*args, **kwds)
     54     @wraps(f)
     55     def wrapper(*args, **kwds):
---> 56         result = f(*args, **kwds)
     57         map_if_possible(result)
     58         return result

C:\src\cntk\bindings\python\cntk\learner.py in sgd(parameters, lr, l1_regularization_weight, l2_regularization_weight, gaussian_noise_injection_std_dev, gradient_clipping_threshold_per_sample, gradient_clipping_with_truncation)
    330         Networks: Tricks of the Trade: Springer, 2012.
    331     '''
--> 332     _verify_learning_rate_type(lr)
    333     gaussian_noise_injection_std_dev = \
    334         training_parameter_schedule(gaussian_noise_injection_std_dev, UnitType.minibatch)

C:\src\cntk\bindings\python\cntk\learner.py in _verify_learning_rate_type(learning_rate)
     62                          'learning_rate must be a training schedule '
     63                          '(output of learning_rate_schedule() function)'
---> 64                          % type(learning_rate))
     65 
     66 # an internal method to verify that the mometum schedule

ValueError: learning_rate type (<class 'float'>) not supported. learning_rate must be a training schedule (output of learning_rate_schedule() function)
arijit17 commented 7 years ago

See #1062