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

How can I unload a model from memory? #90

Closed
Shyryp opened this issue May 21, 2024 · 7 comments
Closed

How can I unload a model from memory? #90

Shyryp opened this issue May 21, 2024 · 7 comments

Comments

@Shyryp
Copy link

Shyryp commented May 21, 2024

Problem:
Currently, the model loaded into memory (VRAM) remains in it until the end of generation, even if I generate other content (pictures, for example) after generating the text.

Question:
Is it possible to unload from memory a model that is no longer used in the next nodes of the workflow?
Is there some kind of node that allows you to controllably unload a model previously loaded into memory?

If this is not possible now, can you create such a node or suggest how you can remove unnecessary models from memory using code?

Thanks for info!

@gokayfem
Copy link
Owner

working on that right now. i managed to do it for transformers models. i will make it possible for llama.cpp models also. there will be an option to keep in memory or unload it soon.

@gokayfem
Copy link
Owner

gokayfem commented May 22, 2024

there is now 2 new nodes for llama.cpp

LLava Optional Memory Free Simple
LLava Optional Memory Free Advanced

You can use multiple of this nodes in your workflow.

@Shyryp
Copy link
Author

Shyryp commented May 22, 2024

Perfect! Thank you!
Works great!

The only thing is that I would like to have a node option (or an image input parameter option) without the mandatory submission of an image as an input, if the user only plans to generate text on prompt.

Since in the current version of the node, I am forced, firstly, to specify an image, which can spoil the generation result, and secondly, I am forced to specify a much larger max_ctx size (at the moment I now need to specify a value twice as large for my tasks (4096) as before without necessarily adding an image), increasing the load/generation time.
problem

Is it possible to make the "image" input parameter optional?
Or tell me how I can modify the code for the LLava Optional Memory Free Advanced node to achieve this behavior?

Thanks for your hard work and help!

@gokayfem
Copy link
Owner

You mean, you want to use it as an llm. I can add LLM memory free version of this node also.

@Shyryp
Copy link
Author

Shyryp commented May 22, 2024

Yes, like an LLM, that's right. It will be very cool to have such a node.
Thanks again!

@gokayfem
Copy link
Owner

there is already llm loader and llm sampler and you can use llava models as llm on them. they are currently not supporting unloading option but i will add llm versions of them also.

@Shyryp
Copy link
Author

Shyryp commented May 29, 2024

LLM Optional Memory Free would be extremely useful for many tasks, I’ll be waiting, thanks for your work! 💪

@gokayfem gokayfem closed this as completed Nov 1, 2024
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