gradual_unfreeze相关问题
Created by: mrhan36
今天设置gradual_unfreeze时遇到一个调试错误,我对照strategy.py逐行检查,错误提示很明确,就是没搞清怎么改,请您指导一下,谢谢!
环境:aistudio平台,paddlehub版本:1.5.2 ,经测试,使用1.6.0版本也出现这个问题
源代码如下: scheduler = { "gradual_unfreeze": { "blocks": 3 } }
strategy = hub.CombinedStrategy( optimizer_name="adam", learning_rate=1e-4, # 正交试验参数1 scheduler = scheduler ) config = hub.RunConfig( log_interval=10, use_cuda=True, num_epoch=30, checkpoint_dir=ckpt_dirckpt_dir, batch_size=32, eval_interval=50, strategy=strategy )
错误提示如下: ---------------------------------------------------------------------------ValueError Traceback (most recent call last) in 43 optimizer_name="adam", 44 learning_rate=1e-4, # 正交试验参数1 ---> 45 scheduler = scheduler 46 ) 47 config = hub.RunConfig( /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/strategy.py in init(self, optimizer_name, learning_rate, scheduler, regularization, clip) 229 # check legality and assign 230 for name in scheduler: --> 231 self.check_assign(self.scheduler, name, scheduler[name]) 232 for name in regularization: 233 self.check_assign(self.regularization, name, regularization[name]) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/strategy.py in check_assign(self, dictionary, key, value) 256 else: 257 raise ValueError("The type of parameter %s should be %s" % --> 258 (key, type(dictionary[key]))) 259 260 def add_scheduler(self, name="warmup", value=0, **values): ValueError: The type of parameter gradual_unfreeze should be <class 'int'>
谢谢!