自定义paddle_hub指标时,按照参考文档报错了,请问怎么解决?能否提供具体demo?
Created by: Masterkmp
报错信息如下 [2020-09-16 15:10:25,693] [ INFO] - Strategy with warmup, linear decay, slanted triangle learning rate, weight decay regularization, /opt/conda/envs/python35-paddle120-envb/python3.7/site-packages/paddle/fluid/executor.py:1093: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used. warnings.warn(error_info) [2020-09-16 15:10:25,756] [ INFO] - Try loading checkpoint from hub_ernie_text_cls_demo/ckpt.meta [2020-09-16 15:10:25,756] [ INFO] - PaddleHub model checkpoint not found, start from scratch... [2020-09-16 15:10:25,825] [ INFO] - PaddleHub finetune start
This is the new log_interval_event!
---------------------------------------------------------------------------TypeError Traceback (most recent call last) in 1 #run_states = cls_task.finetune_and_eval() ----> 2 cls_task.finetune_and_eval() /opt/conda/envs/python35-paddle120-envb/python3.7/site-packages/paddlehub/finetune/task/base_task.py in finetune_and_eval(self) 943 944 def finetune_and_eval(self): --> 945 return self.finetune(do_eval=True) 946 947 def finetune(self, do_eval=False): /opt/conda/envs/python35-paddle120-envb/python3.7/site-packages/paddlehub/finetune/task/base_task.py in finetune(self, do_eval) 964 while self.current_epoch <= self.config.num_epoch: 965 self.config.strategy.step() --> 966 run_states = self._run(do_eval=do_eval) 967 self.env.current_epoch += 1 968 /opt/conda/envs/python35-paddle120-envb/python3.7/site-packages/paddlehub/finetune/task/base_task.py in _run(self, do_eval) 1222 if self.is_train_phase: 1223 if self.current_step % self.config.log_interval == 0: -> 1224 self._log_interval_event(period_run_states) 1225 global_run_states += period_run_states 1226 period_run_states = [] /opt/conda/envs/python35-paddle120-envb/python3.7/site-packages/paddlehub/finetune/task/base_task.py in hook_function(self, *args) 708 func(*args) 709 else: --> 710 partial(func, self)(*args) 711 712 return hook_function in new_log_interval_event(self, run_states) 66 # 改写的事件方法,参数列表务必与PaddleHub内置的相应方法保持一致 67 print("This is the new log_interval_event!") ---> 68 scores, avg_loss, run_speed = calculate_metrics(run_states) 69 record_value(scores, avg_loss, run_speed) 70 TypeError: calculate_metrics() missing 1 required positional argument: 'run_states'