Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extremely long run time on unit tests in GitHub actions Ubuntu environment. #409

Open
Lilferrit opened this issue Dec 3, 2024 · 3 comments · May be fixed by #407
Open

Extremely long run time on unit tests in GitHub actions Ubuntu environment. #409

Lilferrit opened this issue Dec 3, 2024 · 3 comments · May be fixed by #407
Labels
bug Something isn't working

Comments

@Lilferrit
Copy link
Contributor

The unit tests take a long time to execute in a GitHub actions Ubuntu environment, especially on the branch dev_latest_depthcharge. On this branch the past two attempts to run the unit tests in a GitHub actions Ubuntu were killed after 6 hours, but the Windows and MacOS environments both ran the unit tests within 6 minutes.

@Lilferrit Lilferrit added the bug Something isn't working label Dec 3, 2024
@Lilferrit
Copy link
Contributor Author

it looks like for any test that involves training a model the model just never starts training, but only on Ubuntu. Windows and Mac work fine. Not sure why yet.

@Lilferrit
Copy link
Contributor Author

I only ran the very first ModelRunner test on the PR for gh-pipeline-fix, and I had to manually kill the Ubuntu unit test job after about an hour. This was the full output when I killed the Ubuntu job:

Run pytest -s --cov=casanovo tests/
============================= test session starts ==============================
platform linux -- Python 3.10.15, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/runner/work/casanovo/casanovo
configfile: pyproject.toml
plugins: cov-6.0.0
collected 34 items

tests/test_integration.py s.
tests/unit_tests/test_config.py ...
tests/unit_tests/test_run_stats.py ..
INFO: GPU available: False, used: False
INFO: TPU available: False, using: 0 TPU cores
INFO: HPU available: False, using: 0 HPUs
tests/unit_tests/test_runner_small.py Initializing test configuration

Testing initialization without tokenizer (expecting RuntimeError)
Initializing tokenizer and model for training (train from scratch)
Testing inference with no model filename (expecting ValueError)
Testing inference with non-existing model filename (expecting FileNotFoundError)
Training a quick model with minimal configuration
small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, [20](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874391768?pr=407#step:7:21)48.50 spectra/s]

small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, [22](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874391768?pr=407#step:7:23)54.40 spectra/s]
INFO: 
  | Name       | Type             | Params | Mode 
--------------------------------------------------------
0 | encoder    | SpectrumEncoder  | 2.6 M  | train
1 | decoder    | PeptideDecoder   | 3.2 M  | train
2 | softmax    | Softmax          | 0      | train
3 | celoss     | CrossEntropyLoss | 0      | train
4 | val_celoss | CrossEntropyLoss | 0      | train
--------------------------------------------------------
5.8 M     Trainable params
0         Non-trainable params
5.8 M     Total params
[23](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874391768?pr=407#step:7:24).267    Total estimated model params size (MB)
42        Modules in train mode
0         Modules in eval mode
Error: The operation was canceled.

This was the output from the MacOS and Windows unit test action, both of which fully executed in under 1.5 minutes:

Run pytest -s --cov=casanovo tests/
============================= test session starts ==============================
platform darwin -- Python 3.10.15, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/runner/work/casanovo/casanovo
configfile: pyproject.toml
plugins: cov-6.0.0
collected 34 items

tests/test_integration.py s.
tests/unit_tests/test_config.py ...
tests/unit_tests/test_run_stats.py ..
INFO: GPU available: False, used: False
INFO: TPU available: False, using: 0 TPU cores
INFO: HPU available: False, using: 0 HPUs

tests/unit_tests/test_runner_small.py Initializing test configuration
small.mgf: 0 spectra [00:00, ? spectra/s]
Testing initialization without tokenizer (expecting RuntimeError)
small.mgf: 2 spectra [00:00, 1409.38 spectra/s]
Initializing tokenizer and model for training (train from scratch)
Testing inference with no model filename (expecting ValueError)
Testing inference with non-existing model filename (expecting FileNotFoundError)

Training a quick model with minimal configuration
small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, [12](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:13)51.47 spectra/s]
INFO: 
  | Name       | Type             | Params | Mode 
--------------------------------------------------------
0 | encoder    | SpectrumEncoder  | 2.6 M  | train
1 | decoder    | PeptideDecoder   | 3.2 M  | train
2 | softmax    | Softmax          | 0      | train
3 | celoss     | CrossEntropyLoss | 0      | train
4 | val_celoss | CrossEntropyLoss | 0      | train
--------------------------------------------------------
5.8 M     Trainable params
0         Non-trainable params
5.8 M     Total params
23.267    Total estimated model params size (MB)
42        Modules in train mode
0         Modules in eval mode

Training: |          | 0/? [00:00<?, ?it/s]
Training: |          | 0/? [00:00<?, ?it/s]
Epoch 0: |          | 0/? [00:00<?, ?it/s] 
Epoch 0: |          | 1/? [00:00<00:00,  2.47it/s]
Epoch 0: |          | 1/? [00:00<00:00,  2.47it/s]
INFO: `Trainer.fit` stopped: `max_epochs=1` reached.
Epoch 0: |          | 1/? [00:00<00:00,  2.44it/s]
Epoch 0: |          | 1/? [00:01<00:00,  0.91it/s]
Quick model trained and checkpoint saved at /private/var/folders/9x/gv0lxxcx5mj3ys0lwjy2hw1h0000gn/T/pytest-of-runner/pytest-0/test_initialize_model0/existing.ckpt
Resuming training from checkpoint /private/var/folders/9x/gv0lxxcx5mj3ys0lwjy2hw1h0000gn/T/pytest-of-runner/pytest-0/test_initialize_model0/existing.ckpt
Initializing model for inference with checkpoint /private/var/folders/9x/gv0lxxcx5mj3ys0lwjy2hw1h0000gn/T/pytest-of-runner/pytest-0/test_initialize_model0/existing.ckpt
Testing Spec2Pep model weight loading (expecting EOFError)
INFO: Seed set to 454
All tests for model initialization completed successfully
.

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 26.6kB/s]
INFO: Seed set to 454
INFO: Seed set to 454

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 63.1kB/s]
INFO: Seed set to 454

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 55.6kB/s]
INFO: Seed set to 454
INFO: Seed set to 454
INFO: Seed set to 454
INFO: Seed set to 454

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 52.2kB/s]

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 41.5kB/s]

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 46.4kB/s]

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 63.0kB/s]

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 65.1kB/s]

  0%|          | 0/26 [00:00<?, ?it/s]
100%|██████████| 26.0/26.0 [00:00<00:00, 64.3kB/s]

small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, 1085.76 spectra/s]

mgf_small2.mgf: 0 spectra [00:00, ? spectra/s]
mgf_small2.mgf: 2 spectra [00:00, 1043.23 spectra/s]

small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, 1614.[13](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:14) spectra/s]

mgf_small2.mgf: 0 spectra [00:00, ? spectra/s]
mgf_small2.mgf: 2 spectra [00:00, 1739.29 spectra/s]

small.mgf: 0 spectra [00:00, ? spectra/s]
small.mgf: 2 spectra [00:00, 1721.09 spectra/s]

mgf_small2.mgf: 0 spectra [00:00, ? spectra/s]
mgf_small2.mgf: 2 spectra [00:00, 1616.61 spectra/s]
tests/unit_tests/test_unit.py ....................{'peak_file': ['small.mgf', 'small.mgf', 'mgf_small2.mgf', 'mgf_small2.mgf'], 'scan_id': ['0', '1', '0', '1'], 'ms_level': tensor([2, 2, 2, 2]), 'precursor_mz': tensor([416.2448, 310.1589, 416.2448, 310.1589]), 'precursor_charge': tensor([2, 3, 2, 3]), 'mz_array': tensor([[1[14](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:15).0913, 147.1128, 243.1339, 276.1554, 330.1660, 389.2395, 443.2500,
         502.3235, 556.3341, 589.3555, 685.3767, 718.3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.1128, 162.5813, 196.0948,
         213.1052, 227.1026, 252.6368, 269.6472, 276.[15](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:16)54, 303.1607, 324.1554,
         327.[16](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:17)07, 351.6871, 391.1823, 391.6820, 416.2083, 425.2031, 455.7295,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.45[17](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:18)],
        [114.0913, 147.1128, 243.1339, 276.1554, 330.1660, 389.2395, 443.2500,
         502.3235, 556.3341, 589.3555, 685.3767, 7[18](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:19).3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.1128, 162.5813, [19](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:20)6.0948,
         213.1052, 227.1026, 252.6368, 269.6472, 276.1554, 303.1607, 324.1554,
         327.1607, 351.6871, 391.1823, 391.68[20](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:21), 416.2083, 425.2031, 455.7295,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.4517]]), 'intensity_array': tensor([[0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857],
        [0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857]]), 'seq': tensor([[11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1],
        [11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1]])}
{'peak_file': ['small.mgf', 'small.mgf', 'mgf_small2.mgf', 'mgf_small2.mgf'], 'scan_id': ['0', '1', '0', '1'], 'ms_level': tensor([2, 2, 2, 2]), 'precursor_mz': tensor([416.2448, 310.1589, 416.2448, 310.1589]), 'precursor_charge': tensor([2, 3, 2, 3]), 'mz_array': tensor([[114.0913, 147.1128, 243.1339, 276.1554, 330.1660, 389.2395, 443.2500,
         502.3235, 556.3341, 589.3555, 685.3767, 718.3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.1128, 162.5813, 196.0948,
         [21](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:22)3.1052, 227.1026, 252.6368, 269.6472, 276.1554, 303.1607, 324.1554,
         327.1607, 351.6871, 391.1823, 391.6820, 416.2083, 425.2031, 455.7295,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.4517],
        [114.0913, 147.1128, 243.1339, 276.1554, 330.1660, 389.2395, 443.2500,
         502.3235, 556.3341, 589.3555, 685.3767, 718.3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.1128, 162.5813, 196.0948,
         213.1052, [22](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:23)7.1026, 252.6368, 269.6472, 276.1554, 303.1607, 324.1554,
         327.1607, 351.6871, 391.18[23](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:24), 391.6820, 416.2083, 425.2031, 455.7295,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.4517]]), 'intensity_array': tensor([[0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857],
        [0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857]]), 'seq': tensor([[11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1],
        [11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1]])}
{'peak_file': ['small.mgf', 'small.mgf', 'mgf_small2.mgf', 'mgf_small2.mgf'], 'scan_id': ['0', '1', '0', '1'], 'ms_level': tensor([2, 2, 2, 2]), 'precursor_mz': tensor([416.[24](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:25)48, 310.1589, 416.2448, 310.1589]), 'precursor_charge': tensor([2, 3, 2, 3]), 'mz_array': tensor([[114.0913, 147.1128, 243.1339, 276.1554, 330.1660, 389.2395, 443.[25](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:26)00,
         502.3235, 556.3341, 589.3555, 685.3767, 718.3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.1128, 162.5813, 196.0948,
         213.1052, 227.10[26](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:27), 252.6368, 269.6472, 276.1554, 303.1607, 324.1554,
         327.1607, 351.6871, 391.1823, 391.6820, 416.2083, 425.2031, 455.7295,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.4517],
        [114.0913, 147.1128, 243.1339, [27](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:28)6.1554, 330.1660, 389.2395, 443.2500,
         502.3235, 556.3341, 589.3555, 685.3767, 718.3981, 813.4716,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,   0.0000,
           0.0000],
        [ 74.0600,  98.0600, 114.0550, 138.5813, 147.11[28](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:29), 162.5813, 196.0948,
         213.1052, 227.1026, 252.6368, 269.6472, 276.1554, 303.1607, 324.1554,
         327.1607, 351.6871, 391.1823, 391.6820, 416.2083, 425.2031, 455.7[29](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:30)5,
         504.2664, 538.2871, 605.3141, 653.3141, 702.3668, 782.3567, 831.4094,
         910.4517]]), 'intensity_array': tensor([[0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857],
        [0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774, 0.2774,
         0.2774, 0.2774, 0.2774, 0.2774, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000,
         0.0000, 0.0000],
        [0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857, 0.1857,
         0.1857, 0.1857]]), 'seq': tensor([[11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1],
        [11,  5, 17, 11,  9,  5, 10,  1,  0],
        [14,  5, 14, 18,  9,  4,  5, 10,  1]]), 'title': ['0', '1', '0', '1']}

small.mzml:   0%|          | 0/2 [00:00<?, ? spectra/s]
small.mzml: 100%|██████████| 2/2 [00:00<00:00, 883.76 spectra/s]

mzml_small2.mzml:   0%|          | 0/2 [00:00<?, ? spectra/s]
mzml_small2.mzml: 100%|██████████| 2/2 [00:00<00:00, 681.00 spectra/s]
WARNING: Target output directory /private/var/folders/9x/gv0lxxcx5mj3ys0lwjy2hw1h0000gn/T/pytest-of-runner/pytest-0/test_setup_output0/foo does not exists, so it will be created.
......

=============================== warnings summary ===============================
tests/unit_tests/test_runner_small.py: 4 warnings
tests/unit_tests/test_unit.py: 8 warnings
  DeprecationWarning: Deprecated hyperparameter 'every_n_train_steps' removed from the model.

tests/unit_tests/test_runner_small.py: 4 warnings
tests/unit_tests/test_unit.py: 8 warnings
  DeprecationWarning: Deprecated hyperparameter 'max_iters' removed from the model.

tests/unit_tests/test_runner_small.py: 4 warnings
tests/unit_tests/test_unit.py: 8 warnings
  DeprecationWarning: Deprecated hyperparameter 'max_length' removed from the model.

tests/unit_tests/test_runner_small.py: 4 warnings
tests/unit_tests/test_unit.py: 8 warnings
  DeprecationWarning: Deprecated hyperparameter 'save_top_k' removed from the model.

tests/unit_tests/test_runner_small.py: 4 warnings
tests/unit_tests/test_unit.py: 8 warnings
  DeprecationWarning: Deprecated hyperparameter 'model_save_folder_path' removed from the model.

tests/unit_tests/test_runner_small.py::test_initialize_model
  UserWarning: Skipping device Apple Paravirtual device that does not support Metal 2.0 (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSDevice.mm:101.)

tests/unit_tests/test_runner_small.py::test_initialize_model
  /Users/runner/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/lightning/pytorch/callbacks/model_checkpoint.py:654: Checkpoint directory /private/var/folders/9x/gv0lxxcx5mj3ys0lwjy2hw1h0000gn/T/pytest-of-runner/pytest-0/test_initialize_model0 exists and is not empty.

tests/unit_tests/test_runner_small.py::test_initialize_model
  /Users/runner/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/lightning/pytorch/trainer/connectors/data_connector.py:424: The 'train_dataloader' does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` to `num_workers=3` in the `DataLoader` to improve performance.

tests/unit_tests/test_runner_small.py::test_initialize_model
  /Users/runner/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/lightning/pytorch/trainer/connectors/data_connector.py:424: The 'val_dataloader' does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` to `num_workers=3` in the `DataLoader` to improve performance.

tests/unit_tests/test_runner_small.py::test_initialize_model
  UserWarning: Mismatching tokenizer parameter in model checkpoint (<depthcharge.tokenizers.peptides.MskbPeptideTokenizer object at 0x17364b3a0>) vs config file (<depthcharge.tokenizers.peptides.MskbPeptideTokenizer object at 0x17019b4c0>); using the checkpoint.

tests/unit_tests/test_runner_small.py::test_initialize_model
  UserWarning: Mismatching tokenizer parameter in model checkpoint (<depthcharge.tokenizers.peptides.MskbPeptideTokenizer object at 0x17364afb0>) vs config file (<depthcharge.tokenizers.peptides.MskbPeptideTokenizer object at 0x1734223b0>); using the checkpoint.

tests/unit_tests/test_unit.py::test_aa_pep_score
tests/unit_tests/test_unit.py::test_aa_pep_score
tests/unit_tests/test_unit.py::test_beam_search_decode
  RuntimeWarning: divide by zero encountered in log

tests/unit_tests/test_unit.py::test_train_val_step_functions
  /Users/runner/hostedtoolcache/Python/3.10.15/x64/lib/python3.10/site-packages/lightning/pytorch/core/module.py:445: You are trying to `self.log()` but the `self.trainer` reference is not registered on the model yet. This is most likely because the model hasn't been passed to the `Trainer`

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

--------- coverage: platform darwin, python 3.10.15-final-0 ----------
Name                              Stmts   Miss  Cover
-----------------------------------------------------
casanovo/__init__.py                  2      0   100%
casanovo/casanovo.py                235     42    82%
casanovo/config.py                   57      3    95%
casanovo/data/__init__.py             0      0   100%
casanovo/data/db_utils.py            96      6    94%
casanovo/data/ms_io.py               65     41    37%
casanovo/data/psm.py                 12      0   100%
casanovo/denovo/__init__.py           1      0   100%
casanovo/denovo/dataloaders.py       81      6    93%
casanovo/denovo/evaluate.py          71      9    87%
casanovo/denovo/model.py            379     71    81%
casanovo/denovo/model_runner.py     2[31](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:32)     94    59%
casanovo/denovo/transformers.py      22      0   100%
casanovo/utils.py                    71     35    51%
casanovo/version.py                  14      8    43%
-----------------------------------------------------
TOTAL                              1[33](https://github.com/Noble-Lab/casanovo/actions/runs/12147660649/job/33874392811?pr=407#step:7:34)7    315    76%

============ 33 passed, 1 skipped, 70 warnings in 71.91s (0:01:11) =============

I used the -s pytest flag in order to push the program output to the console as I was running the test. I also added some print statements to the test for ease of debugging. This is the full test below:

def test_initialize_model(tmp_path, mgf_small):
    """Test initializing a new or existing model."""
    print("Initializing test configuration")
    config = Config()
    config.model_save_folder_path = tmp_path

    # Test: Initializing model without initializing tokenizer raises an error
    print("Testing initialization without tokenizer (expecting RuntimeError)")
    with pytest.raises(RuntimeError):
        ModelRunner(config=config).initialize_model(train=True)

    # Test: No model filename given, so train from scratch
    print("Initializing tokenizer and model for training (train from scratch)")
    runner = ModelRunner(config=config)
    runner.initialize_tokenizer()
    runner.initialize_model(train=True)

    # Test: No model filename given during inference = error
    print("Testing inference with no model filename (expecting ValueError)")
    with pytest.raises(ValueError):
        runner = ModelRunner(config=config)
        runner.initialize_tokenizer()
        runner.initialize_model(train=False)

    # Test: Non-existing model filename during inference = error
    print(
        "Testing inference with non-existing model filename (expecting FileNotFoundError)"
    )
    with pytest.raises(FileNotFoundError):
        runner = ModelRunner(config=config, model_filename="blah")
        runner.initialize_tokenizer()
        runner.initialize_model(train=False)

    # Train a quick model
    print("Training a quick model with minimal configuration")
    config.max_epochs = 1
    config.n_layers = 1
    ckpt = tmp_path / "existing.ckpt"
    with ModelRunner(config=config, output_dir=tmp_path) as runner:
        runner.train([mgf_small], [mgf_small])
        runner.trainer.save_checkpoint(ckpt)
    print(f"Quick model trained and checkpoint saved at {ckpt}")

    # Test: Resume training from previous model
    print(f"Resuming training from checkpoint {ckpt}")
    runner = ModelRunner(config=config, model_filename=str(ckpt))
    runner.initialize_tokenizer()
    runner.initialize_model(train=True)

    # Test: Inference with previous model
    print(f"Initializing model for inference with checkpoint {ckpt}")
    runner = ModelRunner(config=config, model_filename=str(ckpt))
    runner.initialize_tokenizer()
    runner.initialize_model(train=False)

    # Test: Spec2Pep model tries to load weights and throws EOFError
    print("Testing Spec2Pep model weight loading (expecting EOFError)")
    weights = tmp_path / "blah"
    weights.touch()
    with pytest.raises(EOFError):
        runner = ModelRunner(config=config, model_filename=str(weights))
        runner.initialize_tokenizer()
        runner.initialize_model(train=False)

    print("All tests for model initialization completed successfully")

@Lilferrit
Copy link
Contributor Author

I tried running the test on one of the cluster machines and got this error:

platform linux -- Python 3.10.15, pytest-8.3.4, pluggy-1.5.0
rootdir: /net/noble/vol1/home/gstrau2/casanovo
configfile: pyproject.toml
collecting ... Fatal Python error: Illegal instruction

Current thread 0x000015244f68e440 (most recent call first):
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 1176 in create_module
  File "<frozen importlib._bootstrap>", line 571 in module_from_spec
  File "<frozen importlib._bootstrap>", line 674 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/polars/__init__.py", line 15 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/depthcharge/utils.py", line 5 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/depthcharge/primitives.py", line 20 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/depthcharge/data/preprocessing.py", line 48 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/depthcharge/data/__init__.py", line 3 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1078 in _handle_fromlist
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/depthcharge/__init__.py", line 14 in <module>
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 883 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 241 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 992 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "/net/noble/vol1/home/gstrau2/casanovo/tests/unit_tests/test_runner_small.py", line 7 in <module>
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 184 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1050 in _gcd_import
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/importlib/__init__.py", line 126 in import_module
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/pathlib.py", line 587 in import_path
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/python.py", line 493 in importtestmodule
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/python.py", line 546 in _getobj
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/python.py", line 284 in obj
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/python.py", line 562 in _register_setup_module_fixture
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/python.py", line 549 in collect
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/runner.py", line 389 in collect
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/runner.py", line 341 in from_call
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/runner.py", line 391 in pytest_make_collect_report
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/runner.py", line 567 in collect_one_node
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 835 in _collect_one_node
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 970 in genitems
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 975 in genitems
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 975 in genitems
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 975 in genitems
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 809 in perform_collect
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 347 in pytest_collection
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 336 in _main
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 283 in wrap_session
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/main.py", line 330 in pytest_cmdline_main
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/lib/python3.10/site-packages/_pytest/config/__init__.py", line 201 in console_main
  File "/net/noble/vol1/home/gstrau2/miniconda3/envs/deptcharge_upgrade/bin/pytest", line 8 in <module>

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, lxml._elementpath, lxml.etree, sqlalchemy.cyextension.collections, sqlalchemy.cyextension.immutabledict, sqlalchemy.cyextension.processors, sqlalchemy.cyextension.resultproxy, sqlalchemy.cyextension.util, greenlet._greenlet, pyarrow.lib, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pyarrow._compute, pandas._libs.ops, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, yaml._yaml, torch._C, torch._C._dynamo.autograd_compiler, torch._C._dynamo.eval_frame, torch._C._dynamo.guards, torch._C._dynamo.utils, torch._C._fft, torch._C._linalg, torch._C._nested, torch._C._nn, torch._C._sparse, torch._C._special, PIL._imaging, rdkit.rdBase, rdkit.DataStructs.cDataStructs, rdkit.Chem.rdchem, rdkit.Geometry.rdGeometry, rdkit.Chem.rdinchi, rdkit.Chem.rdCIPLabeler, rdkit.Chem.rdmolfiles, rdkit.Chem.rdmolops, rdkit.Chem.rdMolInterchange, rdkit.Chem.rdCoordGen, rdkit.Chem.rdDepictor, rdkit.Chem.Draw.rdMolDraw2D, scipy._lib._ccallback_c, numba.core.typeconv._typeconv, numba._helperlib, numba._dynfunc, numba._dispatcher, numba.core.runtime._nrt_python, numba.np.ufunc._internal, numba.experimental.jitclass._box (total: 96)
Illegal instruction (core dumped)

@bittremieux bittremieux linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant