DeepTab icon indicating copy to clipboard operation
DeepTab copied to clipboard

[FAQ]cannot assign 'int' as child module 'precision' (torch.nn.Module or None expected)

Open SoloTillDawn opened this issue 1 year ago • 2 comments

Hello, author! I used your example_classification.py and got the following error: Feature: feature_0 (imputer -> normalizer -> ple), Encoded feature dimension: 50

Feature: feature_1 (imputer -> normalizer -> ple), Encoded feature dimension: 50

Feature: feature_2 (imputer -> normalizer -> ple), Encoded feature dimension: 50

Feature: feature_3 (imputer -> normalizer -> ple), Encoded feature dimension: 50

Feature: feature_4 (imputer -> normalizer -> ple), Encoded feature dimension: 50

Trainer already configured with model summary callbacks: [<class 'lightning.pytorch.callbacks.model_summary.ModelSummary'>]. Skipping setting a default ModelSummary callback. GPU available: True (cuda), used: True TPU available: False, using: 0 TPU cores IPU available: False, using: 0 IPUs HPU available: False, using: 0 HPUs Traceback (most recent call last): File "C:\Users\16776\Desktop\STD_Deep_Learning\mamba-tabular-master\examples\example_classification.py", line 39, in classifier.fit(X_train, y_train, max_epochs=10, accelerator='gpu', devices=1) File "D:\anaconda\envs\MT\lib\site-packages\mambular\models\sklearn_base_classifier.py", line 382, in fit self.trainer.fit(self.task_model, self.data_module) File "D:\anaconda\envs\MT\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 603, in fit call._call_and_handle_interrupt( File "D:\anaconda\envs\MT\lib\site-packages\lightning\pytorch\trainer\call.py", line 38, in _call_and_handle_interrupt return trainer_fn(*args, **kwargs) File "D:\anaconda\envs\MT\lib\site-packages\lightning\pytorch\trainer\trainer.py", line 633, in _fit_impl self._data_connector.attach_data( File "D:\anaconda\envs\MT\lib\site-packages\lightning\pytorch\trainer\connectors\data_connector.py", line 149, in attach_data self._copy_trainer_model_properties(model) File "D:\anaconda\envs\MT\lib\site-packages\lightning\pytorch\trainer\connectors\data_connector.py", line 153, in _copy_trainer_model_properties model.precision = self.trainer.precision File "D:\anaconda\envs\MT\lib\site-packages\torch\nn\modules\module.py", line 1653, in setattr raise TypeError("cannot assign '{}' as child module '{}' " TypeError: cannot assign 'int' as child module 'precision' (torch.nn.Module or None expected)

Process finished with exit code 1 Looking forward to your reply

SoloTillDawn avatar Oct 10 '24 09:10 SoloTillDawn

I could not recreate the issue with the current mambular version and the example_classification.py file. Can you give a minimal example to reproduce the issue as well as information on the used version? Additionally, you could first check if updating mambular already solves the issue.

AnFreTh avatar Oct 10 '24 19:10 AnFreTh

I could not recreate the issue with the current mambular version and the example_classification.py file. Can you give a minimal example to reproduce the issue as well as information on the used version? Additionally, you could first check if updating mambular already solves the issue.

Hello author, thank you for your reply, I have solved the problem. Lightning requires >= 2.0.0.

SoloTillDawn avatar Oct 11 '24 01:10 SoloTillDawn

I will close this issue, since it seems that updating to the latest version of mambular solves the issue. Feel free to reopen if the bug reoccurs.

AnFreTh avatar Oct 17 '24 07:10 AnFreTh