-
Notifications
You must be signed in to change notification settings - Fork 43
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
question: how would you go about saving a control vector for later use #23
Comments
You can export it for use with llama.cpp with In the meantime, you should be able to use import dataclasses
import numpy as np
...
v = ControlVector.train(...)
np.save("vector.npy", dataclasses.asdict(v))
# later...
v = ControlVector(**np.load("vector.npy", allow_pickle=True).tolist()) Hope this helps! |
Hi @vgel, Thanks for the helpful insight on saving a control vector for later use. I noticed that you mentioned the ability to export a control vector with I found a tutorial on How to convert HuggingFace model to GGUF format. However, I found it difficult to apply this method described here in a Jupyter Notebook (for example, the tutorial ipynb you provided). Thanks! |
Sorry, didn't see this earlier! Once you have a vector trained with (e.g.) vector.export_gguf("vector.gguf") If you're running a version with #34 applied, you can also then import the vector back to Python with vector = ControlVector.import_gguf("vector.gguf") or you can use it with $ ./main ... --control-vector vector.gguf --control-vector-layer-range 14 26 ... Hope this helps! |
Closing this as addressed by #34 |
Perhaps a naive question, but rather than training a control vector with each run. How might I go about saving it for inference later?
The text was updated successfully, but these errors were encountered: