huggingface / swift-chat

Mac app to demonstrate swift-transformers
Apache License 2.0
491 stars 37 forks source link

Model loads twice #21

Open Proryanator opened 3 months ago

Proryanator commented 3 months ago

Hey there! I noticed especially when loading large models, the model is loaded once, then unloaded from memory, then re-loaded.

I believe this has to do with the model being loaded in the .onAppear() which can trigger a reload of the UI (since the language model is stored in state).

I had a similar issue in my own iOS app.

pcuenca commented 3 months ago

Hi @Proryanator! If you solved your issue, would you be interested in submitting a PR to this repo? Otherwise we'll look into it.

Thanks for the report!

Proryanator commented 3 months ago

Hi @Proryanator! If you solved your issue, would you be interested in submitting a PR to this repo? Otherwise we'll look into it.

Thanks for the report!

I would love to! Lemme open it up when I get some time.

pcuenca commented 3 months ago

That'd be awesome!