This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module
from ragatouille import RAGPretrainedModel
RAG = RAGPretrainedModel.from_pretrained("jinaai/jina-colbert-v2")
docs = [
"ColBERT is a novel ranking model that adapts deep LMs for efficient retrieval.",
"Jina-ColBERT is a ColBERT-style model but based on JinaBERT so it can support both 8k context length, fast and accurate retrieval.",
]
RAG.index(docs, index_name="demo")
query = "What does ColBERT do?"
results = RAG.search(query)
erro :
File "/data/denggc/test/code/import/embedding_by_jina_colbert_v2.py", line 8, in
RAG.index(docs, index_name="denggc")
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/RAGPretrainedModel.py", line 211, in index
return self.model.index(
^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/colbert.py", line 341, in index
self.model_index = ModelIndexFactory.construct(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 474, in construct
return ModelIndexFactory._MODEL_INDEX_BY_NAME[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 141, in construct
return PLAIDModelIndex(config).build(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 243, in build
indexer.index(name=index_name, collection=collection, overwrite=overwrite)
File "/usr/local/anaconda3/lib/python3.12/site-packages/colbert/indexer.py", line 80, in index
self.__launch(collection)
File "/usr/local/anaconda3/lib/python3.12/site-packages/colbert/indexer.py", line 93, in __launch
manager = mp.Manager()
^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/context.py", line 57, in Manager
m.start()
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/managers.py", line 562, in start
self._process.start()
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/context.py", line 289, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/spawn.py", line 164, in get_preparation_data
_check_not_importing_main()
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/spawn.py", line 140, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
To fix this issue, refer to the "Safe importing of main module"
section in https://docs.python.org/3/library/multiprocessing.html
Traceback (most recent call last):
File "/data/denggc/test/code/import/embedding_by_jina_colbert_v2.py", line 8, in
RAG.index(docs, index_name="denggc")
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/RAGPretrainedModel.py", line 211, in index
return self.model.index(
^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/colbert.py", line 341, in index
self.model_index = ModelIndexFactory.construct(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 474, in construct
return ModelIndexFactory._MODEL_INDEX_BY_NAME[
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 141, in construct
return PLAIDModelIndex(config).build(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/site-packages/ragatouille/models/index.py", line 243, in build
indexer.index(name=index_name, collection=collection, overwrite=overwrite)
File "/usr/local/anaconda3/lib/python3.12/site-packages/colbert/indexer.py", line 80, in index
self.__launch(collection)
File "/usr/local/anaconda3/lib/python3.12/site-packages/colbert/indexer.py", line 93, in __launch
manager = mp.Manager()
^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/context.py", line 57, in Manager
m.start()
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/managers.py", line 566, in start
self._address = reader.recv()
^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
^^^^^^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
buf = self._recv(4)
^^^^^^^^^^^^^
File "/usr/local/anaconda3/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
raise EOFError
EOFError