BiaPyX / BiaPy-GUI

BiaPy GUI
MIT License
6 stars 0 forks source link

load workflow in GUI 1.0.8 #7

Closed mcblache closed 3 weeks ago

mcblache commented 2 months ago

Hello,

Just to let you know that I can't import parameter file with the button "load and modify workflow" with the BIAPY GUI version 1.0.8. The interface freezes. It works with GUI version 1.0.6. I use a Linux on Debian version 12.

Thank you Best regards

Marie-Claire

danifranco commented 2 months ago

Hello,

Post here, please, the configuration yaml file you were trying to load so we can reproduce the error. We are currently under a big GUI update that will solve few minor issues like this one. In anycase, I'd like to ensure it is working with your yaml file ;)

Thanks!

mcblache commented 2 months ago

Hello,

Thank you very much for your reply and your help. please find the ymal file below


AUGMENTOR:
  ENABLE: false
DATA:
  EXTRACT_RANDOM_PATCH: false
  PATCH_SIZE: (400,400,3)
  REFLECT_TO_COMPLETE_SHAPE: true
  TEST:
    ARGMAX_TO_OUTPUT: true
    CHECK_DATA: true
    IN_MEMORY: false
    LOAD_GT: false
    OVERLAP: (0,0)
    PADDING: (32,32)
    PATH: /home/user/prj/d10
    RESOLUTION: (1,1)
MODEL:
  ARCHITECTURE: unet
  DROPOUT_VALUES:
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  FEATURE_MAPS:
  - 16
  - 32
  - 64
  - 128
  - 256
  LOAD_CHECKPOINT: true
PATHS:
  CHECKPOINT_FILE: /home/user/prj/output/my_2d_semantic_segmentation/checkpoints/my_2d_semantic_segmentation_1-checkpoint-best.pth
PROBLEM:
  NDIM: 2D
  SEMANTIC_SEG:
    IGNORE_CLASS_ID: 0
  TYPE: SEMANTIC_SEG
SYSTEM:
  NUM_CPUS: -1
  NUM_WORKERS: 0
  SEED: 0
TEST:
  ENABLE: true
  EVALUATE: true
  FULL_IMG: true
  VERBOSE: true
TRAIN:
  ENABLE: false

Thanks

Marie-Claire

danifranco commented 1 month ago

Hello!

Thank you so much for sharing the yaml. The problems with the fresh GUI version, v1.1.0, have been solved. I'm uploading now Windows and Linux binaries. Tomorrow morning will upload the macOS one.

Try the new version and tell me if you still have issues. The biggest feature we have added is a Wizard, that will help you to run a workflow by answering some basic questions. We tried to reduce the complicated/ai/computer-science related words so it can be used easily. Everything will be configured under the hood with some predefined default settings that work in most situations. Hope you like it!

Feel free to close the issue too!

mcblache commented 1 month ago

Hello,

I tried to load my .yaml file in the latest version 1.1.1. I get the following error.

Error found loading YAML to the GUI : 
Traceback (most receny call last) : 
File "ui_utils.py",line 3117, in run
File "yacs/config.py" line 213 in merge_from_file
File "yacs/config.py" line 217 in merge_from_other_cfg
File "yacs/config.py" line 478 in merge_a_into_b
File "yacs/config.py" line 491 in merge_a_into_b
keyError: 'Non-existent conig key TEST.EVALUATE'

When I remove "TEST.EVALUATE" of my file .yaml. It is load. But when I run, this error appears :

[09:04:01.813916] Extracting model from checkpoint file /home/mcblache/prj/pepper/PEP008_import/output/my_2d_semantic_segmentation/checkpoints/my_2d_semantic_segmentation_1-checkpoint-best.pth
Traceback (most recent call last):
  File "/installations/BiaPy/main.py", line 4, in <module>
    main()
  File "/installations/BiaPy/biapy/__init__.py", line 68, in main
    _biapy.run_job()
  File "/installations/BiaPy/biapy/_biapy.py", line 957, in run_job
    self.test()
  File "/installations/BiaPy/biapy/_biapy.py", line 213, in test
    self.workflow.test()
  File "/installations/miniconda3/envs/BiaPy_env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/installations/BiaPy/biapy/engine/base_workflow.py", line 969, in test
    self.prepare_model()
  File "/installations/BiaPy/biapy/engine/base_workflow.py", line 548, in prepare_model
    self.model_build_kwargs, saved_cfg = load_model_checkpoint(
  File "/installations/BiaPy/biapy/utils/misc.py", line 245, in load_model_checkpoint
    raise ValueError("Checkpoint seems to not be from BiaPy (v3.5.1 or later) as model building args couldn't be extracted")
ValueError: Checkpoint seems to not be from BiaPy (v3.5.1 or later) as model building args couldn't be extracted
ERROR conda.cli.main_run:execute(125): `conda run python3 -u /installations/BiaPy/main.py --config /BiaPy_files/input.yaml --result_dir /home/mcblache/prj/pepper/PEP008_import/output --name my_2d_semantic_segmentation --run_id 1 --dist_backend nccl --gpu 0` failed. (See above for error)

I also tried to create a new model with the Biapy 1.1.1 interface. I make a new model. However, when I want to predict only images (test), I get this error:

    _biapy.run_job()
  File "/installations/BiaPy/biapy/_biapy.py", line 957, in run_job
    self.test()
  File "/installations/BiaPy/biapy/_biapy.py", line 213, in test
    self.workflow.test()
  File "/installations/miniconda3/envs/BiaPy_env/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/installations/BiaPy/biapy/engine/base_workflow.py", line 969, in test
    self.prepare_model()
  File "/installations/BiaPy/biapy/engine/base_workflow.py", line 548, in prepare_model
    self.model_build_kwargs, saved_cfg = load_model_checkpoint(
  File "/installations/BiaPy/biapy/utils/misc.py", line 241, in load_model_checkpoint
    checkpoint = torch.load(resume, map_location=device, weights_only=True)
  File "/installations/miniconda3/envs/BiaPy_env/lib/python3.10/site-packages/torch/serialization.py", line 1096, in load
    raise pickle.UnpicklingError(_get_wo_message(str(e))) from None
_pickle.UnpicklingError: Weights only load failed. Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.
 Please file an issue with the following so that we can make `weights_only=True` compatible with your use case: WeightsUnpickler error: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

Check the documentation of torch.load to learn more about types accepted by default with weights_only https://pytorch.org/docs/stable/generated/torch.load.html.
ERROR conda.cli.main_run:execute(125): `conda run python3 -u /installations/BiaPy/main.py --config /BiaPy_files/input.yaml --result_dir /home/mcblache/prj/pepper/PEP008_BIAPY111/output --name my_experiment_2D_20241004-111319 --run_id 1 --dist_backend nccl` failed. (See above for error)

Sorry for me it doesn't work

I tried to use what worked previously i.e. the previous version of the interface (v1.0.6) with the previous version of the biapy container (uninstalling latest-11.8 and installing the old one via docker pull biapyx/biapy=latest-10.2). But unfortunately the interface still forces the use of the latest version of the biapy container.

Marie-Claire

danifranco commented 1 month ago

Thank you for adapting your configuration file removing the "TEST.EVALUATE" key as we are not using it anymore. Also, we now store more information inside the checkpoints, that's you need to retrain the model so you can have that updated checkpoint. I'm sorry that you need to do so but this is something that will not happen again in the future...

Regarding the last error, I think I have solved the issue with the last commit I made. I have just updated BiaPy containers, so please check it out. You can remove all the containers of BiaPy that you have and the GUI will automatically donwload the lastest.

Another thing just to clarify: both containers, latest-11.8 and latest-10.2 are new. I mean, latest-10.2 is not the old container, or the old version of latest-11.8, but just a container with a lower version of Pytorch with support for old GPUs (different Pytorch/CUDA combination). You don't need to care about it, the GUI will automatically detect if you do not support the latest-11.8 container, which is the "good" one let's say, and will download the latest-10.2 automatically. Actually, we were planning to remove the latest-10.2 container soon as most of the GPUs today support the latest-11.8 and because we can not test the latest-10.2 anymore (see it just as an alternative container for those with old GPU cards).

mcblache commented 3 weeks ago

Hello, I appreciate your correction of the Docker file and your explanations. Now the interface works. I close the issue. Thank you very much.