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

Update type_mapping.py #1810

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update type_mapping.py #1810

wants to merge 1 commit into from

Conversation

reddyn12
Copy link

Add support for np.intc. It's the same as np.int32.

Add support for np.intc. It's the same as np.int32.
@TobyRoseman
Copy link
Collaborator

@reddyn12 - thanks for the PR. Did this fix a problem you were having?

CI: https://gitlab.com/coremltools1/coremltools/-/pipelines/819624143

@reddyn12
Copy link
Author

@TobyRoseman Ya, I'm trying to run transformers on the ANE, but had a problem with the intc type. I'm using Karpathy's implementation. Now I'm getting " File "/usr/local/lib/python3.11/site-packages/coremltools/converters/mil/backend/mil/load.py", line 279, in load
raise RuntimeError("BlobWriter not loaded")
RuntimeError: BlobWriter not loaded"

I ran the program on both my Windows pc and Mac. I'm using the code provided with the Transformers article on Apple ML website: https://machinelearning.apple.com/research/neural-engine-transformers

@reddyn12
Copy link
Author

https://github.com/reddyn12/ANEFinesse is the exact code I'm using. TorchScriptConv.py is the file.

@TobyRoseman
Copy link
Collaborator

@reddyn12 - thanks for the explanation. If you could add a unit test, that would be great.

@YifanShenSZ
Copy link
Collaborator

Hey @reddyn12, the unit test can be added to test_types.py, as a method of class TestTypeMapping. Something like

def test_numpy_int_to_coremltools(self):
    assert numpy_type_to_builtin_type(np.int32) == types.int32
    assert numpy_type_to_builtin_type(np.intc) == types.int32

should be good, thanks!

@YifanShenSZ YifanShenSZ mentioned this pull request Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants