-
Notifications
You must be signed in to change notification settings - Fork 43
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
Add M1 MacOS runner to github actions jobs #370
Add M1 MacOS runner to github actions jobs #370
Conversation
Question: do we want to remove It seems that currently, |
Thanks for working on this @GenevieveBuckley! Let's keep |
I fixed #373 @GenevieveBuckley. Once you merge |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev #370 +/- ##
==========================================
+ Coverage 39.72% 47.40% +7.68%
==========================================
Files 33 35 +2
Lines 4179 3955 -224
==========================================
+ Hits 1660 1875 +215
+ Misses 2519 2080 -439 ☔ View full report in Codecov by Sentry. |
Oh no, memory problems
The We can either mark some of the tests as memory hungry, and skip them on the I also saw that according to this page:
|
It is a bit strange that this test runs out of memory. The test data for this is tiny, a 10x10 array with a single binary mask: Maybe something in https://github.com/computational-cell-analytics/micro-sam/blob/master/micro_sam/_vendored.py#L29 is still very memory inefficient on MPS?! If you have time you could maybe memory profile it on MPS again? Otherwise we have to skip this test in CI. |
Possibly it is not that specific test that causes a lot of memory use, but maybe memory is not being cleared properly from previous tests? I'm only guessing right now. These are the results I got from pytest-memray: pytest --memray (click to expand)
(micro-sam-dev) genevieb@Admins-MacBook-Pro micro-sam % pytest --memray
============================= test session starts ==============================
platform darwin -- Python 3.11.7, pytest-8.0.0, pluggy-1.4.0 -- /Users/genevieb/mambaforge/envs/micro-sam-dev/bin/python3.11
cachedir: .pytest_cache
PyQt5 5.15.10 -- Qt runtime 5.15.12 -- Qt compiled 5.15.11
rootdir: /Users/genevieb/Documents/GitHub/micro-sam
configfile: pyproject.toml
plugins: cov-4.1.0, napari-plugin-engine-0.2.0, memray-1.5.0, qt-4.3.1, napari-0.4.19, npe2-0.7.3
collected 34 items
test/test_instance_segmentation.py::TestInstanceSegmentation::test_automatic_mask_generator PASSED [ 2%]
test/test_instance_segmentation.py::TestInstanceSegmentation::test_tiled_automatic_mask_generator PASSED [ 5%]
test/test_multi_dimensional_segmentation.py::TestMultiDimensionalSegmentation::test_merge_instance_segmentation_3d PASSED [ 8%]
test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_box PASSED [ 11%]
test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_box_and_points PASSED [ 14%]
test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_mask PASSED [ 17%]
test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_mask_non_square PASSED [ 20%]
test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_points PASSED [ 23%]
test/test_prompt_generators.py::TestPromptGenerators::test_box_prompt_generator PASSED [ 26%]
test/test_prompt_generators.py::TestPromptGenerators::test_iterative_prompt_generator PASSED [ 29%]
test/test_prompt_generators.py::TestPromptGenerators::test_point_prompt_generator PASSED [ 32%]
test/test_sam_annotator/test_annotator_2d.py::test_annotator_2d PASSED [ 35%]
test/test_sam_annotator/test_annotator_3d.py::test_annotator_3d PASSED [ 38%]
test/test_sam_annotator/test_annotator_tracking.py::test_annotator_tracking PASSED [ 41%]
test/test_sam_annotator/test_cli.py::TestCLI::test_annotator_2d PASSED [ 44%]
test/test_sam_annotator/test_cli.py::TestCLI::test_annotator_3d PASSED [ 47%]
test/test_sam_annotator/test_cli.py::TestCLI::test_annotator_tracking PASSED [ 50%]
test/test_sam_annotator/test_cli.py::TestCLI::test_image_series_annotator PASSED [ 52%]
test/test_sam_annotator/test_cli.py::TestCLI::test_precompute_embeddings PASSED [ 55%]
test/test_sam_annotator/test_image_series_annotator.py::test_image_series_annotator PASSED [ 58%]
test/test_sam_annotator/test_image_series_annotator.py::test_image_folder_annotator PASSED [ 61%]
test/test_sam_annotator/test_state.py::TestState::test_state_for_interactive_segmentation PASSED [ 64%]
test/test_sam_annotator/test_state.py::TestState::test_state_for_tracking PASSED [ 67%]
test/test_sam_annotator/test_widgets.py::test_embedding_widget PASSED [ 70%]
test/test_training.py::TestTraining::test_training PASSED [ 73%]
test/test_util.py::TestUtil::test_compute_iou PASSED [ 76%]
test/test_util.py::TestUtil::test_get_device PASSED [ 79%]
test/test_util.py::TestUtil::test_get_sam_model PASSED [ 82%]
test/test_util.py::TestUtil::test_segmentation_to_one_hot PASSED [ 85%]
test/test_util.py::TestUtil::test_tiled_prediction PASSED [ 88%]
test/test_vendored.py::TestVendored::test_cpu_batched_mask_to_box PASSED [ 91%]
test/test_vendored.py::TestVendored::test_cuda_batched_mask_to_box SKIPPED [ 94%]
test/test_vendored.py::TestVendored::test_mask_to_rle_pytorch PASSED [ 97%]
test/test_vendored.py::TestVendored::test_mps_batched_mask_to_box PASSED [100%]
=============================== warnings summary ===============================
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/timm/models/layers/__init__.py:49
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/timm/models/layers/__init__.py:49: DeprecationWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", DeprecationWarning)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/timm/models/registry.py:4
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/timm/models/registry.py:4: DeprecationWarning: Importing from timm.models.registry is deprecated, please import via timm.models
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", DeprecationWarning)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656: UserWarning: Overwriting tiny_vit_5m_224 in registry with mobile_sam.modeling.tiny_vit_sam.tiny_vit_5m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
return register_model(fn_wrapper)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656: UserWarning: Overwriting tiny_vit_11m_224 in registry with mobile_sam.modeling.tiny_vit_sam.tiny_vit_11m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
return register_model(fn_wrapper)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656: UserWarning: Overwriting tiny_vit_21m_224 in registry with mobile_sam.modeling.tiny_vit_sam.tiny_vit_21m_224. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
return register_model(fn_wrapper)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656: UserWarning: Overwriting tiny_vit_21m_384 in registry with mobile_sam.modeling.tiny_vit_sam.tiny_vit_21m_384. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
return register_model(fn_wrapper)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:656: UserWarning: Overwriting tiny_vit_21m_512 in registry with mobile_sam.modeling.tiny_vit_sam.tiny_vit_21m_512. This is because the name being registered conflicts with an existing name. Please check if this is not expected.
return register_model(fn_wrapper)
../../../mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/napari/layers/utils/layer_utils.py:10
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/napari/layers/utils/layer_utils.py:10: DeprecationWarning:
Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),
(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)
but was not found to be installed on your system.
If this would cause problems for you,
please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466
import pandas as pd
test/test_training.py::TestTraining::test_training
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch_em/util/util.py:169: UserWarning: Constructor arguments for <class 'micro_sam.training.trainable_sam.TrainableSAM'> cannot be deduced.For this object, empty constructor arguments will be used.Hence, the trainer can probably not be correctly deserialized via 'DefaultTrainer.from_checkpoint'.
warnings.warn(
test/test_training.py::TestTraining::test_training
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch_em/util/util.py:169: UserWarning: Constructor arguments for <class 'micro_sam.training.util.ConvertToSamInputs'> cannot be deduced.For this object, empty constructor arguments will be used.Hence, the trainer can probably not be correctly deserialized via 'DefaultTrainer.from_checkpoint'.
warnings.warn(
test/test_training.py::TestTraining::test_training
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch_em/util/util.py:169: UserWarning: Constructor arguments for <class 'torch.nn.modules.loss.MSELoss'> cannot be deduced.For this object, empty constructor arguments will be used.Hence, the trainer can probably not be correctly deserialized via 'DefaultTrainer.from_checkpoint'.
warnings.warn(
test/test_training.py::TestTraining::test_training
/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch_em/util/util.py:169: UserWarning: Constructor arguments for <class 'micro_sam.prompt_generators.IterativePromptGenerator'> cannot be deduced.For this object, empty constructor arguments will be used.Hence, the trainer can probably not be correctly deserialized via 'DefaultTrainer.from_checkpoint'.
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================ MEMRAY REPORT =================================
Allocation results for test/test_sam_annotator/test_widgets.py::test_embedding_widget at the high watermark
📦 Total memory allocated: 306.6MiB
📏 Total allocations: 778579
📊 Histogram of allocation sizes: |▂ █ ▂ |
🥇 Biggest allocating functions:
- batch_norm:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/functional.py:2478 -> 64.0MiB
- forward:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/activation.py:682 -> 64.0MiB
- _conv_forward:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/conv.py:456 -> 64.0MiB
- forward:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/activation.py:682 -> 16.0MiB
- batch_norm:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/functional.py:2478 -> 16.0MiB
Allocation results for test/test_sam_annotator/test_annotator_2d.py::test_annotator_2d at the high watermark
📦 Total memory allocated: 135.9MiB
📏 Total allocations: 1713510
📊 Histogram of allocation sizes: |▁ ▄ █ |
🥇 Biggest allocating functions:
- load_tensor:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/serialization.py:1357 -> 38.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- get_app:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/napari/_qt/qt_event_loop.py:184 -> 5.8MiB
- train:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:257 -> 4.7MiB
Allocation results for test/test_sam_annotator/test_annotator_3d.py::test_annotator_3d at the high watermark
📦 Total memory allocated: 103.6MiB
📏 Total allocations: 2164506
📊 Histogram of allocation sizes: |▃ █ ▁ |
🥇 Biggest allocating functions:
- load_tensor:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/serialization.py:1357 -> 38.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- train:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:257 -> 4.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 4.5MiB
Allocation results for test/test_sam_annotator/test_image_series_annotator.py::test_image_folder_annotator at the high watermark
📦 Total memory allocated: 103.6MiB
📏 Total allocations: 1339806
📊 Histogram of allocation sizes: |▃ █ ▁ |
🥇 Biggest allocating functions:
- load_tensor:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/serialization.py:1357 -> 38.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- train:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:257 -> 4.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 4.5MiB
Allocation results for test/test_sam_annotator/test_annotator_tracking.py::test_annotator_tracking at the high watermark
📦 Total memory allocated: 102.6MiB
📏 Total allocations: 2174561
📊 Histogram of allocation sizes: |▃ █ ▁ |
🥇 Biggest allocating functions:
- load_tensor:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/serialization.py:1357 -> 38.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 6.0MiB
- train:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/mobile_sam/modeling/tiny_vit_sam.py:257 -> 4.7MiB
- __init__:/Users/genevieb/mambaforge/envs/micro-sam-dev/lib/python3.11/site-packages/torch/nn/modules/linear.py:96 -> 4.5MiB
---------- coverage: platform darwin, python 3.11.7-final-0 ----------
Name Stmts Miss Cover Missing
---------------------------------------------------------------------------------
micro_sam/__init__.py 3 0 100%
micro_sam/__version__.py 1 0 100%
micro_sam/_test_util.py 11 0 100%
micro_sam/_vendored.py 85 28 67% 17-21, 43, 86-97, 101-107, 129, 136-142
micro_sam/evaluation/__init__.py 4 0 100%
micro_sam/evaluation/evaluation.py 32 3 91% 61, 72-73
micro_sam/evaluation/experiments.py 28 21 25% 29-49, 61-67, 78-83
micro_sam/evaluation/inference.py 226 97 57% 39-44, 53-64, 120, 165, 190-194, 198-210, 227-257, 263-277, 287-290, 330, 333, 350, 373, 375, 383-384, 386-387, 416-418, 454, 459, 491, 505, 538-563, 579-603
micro_sam/evaluation/instance_segmentation.py 135 112 17% 23-28, 50-54, 81-95, 112-132, 136-143, 191-235, 258-285, 306-321, 326-339, 371-386
micro_sam/evaluation/livecell.py 172 172 0% 5-415
micro_sam/evaluation/model_comparison.py 236 236 0% 4-435
micro_sam/inference.py 60 6 90% 55, 58, 66, 69, 75, 82
micro_sam/instance_segmentation.py 383 154 60% 31-32, 44, 47-48, 81, 83, 180-181, 187-225, 230, 238, 242, 259-260, 300, 363-366, 374, 404, 424, 458, 462, 503, 536-541, 545, 553, 678-680, 696-709, 712-733, 751-800, 825-833, 839, 857-879, 882-919, 946-962
micro_sam/multi_dimensional_segmentation.py 102 74 27% 50-141, 184-217
micro_sam/precompute_state.py 72 56 22% 42-79, 85-91, 97-100, 136-147, 156-174, 182
micro_sam/prompt_based_segmentation.py 200 85 58% 57-60, 90-92, 124-125, 133-134, 142-169, 173-188, 192-202, 210-219, 223-224, 233-237, 298, 300, 349-360, 366-368, 383, 394, 397, 437, 439, 474-480, 495, 497
micro_sam/prompt_generators.py 129 8 94% 52, 101, 175-182, 302
micro_sam/sam_annotator/__init__.py 4 0 100%
micro_sam/sam_annotator/_annotator.py 70 7 90% 11, 80, 84, 88, 92, 97, 150
micro_sam/sam_annotator/_state.py 69 11 84% 82, 91-102, 114-125
micro_sam/sam_annotator/_widgets.py 237 172 27% 25, 33-44, 50, 56-57, 63-76, 81-101, 106-109, 120, 125-128, 155-156, 167-186, 202-203, 222-246, 251-275, 296-319, 326-343, 348-377, 389-422, 444-465, 480-516
micro_sam/sam_annotator/annotator_2d.py 37 12 68% 77, 91, 96-109
micro_sam/sam_annotator/annotator_3d.py 57 21 63% 24-34, 102, 116, 121-133
micro_sam/sam_annotator/annotator_tracking.py 105 23 78% 33, 38-39, 47-50, 64-67, 76-79, 232, 246, 251-275
micro_sam/sam_annotator/gui_utils.py 41 41 0% 1-75
micro_sam/sam_annotator/image_series_annotator.py 88 43 51% 27-35, 87, 103-106, 113-141, 147, 151, 185-227
micro_sam/sam_annotator/util.py 266 237 11% 26-32, 37-84, 96-97, 122-149, 171-225, 240-253, 271-292, 304-362, 370-422, 427-437, 441-443, 453-543
micro_sam/sample_data.py 145 110 24% 41-57, 71-77, 91-102, 112-116, 130-140, 150-154, 167-178, 188-192, 206-221, 231-238, 256-271, 281-288, 301-317, 327-334, 345, 347-348, 367-378
micro_sam/training/__init__.py 3 0 100%
micro_sam/training/joint_sam_trainer.py 127 106 17% 23-26, 29-36, 39-58, 61-67, 70-114, 117-155, 161-167, 170-177, 182-189, 194-200
micro_sam/training/sam_trainer.py 221 18 92% 84-107, 316
micro_sam/training/trainable_sam.py 44 0 100%
micro_sam/training/util.py 107 31 71% 57-66, 115, 192-194, 197-211, 216-218, 221-236
micro_sam/util.py 363 101 72% 28-30, 35-36, 40-41, 152, 155, 163, 188, 192, 266, 273, 275, 297-299, 349, 381-383, 401-404, 441-485, 562-606, 664, 686, 709, 711, 717, 795-802, 820
micro_sam/visualization.py 92 92 0% 4-169
---------------------------------------------------------------------------------
TOTAL 3955 2077 47%
Coverage XML written to file coverage.xml
============================= slowest 10 durations =============================
75.87s call test/test_training.py::TestTraining::test_training
18.82s call test/test_instance_segmentation.py::TestInstanceSegmentation::test_automatic_mask_generator
16.62s call test/test_instance_segmentation.py::TestInstanceSegmentation::test_tiled_automatic_mask_generator
6.52s setup test/test_instance_segmentation.py::TestInstanceSegmentation::test_automatic_mask_generator
6.38s call test/test_sam_annotator/test_annotator_2d.py::test_annotator_2d
3.61s call test/test_prompt_based_segmentation.py::TestPromptBasedSegmentation::test_segment_from_mask
3.09s call test/test_sam_annotator/test_annotator_3d.py::test_annotator_3d
2.97s call test/test_sam_annotator/test_annotator_tracking.py::test_annotator_tracking
2.35s call test/test_sam_annotator/test_image_series_annotator.py::test_image_series_annotator
2.24s call test/test_util.py::TestUtil::test_tiled_prediction
============ 33 passed, 1 skipped, 12 warnings in 165.13s (0:02:45) ============
(micro-sam-dev) genevieb@Admins-MacBook-Pro micro-sam % |
@GenevieveBuckley I only see memory profiles for some of the tests:
Could you maybe rerun it only for |
Yes, that's what I see too. I can't make it produce any more information than that.
I'm sorry, when I tried this earlier there was no output. The "MEMRAY REPORT" section heading still appears in the pytest output, but no contents below it and the next lines of text are the test coverage information. Here's a copy of those (lack of) results: Details (click to expand)
======================================== test session starts =========================================
platform darwin -- Python 3.11.7, pytest-8.0.0, pluggy-1.4.0 -- /Users/genevieb/mambaforge/envs/micro-sam-dev/bin/python3.11
cachedir: .pytest_cache
PyQt5 5.15.10 -- Qt runtime 5.15.12 -- Qt compiled 5.15.11
rootdir: /Users/genevieb/Documents/GitHub/micro-sam
configfile: pyproject.toml
plugins: cov-4.1.0, napari-plugin-engine-0.2.0, qt-4.3.1, napari-0.4.19, memray-1.5.1.dev12+g1549d62, npe2-0.7.3
collected 1 item
test/test_vendored.py::TestVendored::test_mps_batched_mask_to_box PASSED [100%]
=========================================== MEMRAY REPORT ============================================
---------- coverage: platform darwin, python 3.11.7-final-0 ----------
Name Stmts Miss Cover Missing
---------------------------------------------------------------------------------
micro_sam/__init__.py 3 0 100%
micro_sam/__version__.py 1 0 100%
micro_sam/_test_util.py 11 11 0% 1-22
micro_sam/_vendored.py 85 46 46% 17-21, 43, 49, 77, 86-97, 101-107, 122-150
micro_sam/evaluation/__init__.py 4 4 0% 4-17
micro_sam/evaluation/evaluation.py 32 32 0% 5-75
micro_sam/evaluation/experiments.py 28 28 0% 4-83
micro_sam/evaluation/inference.py 226 226 0% 4-603
micro_sam/evaluation/instance_segmentation.py 135 135 0% 4-386
micro_sam/evaluation/livecell.py 172 172 0% 5-415
micro_sam/evaluation/model_comparison.py 236 236 0% 4-435
micro_sam/inference.py 60 60 0% 1-148
micro_sam/instance_segmentation.py 383 383 0% 7-962
micro_sam/multi_dimensional_segmentation.py 102 102 0% 4-259
micro_sam/precompute_state.py 72 72 0% 4-182
micro_sam/prompt_based_segmentation.py 200 200 0% 5-499
micro_sam/prompt_generators.py 129 129 0% 6-350
micro_sam/sam_annotator/__init__.py 4 4 0% 4-7
micro_sam/sam_annotator/_annotator.py 70 70 0% 1-160
micro_sam/sam_annotator/_state.py 69 69 0% 6-140
micro_sam/sam_annotator/_widgets.py 237 237 0% 4-516
micro_sam/sam_annotator/annotator_2d.py 37 37 0% 1-109
micro_sam/sam_annotator/annotator_3d.py 57 57 0% 1-133
micro_sam/sam_annotator/annotator_tracking.py 105 105 0% 1-275
micro_sam/sam_annotator/gui_utils.py 41 41 0% 1-75
micro_sam/sam_annotator/image_series_annotator.py 88 88 0% 1-227
micro_sam/sam_annotator/util.py 266 266 0% 1-543
micro_sam/sample_data.py 145 145 0% 15-378
micro_sam/training/__init__.py 3 3 0% 4-6
micro_sam/training/joint_sam_trainer.py 127 127 0% 1-200
micro_sam/training/sam_trainer.py 221 221 0% 1-447
micro_sam/training/trainable_sam.py 44 44 0% 1-128
micro_sam/training/util.py 107 107 0% 1-236
micro_sam/util.py 363 363 0% 5-841
micro_sam/visualization.py 92 92 0% 4-169
---------------------------------------------------------------------------------
TOTAL 3955 3912 1%
Coverage XML written to file coverage.xml
======================================== slowest 10 durations ========================================
0.16s call test/test_vendored.py::TestVendored::test_mps_batched_mask_to_box
0.05s setup test/test_vendored.py::TestVendored::test_mps_batched_mask_to_box
0.00s teardown test/test_vendored.py::TestVendored::test_mps_batched_mask_to_box
========================================= 1 passed in 2.09s ========================================= I don't know if the reason for this is that the test actually doesn't use much memory at all (like you expect). Maybe there are memory leaks elsewhere, and this test just happens to be when the memory is full, but not the cause? I tried to test this by adding the pytest-memray marker to limit leaks Other things we could try:
|
Getting closer. I made a mistake with my earlier memory leak tests, and forgot to decorate the files
I'm trying to reduce the problem by deleting variables, running the garbage collector, and emptying the pytorch cache. That seems to help a bit, but it's not great yet. |
Here's a test, we'll see if this helps the EDIT: the changes don't seem to have made any difference 😢 |
Ok, that's good to know! This might point to a problem with the napari test infrastructure though?!
That's too bad :(. I still find it curious that it's always For now, I suggest we skip this test and go ahead with the PR. |
I don't think so? I think that because:
I don't think this is curious. The tests are always collected and run in the same order
|
You're right - it doesn't matter which order the tests run in (thanks pytest-randomly), That is very weird. |
I give up. I do not know why that test fails. I've made an issue here: #380 and have skipped the test if it is running on github actions. |
My best guess is the following:
In any case, thanks for looking into this!! At least we now know that these issues are there. |
b64a692
into
computational-cell-analytics:dev
Closes #369
https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/