Skip to content
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

No module named '_swigfaiss' #5

Open
masapasa opened this issue Jun 30, 2019 · 10 comments
Open

No module named '_swigfaiss' #5

masapasa opened this issue Jun 30, 2019 · 10 comments

Comments

@masapasa
Copy link

any idea how i can solve this?

@masapasa
Copy link
Author


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
Copy link
Member

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

@JayYip
Copy link
Collaborator

JayYip commented Jul 1, 2019

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
Copy link

Getting the same error.

ModuleNotFoundError: No module named '_swigfaiss'

@Santosh-Gupta
Copy link
Member

Getting the same error.

ModuleNotFoundError: No module named '_swigfaiss'

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

@Chrome3912
Copy link

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

@masapasa
Copy link
Author

masapasa commented Jul 6, 2019

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

@harshit-saraswat
Copy link

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

@masapasa
Copy link
Author

masapasa commented Jul 7, 2019

Faiss is not supported on windows

@Chrome3912
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants