-
Notifications
You must be signed in to change notification settings - Fork 5
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
Works great on command line, but unable to use via python #15
Comments
Hi @regstuff! You'll want to use the I'll try to get that conversion script working soon, but in the meantime, in def set_gguf_parameters(self):
super().set_gguf_parameters()
self.gguf_writer.add_causal_attention(False)
# get pooling path
if (self.dir_model / "modules.json").is_file():
with open(self.dir_model / "modules.json", encoding="utf-8") as f:
modules = json.load(f)
pooling_path = None
for mod in modules:
if mod["type"] == "sentence_transformers.models.Pooling":
pooling_path = mod["path"]
break
else:
pooling_path = None
# get pooling type
pooling_type = gguf.PoolingType.NONE
if pooling_path is not None:
with open(self.dir_model / pooling_path / "config.json", encoding="utf-8") as f:
pooling = json.load(f)
if pooling["pooling_mode_mean_tokens"]:
pooling_type = gguf.PoolingType.MEAN
elif pooling["pooling_mode_cls_token"]:
pooling_type = gguf.PoolingType.CLS
else:
raise NotImplementedError("Only MEAN and CLS pooling types supported")
else:
pooling_type = gguf.PoolingType.CLS
self.gguf_writer.add_pooling_type(pooling_type.value) This will default to using last token pooling (see the third last line above). Hopefully we'll get the ability to choose a pooling strategy at runtime in |
Hi @iamlemec
I think I'm missing a package? I cloned the repo and pip installed requirements, so not sure what I'm getting wrong. |
EDIT: Apologies, this solution applies to an outdated commit (47cb93d); the project structure has since changed. @regstuff, follow these steps: (1) Build the project to get lib file. On macOS, it's -LIB_PATH = os.path.join(LIB_DIR, 'build/libbert.so')
+LIB_PATH = os.path.join(LIB_DIR, 'libbert.dylib') |
Hi, Thanks for the great work. Hope this gets merged into llama.cpp, but till then, I'm able to get things to work in the command line. However, when running the python example, I get this error:
I think I'm missing a package? I did the pip install requirements bit, so not sure what I'm getting wrong.
EDIT 1: Just noticed this has been merged into llama.cpp. For some reason I get an error when loading it into llama.cpp
This gguf was converted using bert.cpp. Does the original model have to be converted through llama.cpp?
EDIT 2: I see there's an issue with the embeddings implementation in llama.cpp
Also tried converting the model using llama.cpp convert.py but get this error:
The text was updated successfully, but these errors were encountered: