Skip to content

TypeError: STUNetTrainer_huge.build_network_architecture() takes from 4 to 5 positional arguments but 6 were given #34

@SergioRodLla

Description

@SergioRodLla

Hi Ziyan,

I tried to finetune your pretrained huge model on my multi-modal dataset using nnUNet v2 framework like this:
CUDA_VISIBLE_DEVICES=0 python nnUNet/nnunetv2/run/run_finetuning_stunet.py 500 3d_fullres 0 -tr STUNetTrainer_huge_ft -pretrained_weights STU-net/models/huge_ep4k.model

However, I got this error:

Traceback (most recent call last):
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_finetuning_stunet.py", line 63, in
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_finetuning_stunet.py", line 63, in
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_finetuning_stunet.py", line 63, in
run_training_entry()
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_training.py", line 275, in run_training_entry
run_training(args.dataset_name_or_id, args.configuration, args.fold, args.tr, args.p, args.pretrained_weights,
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_training.py", line 204, in run_training
maybe_load_checkpoint(nnunet_trainer, continue_training, only_run_validation, pretrained_weights)
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_finetuning_stunet.py", line 63, in
run_training_entry()
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_training.py", line 275, in run_training_entry
run_training(args.dataset_name_or_id, args.configuration, args.fold, args.tr, args.p, args.pretrained_weights,
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_training.py", line 204, in run_training
maybe_load_checkpoint(nnunet_trainer, continue_training, only_run_validation, pretrained_weights)
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/run/run_training.py", line 94, in maybe_load_checkpoint
nnunet_trainer.initialize()
File "/media/HDD_4TB_2/sergio/TFM/nnUNet/nnunetv2/training/nnUNetTrainer/nnUNetTrainer.py", line 210, in initialize
self.network = self.build_network_architecture(
TypeError: STUNetTrainer_huge.build_network_architecture() takes from 4 to 5 positional arguments but 6 were given

Looking at your implementation looks like you changed the way the basic nnUNetTrainer class is initializing the network when calling self.build_network_architecture. In the original one it takes 6 arguments. This is were the error ocurrs. I wanted to tell you so you are aware of this. I think defining a new initialize method as you have done in your nnUNetTrainer.py code taking 4 arguements in your custom STUNetTrainer would do the trick.

I'm a begginer on this so I might be wrong. Any ideas from you would be very appreciated.

Best regards,
Sergio

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions