nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

Could not find requested nnunet trainer

Open CYYJL opened this issue 1 year ago • 7 comments

Hi,when I tried to run my custom-built network in nnunetv2, I encountered this error--->Could not find requested nnunet trainer nnUNetTestUnet in nnunetv2.training.nnUNetTrainer (/mnt/d/AIPRO/nnUNet/nnunetv2/training/nnUNetTrainer). However, I have already created this file in uuUNet and inherited the uuUNetTrainer class. Despite this, I am still unable to import this file. My nnUNet is installed according to the architecture and not as a package. I don't know how to solve this. I would like to ask for your advice. Thanks 54ebb0aab3e2f0e277e1daa9d69b7c9

CYYJL avatar May 01 '24 02:05 CYYJL

Please share your folder structure (where your trainer is) and the trainer itself is possible. If your trainer is located in a separate subfolder, make sure that this folder has a __init__.py file like the others!

FabianIsensee avatar May 01 '24 05:05 FabianIsensee

Please share your folder structure (where your trainer is) and the trainer itself is possible. If your trainer is located in a separate subfolder, make sure that this folder has a __init__.py file like the others!

Hi,Fabian,this is my folder structure. I'm sure my Trainer file and its subclass nnUNetTrainer file are in the same folder, and there is an init file. c5ee05a5c45538beb5e790c3729d916 I'll post my Trainer file code and the code for generating the model to see if the error is caused by my code. This is the nnUNetTestUnet.py file. 1714549200(1) This is the TestUnet.py file, this place to store the U-Net model and the get_lmaunet_from_plans function. Here mainly showcases the code snippet of the get_lmaunet_from_plans function. The remaining code in this file is for generating the U-Net model. 1714549399(1) Think you very much. Best CYYJL

CYYJL avatar May 01 '24 07:05 CYYJL

Hi,Fabian,I found something interesting: when I named my file nnUNetTestUnet.py, I got an error saying the file doesn't exist. However, when I created another folder and named it nnUNetTrainerSegmamba.py, the error disappeared. But I had successfully trained using nnUNetTestUnet.py a while ago. This is the train result about the nnUNetTestUnet.py 30c507ac72f524dee321fc035788498

CYYJL avatar May 01 '24 08:05 CYYJL

So it does work now? I am not sure what was happening before that tbh

FabianIsensee avatar May 02 '24 10:05 FabianIsensee

So it does work now? I am not sure what was happening before that tbh

Hi,Fabian Of course, when I renamed the file uuUNetTest.py to uuUNetTrainerTest.py, the code ran smoothly. However, I'm curious why the error occurred when running the file as uuUNetTest.py. Best CYYJL

CYYJL avatar May 02 '24 15:05 CYYJL

FMI{@7(LR}0)TB 7%0UNE Q T%NB~T)8ZTY}V N97A6HV I have a similar problem. What should I do

lxy51 avatar Jul 04 '24 07:07 lxy51

@lxy51 Hi,Check if the training function of your used nnUNetTrainer matches the name of the Python file. If they do not match, please modify them to be consistent before proceeding with the training.

CYYJL avatar Jul 05 '24 07:07 CYYJL