Repository navigation
Models configs via pydantic - #850
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #850 +/- ##
==========================================
+ Coverage 87.77% 87.83% +0.06%
==========================================
Files 107 108 +1
Lines 9774 9942 +168
==========================================
+ Hits 8579 8733 +154
- Misses 1195 1209 +14 🚀 New features to boost your workflow:
|
by testing all allowed combinations of signal parameters for each model config
an uninstanciated class MyClass should be of type type[MyClass] and not MyClass
|
TODO :
|
bruAristimunha
left a comment
There was a problem hiding this comment.
Small modifications needed, i will push the solf import.
|
@bruAristimunha thanks for pushing the soft import. Regarding this, the configs are located in : from braindecode.models.config import EEGNetConfigYou think it's ok? maybe we could put them directly in : from braindecode.models import EEGNetConfig |
|
Let's keep within config, I would like to iterate with the brain & AI team about this within the Exca tutorial. |
|
I will start a PR on the exca tutorial when this is merged |
|
@bruAristimunha it looks a bit strange to have the whole file indented :/ |
…code into models-config
|
thanks @PierreGtch 🙏🏽 |
|
thanks for your help! |
This adds pydantic config classes that are automatically generated for every model!
pydantic is a soft dependancy. @bruAristimunha can you check how I implemented the soft dep? Not sure this is the best solution
Use case:
Models configs benefit from all the nice pydantic functionalities, including easy serialisation for example:
{'n_chans': 16, 'n_outputs': 1, 'n_times': 1000, 'final_conv_length': 'auto', 'pool_mode': 'mean', 'F1': 8, 'D': 2, 'F2': None, 'kernel_length': 64, 'depthwise_kernel_length': 16, 'pool1_kernel_size': 4, 'pool2_kernel_size': 8, 'conv_spatial_max_norm': 1, 'activation': torch.nn.modules.activation.ELU, 'batch_norm_momentum': 0.01, 'batch_norm_affine': True, 'batch_norm_eps': 0.001, 'drop_prob': 0.25, 'final_layer_with_constraint': False, 'norm_rate': 0.25, 'chs_info': None, 'input_window_seconds': None, 'sfreq': None}Then the model can be instantiated with the
create_instance()method: