_python_version in coremltools/models/utils.py doesn't handle RCs and other possible versions
Maintainers usually reply within 5 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- machine-learning, testing-qa
Research direction
Start in coremltools/models/utils.py at _python_version and reproduce with Python 3.15.0rc2. Run the listed tests, especially test/ml_program/experimental/test_perf_utils.py and converters/mil/frontend/torch/test/test_torch_ops.py. Done means prerelease versions no longer raise during version checks and the affected tests pass.
Written by the indexing model from the issue text.
Description
🐞Describing the bug
When using with a python pre-release such as 3.15.0rc2 the _python_version function errors out because it's only expecting integers.
Stack Trace
ValueError: invalid literal for int() with base 10: '0rc2'
Check import: coremltools.converters.mil.frontend.milproto.test_load
Traceback (most recent call last):
File "/usr/lib/rpm/redhat/import_all_modules.py", line 106, in import_modules
importlib.import_module(module)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/lib64/python3.15/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1390, in _gcd_import
File "<frozen importlib._bootstrap>", line 1350, in _find_and_load
File "<frozen importlib._bootstrap>", line 1309, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 915, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 747, in exec_module
File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/milproto/test_load.py", line 34, in <module>
from coremltools.converters.mil.frontend.torch.test.test_torch_ops import TestScriptedModels
File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py", line 7394, in <module>
class TestSlice(TorchBaseTest):
...<70 lines>...
)
File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/converters/mil/frontend/torch/test/test_torch_ops.py", line 7414, in TestSlice
@pytest.mark.skipif(_python_version() < (3, 6), reason="requires python 3.6")
~~~~~~~~~~~~~~~^^
File "/builddir/build/BUILD/python-coremltools-9.0-build/BUILDROOT/usr/lib/python3.15/site-packages/coremltools/models/utils.py", line 979, in _python_version
version = list(map(int, list(version.split("."))))
ValueError: invalid literal for int() with base 10: '0rc2'
To Reproduce
- Please add a minimal code example that can reproduce the error when running it.
The following tests in coremltools use the _python_version, running them with a python RC release such as 3.15rc2 should be enough to reproduce this.
coremltools/test/ml_program/experimental/test_perf_utils.py
coremltools/test/ml_program/experimental/test_perf_utils.py
coremltools/converters/mil/frontend/torch/test/test_torch_conversion_api.py
coremltools/converters/mil/frontend/torch/test/test_torch_ops.py
coremltools/converters/mil/frontend/torch/test/test_torch_ops.py
- If the model conversion succeeds, but there is a numerical mismatch in predictions, please include the code used for comparisons.
N/A
System environment (please complete the following information):
- coremltools version: 9.0
- OS (e.g. MacOS version or Linux type): Fedora 45 Beta
- Any other relevant version information (e.g. PyTorch or TensorFlow version): Python 3.15.0rc2
Additional context
- Add anything else about the problem here that you want to share.
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 852
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 8
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/coremltools
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apple/coremltools#2826 · 2 comments ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apple/coremltools#2728 ·
Maintainers usually reply within 5 days
-
FP8 support?Openquestion
Difficulty 5/5 Over a week Newbie friendliness 35/100
apple/coremltools#2860 ·
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
apple/coremltools#2853 ·
Maintainers usually reply within 5 days
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 58/100
apple/coremltools#2847 · 4 comments ·
Maintainers usually reply within 5 days
All issues in apple/coremltools
Similar issues
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
workflow: a tick's dispatch counts as 'only this step', and no review self-grants a round unattendedOpenworkflow
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kristofdegrave/homeassistant-smart-charging#1505 ·
Maintainers usually reply within 1 day
-
metadata submission
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
canonical/content-cache-operator#163 · 1 comment ·
Maintainers usually reply within 1 day
-
[submission]Opensubmission
Difficulty 1/5 Under an hour Newbie friendliness 65/100
leanprover/lean-eval-submissions#1852 ·
Maintainers usually reply within 1 day