程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

python:TypeError: __ init__ () got an unexpected keyword argument early_ stop_ callback

編輯:Python
The phenomenon and background of the problem

This is a train.py Related code

 trainer = pl.Trainer(max_epochs=conf['training']['epochs'], checkpoint_callback=checkpoint, resume_from_checkpoint=best_model_path, early_stop_callback=early_stopping, default_save_path=exp_dir, gpus=gpus, distributed_backend='dp', train_percent_check=1.0, # Useful for fast experiment gradient_clip_val=5.) trainer.fit(system)

This is a env_vars_connector.py Code for :

def _defaults_from_env_vars(fn: Callable) -> Callable: """Decorator for :class:`~pytorch_lightning.trainer.trainer.Trainer` methods for which input arguments should be moved automatically to the correct device.""" @wraps(fn) def insert_env_defaults(self, *args, **kwargs): cls = self.__class__ # get the class if args: # inace any args passed move them to kwargs # parse only the argument names cls_arg_names = [arg[0] for arg in get_init_arguments_and_types(cls)] # convert args to kwargs kwargs.update(dict(zip(cls_arg_names, args))) env_variables = vars(parse_env_variables(cls)) # update the kwargs by env variables kwargs = dict(list(env_variables.items()) + list(kwargs.items())) # all args were already moved to kwargs return fn(self, **kwargs) return insert_env_defaults
Operation results and error reporting contents
File "train.py", line 93, in main trainer = pl.Trainer(max_epochs=conf['training']['epochs'], File "C:\Users\SASPL-1\anaconda3\envs\zx_38\lib\site-packages\pytorch_lightning\trainer\connectors\env_vars_connector.py", line 38, in insert_env_defaults return fn(self, **kwargs)TypeError: __init__() got an unexpected keyword argument 'early_stop_callback'
My solution ideas and tried methods

What is the problem ??


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved