microsoft / InnerEye-DeepLearning

Medical Imaging Deep Learning library to train and deploy 3D segmentation models on Azure Machine Learning
https://aka.ms/innereyeoss
MIT License
557 stars 142 forks source link

ValueError: Model name MyModel was not found in search namespaces: ['InnerEye.ML.configs']. #818

Closed Med-Rokaimi closed 2 years ago

Med-Rokaimi commented 2 years ago

Discussed in https://github.com/microsoft/InnerEye-DeepLearning/discussions/817

Originally posted by **Med-Rokaimi** October 26, 2022 Hey, I'm trying to run Glaucoma detection model following the steps in the link [Sample task](https://innereye-deeplearning.readthedocs.io/md/sample_tasks.html). I set up the InnerEye-DeepLearningnner locally. I created MyGlaucomaModel in the path (InnerEye/ML/configs), and my dataset folder is located in the same path as well. This is the model I created:
class MyGlaucomaModel(GlaucomaPublic):
    def __init__(self) -> None:
        super().__init__()
        local_dataset=full_ml_test_data_path(),
        self.azure_dataset_id="glaucoma_detection",
When I try to run the model by this command:
python InnerEye/ML/runner.py --model=MyGlaucomaModel
I got this error:
Starting InnerEye runner at InnerEye/ML/runner.py
Adding InnerEye folder to sys.path: /home/ai/InnerEye-DeepLearning
Setting up logging to stdout.
Setting logging level to 20 (INFO)
2022-10-26T06:26:50Z INFO     rpdb is handling traps. To debug: identify the main runner.py process, then as root: kill -TRAP ; nc 127.0.0.1 4444
2022-10-26T06:26:50Z WARNING  (from attempt to import module InnerEye.ML.configs.MyGlaucoma): name 'full_ml_test_data_path' is not defined
2022-10-26T06:26:50Z WARNING  (from attempt to import module InnerEye.ML.configs.classification.GlaucomaPublic): name 'full_ml_test_data_path' is not defined
Traceback (most recent call last):
  File "InnerEye/ML/runner.py", line 467, in 
    main()
  File "InnerEye/ML/runner.py", line 461, in main
    run(project_root=fixed_paths.repository_root_directory(),
  File "InnerEye/ML/runner.py", line 457, in run
    return runner.run()
  File "InnerEye/ML/runner.py", line 215, in run
    self.parse_and_load_model()
  File "InnerEye/ML/runner.py", line 164, in parse_and_load_model
    config_or_container = model_config_loader.create_model_config_from_name(model_name=azure_config.model)
  File "/home/ai/InnerEye-DeepLearning/InnerEye/ML/utils/config_loader.py", line 132, in create_model_config_from_name
    raise ValueError(
ValueError: Model name MyGlaucomaModel was not found in search namespaces: ['InnerEye.ML.configs']
Can you please help me? I

AB#7873

peterhessey commented 2 years ago

Hi, I've managed to repeat this bug myself but I'm not sure on the exact cause yet, will take a closer look ASAP and get a bugfix to you soon :)

Med-Rokaimi commented 2 years ago

The error has been fixed after solving the these two warnings:

2022-10-26T06:26:50Z WARNING  (from attempt to import module InnerEye.ML.configs.MyGlaucoma): name 'full_ml_test_data_path' is not defined
2022-10-26T06:26:50Z WARNING  (from attempt to import module InnerEye.ML.configs.classification.GlaucomaPublic): name 'full_ml_test_data_path' is not defined

The model is not loaded because of these two warnings.