iamlemec / bert.cpp

GGML implementation of BERT model with Python bindings and quantization.
MIT License
51 stars 5 forks source link

Python binding gives error #12

Closed PrithivirajDamodaran closed 8 months ago

PrithivirajDamodaran commented 8 months ago

conversion is fine running the below

from bert_cpp import BertModel
mod = BertModel('models/bge-base-en-v1.5-f16.gguf')
batch = ["Hello, how are you"]
emb = mod.embed(batch)

throws

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
[<ipython-input-23-145b8ed4c48e>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from bert_cpp import BertModel
      2 mod = BertModel('models/bge-base-en-v1.5-f16.gguf')
      3 batch = ["Hello, how are you"]
      4 emb = mod.embed(batch)

3 frames
[/content/bert.cpp/bert_cpp/utils.py](https://localhost:8080/#) in load_shared_library(lib_base_name)
     58                 raise RuntimeError(f'Failed to load shared library "{lib_path}": {e}')
     59 
---> 60     raise FileNotFoundError(
     61         f'Shared library with base name "{lib_base_name}" not found'
     62     )

FileNotFoundError: Shared library with base name "bert" not found

I know I am missing something basic, pl advice.

PrithivirajDamodaran commented 8 months ago

Manually setting the below fixes the issue.

os.environ['BERT_CPP_LIB'] = '/content/rourke/build/src/libbert.so'