Could not find requested nnunet trainer
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
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!
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__.pyfile 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.
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.
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.
Think you very much.
Best
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
So it does work now? I am not sure what was happening before that tbh
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
I have a similar problem. What should I do
@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.