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

Skip loading of the model during conversion to save on RAM usage #83

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

Conversation

Proryanator
Copy link

@Proryanator Proryanator commented Jul 23, 2024

Helps address #69 somewhat, by preventing coremltools loading the converted model/compiling it post-conversion.

I don't believe exporters is doing anything with either the compiled nor the loaded model (other than just using the spec), so it is probably fine to default to skipping loading the model. I've also seen a recent example this month publishes in swift-transformers that also skipped this step: sample code here.

However if desired, I also considered adding in a new argument that would allow users to set this themselves if we don't want to force this default behavior onto people.

I can also add a new section to the troubleshooting section specific to this error if that would be helpful.

Test setup:

M3 Max Macbook Pro with 36GB of RAM
Converting model: Undi95/MythoMax-L2-Kimiko-v2-13b (~26GB model)

Current behavior w/o this fix:
Getting a zsh: killed python3 -m exporters.coreml ... error due to running out of memory (see issue for more details).

Behavior with this fix:
Able to successfully convert the provided model and similar ones of its size (although much larger than my system's RAM will still not work). This will at least make this tool more accessible for models that should fix inside your RAM size.

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.

1 participant