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

Memory Requirements and iOS Support? #2

Closed
Lukas1h opened this issue Oct 12, 2022 · 6 comments
Closed

Memory Requirements and iOS Support? #2

Lukas1h opened this issue Oct 12, 2022 · 6 comments

Comments

@Lukas1h
Copy link

Lukas1h commented Oct 12, 2022

Dose this run on mobile devices? If so, what are the memory requierments?

@liuliu
Copy link
Owner

liuliu commented Oct 12, 2022

It should, haven't tried.

Consumes about 4GiB.

@liuliu liuliu closed this as completed Oct 12, 2022
@Lukas1h
Copy link
Author

Lukas1h commented Oct 14, 2022

Thanks. How would one go about converting the model to fp16?

@liuliu
Copy link
Owner

liuliu commented Oct 15, 2022

You can load f32 weights into a f16 model and then write the f16 model weights out. Current txt2img/main.swift example loads f32 weights into f16 model. You can then just add additional:

graph.openStore("xxx.ckpt") {
  $0.write("unet", model: unet)
  $0.write("decoder", model: decoder)
}

and the new file will be f16 weights.

@Lukas1h
Copy link
Author

Lukas1h commented Oct 15, 2022

Would this decrease memory usage under 3gb? Thanks again for the help!

@liuliu
Copy link
Owner

liuliu commented Oct 15, 2022

No. Model already running at f16 with f16 weights. It just affects files stored on disk. FP16 already runs at around 3.3GiB including all the models (text model, unet and decoder). The extra 0.7 is from MPS implicit tensors which can be further reduced by just running one op at a time (slower).

@Lukas1h Lukas1h changed the title iOS? Memory Requirements and iOS Support? Nov 19, 2022
@Lukas1h
Copy link
Author

Lukas1h commented Nov 19, 2022

Have the memory requirements changed since being published on the App Store?
This issue seems to lead me to believe so.

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

No branches or pull requests

2 participants