BehroozMansouri / TangentCFT

48 stars 12 forks source link

can only concatenate str (not "NoneType") to str #8

Open haoyu09 opened 3 years ago

haoyu09 commented 3 years ago

when I input the command:python3 tangent_cft_front_end.py -cid 1 -ds '/online/haoyu.hao/formula_semantic/TangentCFT-0909/DataSet/NTCIR-12/MathTagArticles' --slt False -em 'encoder.csv' --mp 'opt_model' --t False --rf res_1

I got

raceback (most recent call last): File "tangent_cft_front_end.py", line 94, in main() File "tangent_cft_front_end.py", line 77, in main dictionary_formula_tuples_collection = system.load_model( File "/online/haoyu.hao/formula_semantic/TangentCFT-0909/tangent_cft_back_end.py", line 81, in load_model dictionary_formula_tuples_collection = self.encode_train_tuples(embedding_type, ignore_full_relative_path, File "/online/haoyu.hao/formula_semantic/TangentCFT-0909/tangent_cft_back_end.py", line 27, in encode_train_tuples dictionary_lst_encoded_tuples[formula] = self.encode_lst_tuples(dictionary_formula_slt_tuple[formula], File "/online/haoyu.hao/formula_semantic/TangentCFT-0909/tangent_cft_back_end.py", line 35, in encode_lst_tuples encoded_tuples, temp_update_list, node_id = self.tuple_encoder.encode_tuples(self.encoder_map, self.node_id, File "/online/haoyu.hao/formula_semantic/TangentCFT-0909/Embedding_Preprocessing/encoder_tuple_level.py", line 84, in encode_tuples converted_value = self.convert_path_elements(slt_elements[2]) File "/online/haoyu.hao/formula_semantic/TangentCFT-0909/Embedding_Preprocessing/encoder_tuple_level.py", line 130, in convert_path_elements converted_value += value TypeError: can only concatenate str (not "NoneType") to str

BehroozMansouri commented 3 years ago

I just run the code, with the same configuration as you have shown, although please note that for OPT, we recommend the config file with id 2. I did not run into the issue you mentioned.

We are currently at maintenance issue, and there was an update (correction) on the encoder_tuple_level yesterday, have you applied that?

haoyu09 commented 3 years ago

Is there a stable version? Different versions report different errors. Many thanks

haoyu09 commented 3 years ago

I switch to the newest master version When I input the command:python3 tangent_cft_front_end.py -cid 2 -ds '/online/haoyu.hao/formula_semantic/TangentCFT-0913/DataSet/NTCIR-12/MathTagArticles' --slt False -em 'encoder.csv' --mp 'opt_model' --t False --rf res_1 I got: ERROR:root:'all ngrams for word \uea60\uf368\uea69\uea6aǽ absent from model' Traceback (most recent call last): File "/online/haoyu.hao/formula_semantic/TangentCFT-0913/tangent_cft_module.py", line 109, in get_vector_representation temp_vector = self.model.get_vector_representation(encoded_tuple) File "/online/haoyu.hao/formula_semantic/TangentCFT-0913/tangent_cft_model.py", line 44, in get_vector_representation return self.model.wv[encoded_math_tuple] File "/root/anaconda3/lib/python3.8/site-packages/gensim/models/keyedvectors.py", line 169, in getitem return self.get_vector(entities) File "/root/anaconda3/lib/python3.8/site-packages/gensim/models/keyedvectors.py", line 277, in get_vector return self.word_vec(word) File "/root/anaconda3/lib/python3.8/site-packages/gensim/models/keyedvectors.py", line 1622, in word_vec raise KeyError('all ngrams for word %s absent from model' % word) KeyError: 'all ngrams for word \uea60\uf368\uea69\uea6aǽ absent from model' Traceback (most recent call last): File "tangent_cft_front_end.py", line 91, in main() File "tangent_cft_front_end.py", line 83, in main retrieval_result = system.retrieval(dictionary_formula_tuples_collection, File "/online/haoyu.hao/formula_semantic/TangentCFT-0913/tangent_cft_back_end.py", line 64, in retrieval tensor_values, index_formula_id = self.module.index_collection_to_tensors(dictionary_formula_tuples_collection) File "/online/haoyu.hao/formula_semantic/TangentCFT-0913/tangent_cft_module.py", line 45, in index_collection_to_tensors xx = self.get_vector_representation(dictionary_formula_lst_encoded_tuples[formula]) File "/online/haoyu.hao/formula_semantic/TangentCFT-0913/tangent_cft_module.py", line 116, in __get_vector_representation return (temp_vector / counter) TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'

MeganJS commented 4 months ago

@haoyu09 I'm running into this same issue. Were you able to find a solution for it?