EmmaRocheteau / TPC-LoS-prediction

This repository contains the code used for Temporal Pointwise Convolutional Networks for Length of Stay Prediction in the Intensive Care Unit (https://dl.acm.org/doi/10.1145/3450439.3451860).
https://dl.acm.org/doi/10.1145/3450439.3451860
MIT License
76 stars 25 forks source link

Channel mismatch in model_type 'tpc' #17

Closed SewoongLee closed 1 year ago

SewoongLee commented 1 year ago

Command python -m models.run_tpc --model_type tpc --mode test --n_epochs 5

Error Traceback (most recent call last): File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\git\cs598_replication_tpc_los_prediction\models\run_tpc.py", line 39, in <module> run_tpc() File "D:\git\cs598_replication_tpc_los_prediction\models\run_tpc.py", line 34, in run_tpc tpc.run() File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\trixi\experiment\experiment.py", line 108, in run self.process_err(e) File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\trixi\experiment\pytorchexperiment.py", line 391, in process_err raise e File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\trixi\experiment\experiment.py", line 90, in run self.validate(epoch=self._epoch_idx) File "D:\git\cs598_replication_tpc_los_prediction\models\experiment_template.py", line 221, in validate self.test() File "D:\git\cs598_replication_tpc_los_prediction\models\experiment_template.py", line 254, in test y_hat_los, y_hat_mort = self.model(padded, diagnoses, flat) File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "D:\git\cs598_replication_tpc_los_prediction\models\tpc_model.py", line 618, in forward diagnoses_enc = self.relu(self.main_dropout(self.bn_diagnosis_encoder(self.diagnosis_encoder(diagnoses)))) # B * diagnosis_size File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "D:\git\cs598_replication_tpc_los_prediction\models\tpc_model.py", line 78, in forward training=True, momentum=exponential_average_factor, eps=self.eps) # set training to True so it calculates the norm of the batch File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\functional.py", line 2279, in batch_norm _verify_batch_size(input.size()) File "C:\Users\sewoo\AppData\Local\Programs\Python\Python36\lib\site-packages\torch\nn\functional.py", line 2247, in _verify_batch_size raise ValueError("Expected more than 1 value per channel when training, got input size {}".format(size)) ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 64])

I will share here when I solve this issue, and please let me know if anybody know the solution of this error.

SewoongLee commented 1 year ago

I think mode --test is not working in my environment by itself.