strategy应用momentum优化时报错
Created by: mrhan36
环境设置
环境:aistudio python版本:3.7 paddlehub版本:1.7.0
项目位置:
https://aistudio.baidu.com/aistudio/projectdetail/492913
问题:运行到以下代码处报错:
strategy = hub.CombinedStrategy(
optimizer_name="momentum",
learning_rate=0.0001
)
config = hub.RunConfig(
log_interval=10,
use_cuda=True,
num_epoch=5,
checkpoint_dir=ckpt_dirckpt_dir,
batch_size=32,
eval_interval=50,
strategy=strategy,
)
报错内容如下: ---------------------------------------------------------------------------TypeError Traceback (most recent call last) in 7 strategy = hub.CombinedStrategy( 8 optimizer_name="momentum", ----> 9 learning_rate=0.0001 10 ) 11 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) 189 clip=None): 190 super(CombinedStrategy, self).init( --> 191 optimizer_name=optimizer_name, learning_rate=learning_rate) 192 193 # init set /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/strategy.py in init(self, learning_rate, optimizer_name) 157 elif self._optimizer_name.lower() == "momentum": 158 self.optimizer = fluid.optimizer.Momentum( --> 159 learning_rate=self.learning_rate) 160 elif self._optimizer_name.lower() == "decayedadagrad": 161 self.optimizer = fluid.optimizer.DecayedAdagrad( TypeError: init() missing 1 required positional argument: 'momentum'