Comments (4)
You can export it for use with llama.cpp with export_gguf
, but I haven't written a method to read that gguf file back in for HuggingFace use yet.
In the meantime, you should be able to use np.save
to save the dataclass as a dictionary, and then reconstitute it that way:
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!
from repeng.
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 export_gguf
for use with llama.cpp
. Could you provide an example or guide on how to perform this export?
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!
from repeng.
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
export_gguf
for use withllama.cpp
. Could you provide an example or guide on how to perform this export?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 = ControlVector.train(...)
, you can simply export it with:
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 llama.cpp
using the ./main
runner:
$ ./main ... --control-vector vector.gguf --control-vector-layer-range 14 26 ...
Hope this helps!
from repeng.
Closing this as addressed by #34
from repeng.
Related Issues (19)
- Base model and vector merging HOT 1
- Error when running honesty.ipynb
- Numpy AttributeError on repeng import HOT 4
- quantized model ? Llama cpp? HOT 3
- Q: repeng vs system prompt HOT 2
- How to load a different model? And how to avoid useless re-downloads? HOT 1
- Installation HOT 1
- Will there be support for models with custom architecture (not only mistral or gpt based)? HOT 6
- Confused about dataset creation HOT 2
- Alternatives to PCA, such as umap HOT 6
- Computing the difference vectors for PCA HOT 1
- Control Vector Arithmetic HOT 3
- RuntimeError: "addmm_impl_cpu_" not implemented for 'Half' HOT 2
- vllm implementation HOT 4
- truncated_output_suffixes & HOT 2
- Cannot apply to other models HOT 2
- The MPS Backend is Not Working Properly HOT 11
- Slavoj Zizek vector is funny
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from repeng.