apple / apple/coremltools

Model initialized with `skip_model_load` does not have a compiled path

Open
#2,073 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.4k
Forks
850
Avg merge
4d 5h
Merged PRs (30d)
10

Description

Code:
```python
import coremltools as ct

m = ct.models.MLModel("", skip_model_load=True)
m.get_compiled_model_path()
```
Outputs:
```
----> 1 m.get_compiled_model_path()

File ~/miniforge3/envs/prod/lib/python3.8/site-packages/coremltools/models/model.py:528, in MLModel.get_compiled_model_path(self)
520 def get_compiled_model_path(self):
521 """
522 Returns the path for the underlying compiled ML Model.
523
(...)
526
527 """
--> 528 return self.__proxy__.get_compiled_model_path()

AttributeError: 'NoneType' object has no attribute 'get_compiled_model_path'
```
Correct behavior:
Return `None` without error.

Contributor guide

Open the contributing guide

Research direction

Start in coremltools/models/model.py at MLModel.get_compiled_model_path(), then trace how skip_model_load=True leaves __proxy__ unset. Reproduce the shown call and confirm that it returns None without raising an AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.