re-search / DocProduct

Medical Q&A with Deep Language Models
MIT License
567 stars 158 forks source link

No module named '_swigfaiss' #5

Open masapasa opened 5 years ago

masapasa commented 5 years ago

any idea how i can solve this?

masapasa commented 5 years ago

OutOfRangeError Traceback (most recent call last)

in 11 ffn_weight_file=None, 12 bert_ffn_weight_file=bert_ffn_weight_file, ---> 13 embedding_file=embedding_file) ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/docproduct/predictor.py in __init__(self, pretrained_path, ffn_weight_file, bert_ffn_weight_file, embedding_file) 208 pretrained_path=pretrained_path, 209 ffn_weight_file=ffn_weight_file, --> 210 bert_ffn_weight_file=bert_ffn_weight_file 211 ) 212 self.faiss_topk = FaissTopK(embedding_file) ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/docproduct/predictor.py in __init__(self, hidden_size, dropout, residual, pretrained_path, batch_size, max_seq_length, ffn_weight_file, bert_ffn_weight_file, load_pretrain, with_question, with_answer) 78 answer = 'fake' if with_answer else None 79 self.predict(questions=question, answers=answer, dataset=False) ---> 80 load_weight(self.model, bert_ffn_weight_file, ffn_weight_file) 81 82 def _type_check(self, inputs): ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/docproduct/predictor.py in load_weight(model, bert_ffn_weight_file, ffn_weight_file) 21 def load_weight(model, bert_ffn_weight_file=None, ffn_weight_file=None): 22 if bert_ffn_weight_file: ---> 23 model.load_weights(bert_ffn_weight_file) 24 elif ffn_weight_file: 25 loader = checkpoint_loader(ffn_weight_file) ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/tensorflow/python/keras/engine/network.py in load_weights(self, filepath, by_name) 1468 save_format = 'h5' 1469 if save_format == 'tf': -> 1470 status = self._trackable_saver.restore(filepath) 1471 if by_name: 1472 raise NotImplementedError( ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/tensorflow/python/training/tracking/util.py in restore(self, save_path) 1057 try: 1058 object_graph_string = reader.get_tensor( -> 1059 base.OBJECT_GRAPH_PROTO_KEY) 1060 except errors_impl.NotFoundError: 1061 # The object graph proto does not exist in this checkpoint. Try the ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py in get_tensor(self, tensor_str) 428 from tensorflow.python.util import compat 429 return CheckpointReader_GetTensor(self, compat.as_bytes(tensor_str), --> 430 status) 431 432 __swig_destroy__ = _pywrap_tensorflow_internal.delete_CheckpointReader ~/anaconda3/envs/tfgpu/lib/python3.7/site-packages/tensorflow/python/framework/errors_impl.py in __exit__(self, type_arg, value_arg, traceback_arg) 546 None, None, 547 compat.as_text(c_api.TF_Message(self.status.status)), --> 548 c_api.TF_GetCode(self.status.status)) 549 # Delete the underlying status object from memory otherwise it stays alive 550 # as there is a reference to status from this from the traceback due to OutOfRangeError: Read less bytes than requested
Santosh-Gupta commented 5 years ago

It looks like it's not finding Faiss. Did Faiss install without any errors?

JayYip commented 5 years ago

Am I missing something? Seems the issue content dose not match the title.

It seems the OutOfRangeError is caused by loading the model weight. Please make sure the model weight file is good and its path is correct.

yashwantreddy commented 5 years ago

Getting the same error.

ModuleNotFoundError: No module named '_swigfaiss'

Santosh-Gupta commented 5 years ago

Getting the same error.

ModuleNotFoundError: No module named '_swigfaiss'

Can you show the full error message? This looks like a FAISS install error.

Chrome3912 commented 5 years ago

try the api: https://pocket-derm.firebaseapp.com/

masapasa commented 5 years ago

conda install -c pytorch faiss-cpu/gpu for faiss install. It worked for me

harshit-saraswat commented 5 years ago

@masapasa did you install faiss on windows or mac or linux?

masapasa commented 5 years ago

Faiss is not supported on windows

Chrome3912 commented 5 years ago

@harshit-saraswat try the api you dont have to install anything just send a post request :)