Open VisionH222 opened 8 months ago
The specific error message is: Traceback (most recent call last): File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 76, in cli_main() File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 72, in cli_main infer(args.path_to_ckpt, preprocessed_ct_scan, args.path_to_result_dir, name) File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 42, in infer model_t = LitLungTumorSegModel.load_from_checkpoint(path_to_ckpt) File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 156, in load_from_checkpoint model = cls._load_model_state(checkpoint, strict=strict, kwargs) File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 198, in _load_model_state model = cls(_cls_kwargs) TypeError: init() missing 2 required positional arguments: 'model' and 'loss_fn' But when I use the ckpt file offered by you, it can run without problem. After reviewing the logs in Wandb, I discovered the cause of the problem,but I don't know how to solve it, can you help me? The specific content of the log is as follows: D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'model' removed from hparams because it cannot be pickled rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled") D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'loss_fn' removed from hparams because it cannot be pickled rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled")
try to install this version of pytorch lightning which let you to consider model and loss_fn too.
pip3 install pytorch-lightning==1.4.9
Thank you for your reply!
? ? ? @.***
------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2024年8月17日(星期六) 凌晨2:03 收件人: @.>; 抄送: "🌸 🌸 @.>; @.>; 主题: Re: [Ola-Vish/lung-tumor-segmentation] Hi,when using the inference.py and loading the ckpt file I get by the training, I faced some problem. Can you help me?Thanks! (Issue #4)
The specific error message is: Traceback (most recent call last): File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 76, in cli_main() File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 72, in cli_main infer(args.path_to_ckpt, preprocessed_ct_scan, args.path_to_result_dir, name) File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 42, in infer model_t = LitLungTumorSegModel.load_from_checkpoint(path_to_ckpt) File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 156, in load_from_checkpoint model = cls._load_model_state(checkpoint, strict=strict, kwargs) File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 198, in _load_model_state model = cls(_cls_kwargs) TypeError: init() missing 2 required positional arguments: 'model' and 'loss_fn' But when I use the ckpt file offered by you, it can run without problem. After reviewing the logs in Wandb, I discovered the cause of the problem,but I don't know how to solve it, can you help me? The specific content of the log is as follows: D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'model' removed from hparams because it cannot be pickled rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled") D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'loss_fn' removed from hparams because it cannot be pickled rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled")
try to install this version of pytorch lightning which let you to consider model and loss_fn too.
pip3 install pytorch-lightning==1.4.9
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>
The specific error message is: Traceback (most recent call last): File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 76, in
cli_main()
File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 72, in cli_main
infer(args.path_to_ckpt, preprocessed_ct_scan, args.path_to_result_dir, name)
File "E:/VH/Experiment/lung-tumor-segmentation-main/project/inference.py", line 42, in infer
model_t = LitLungTumorSegModel.load_from_checkpoint(path_to_ckpt)
File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 156, in load_from_checkpoint
model = cls._load_model_state(checkpoint, strict=strict, kwargs)
File "D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\core\saving.py", line 198, in _load_model_state
model = cls(_cls_kwargs)
TypeError: init() missing 2 required positional arguments: 'model' and 'loss_fn'
But when I use the ckpt file offered by you, it can run without problem.
After reviewing the logs in Wandb, I discovered the cause of the problem,but I don't know how to solve it, can you help me? The specific content of the log is as follows:
D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'model' removed from hparams because it cannot be pickled
rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled")
D:\Anaconda\envs\VH\lib\site-packages\pytorch_lightning\utilities\parsing.py:104: UserWarning: attribute 'loss_fn' removed from hparams because it cannot be pickled
rank_zero_warn(f"attribute '{k}' removed from hparams because it cannot be pickled")