Closed ghost closed 2 years ago
Thanks for reporting this @dominikgraf. New LightningCLI is still beta, and we expect this sort of issues. We'll try to fix it asap
Hey again, the bug is still present in the current version, so I took a second look.
The training works after I made a small change to anomalib/anomalib/utils/cli/cli.py and my config. I removed 'category' from the config and removed the keys check in line 146 in cli.py:
Changed from:
146 category = config.data.init_args.category if config.data.init_args.keys() else ""
to:
146 category = ""
@dominikgraf, you are right. The error is because category
is specified in your config. The new CLI is much stricter when it comes to passing the argument. If they are not part of the class args, it immediately throws error.
In this case, category
is not one of the class arguments of the FolderDataset
, which is why you encountered this issue.
You don't even need to change the code. If you remove category
from your config file, it should work.
Thanks for your answer, @samet-akcay . I tried removing / commenting out 'category' as described in the lower part of my report:
anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
again
Output is:
File "/home/USERNAME/masterthesis/anomalib/anomalib/utils/cli/cli.py", line 142, in __set_default_root_dir
category = config.data.init_args.category if config.data.init_args.keys() else ""
AttributeError: 'Namespace' object has no attribute 'category'
To me it seems that, the check of 'keys()' is skipped for some reason. Removing 'category' from my config did not solve the Error.
Describe the bug
I use a custom dataset to train Fastflow with the new Lightning CLI Method. If I define 'category' in the config there is an Error:
When I comment 'category' out in the config, there is an other AttributeError:
To Reproduce
Steps to reproduce the behavior:
model: class_path: anomalib.models.Fastflow init_args: input_size: [256, 256] backbone: wide_resnet50_2 # options: [resnet18, wide_resnet50_2, cait_m48_448, deit_base_distilled_patch16_384] pre_trained: true flow_steps: 8 # options: [8, 8, 20, 20] - for each supported backbone conv3x3_only: False # options: [True, False, False, False] - for each supported backbone hidden_ratio: 1.0 # options: [1.0, 1.0, 0.16, 0.16] - for each supported backbone
...
anomalib: error: Parser key "data": Problem with given class_path "anomalib.data.Folder":
anomalib fit --config anomalib_model_config/fastflow_lightning.yaml
Output is:Expected behavior
Hardware and Software Configuration