-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hello author, I am very interested in your research. But I have a little problem reproducing your code, can you give me an answer?
When I experimented with cc2vec, the following error occurred:
Research Question 2
test case similarity cut-off: 0.8
Testing Chart
----------------
Chart_1
Traceback (most recent call last):
File "main.py", line 173, in <module>
e.run(arg1, arg2, arg3, arg4)
File "main.py", line 118, in run
eval.predict_collected_projects(path_collected_patch=self.path_generated_patch, cut_off=0.8, distance_method=distance.cosine, ASE2020=False, patchsim=False, )
File "/home/extra_space/hanwei/BATS-main/experiment/evaluate.py", line 635, in predict_collected_projects
patch_id_list, label_list, generated_patch_list, vector_ML_list = self.vector4patch(available_path_patch, compare=ASE2020,)
File "/home/extra_space/hanwei/BATS-main/experiment/evaluate.py", line 262, in vector4patch
vector, _ = w2v.convert_single_patch(p)
File "/home/extra_space/hanwei/BATS-main/representation/word2vector.py", line 207, in convert_single_patch
raise e
File "/home/extra_space/hanwei/BATS-main/representation/word2vector.py", line 175, in convert_single_patch
learned_vector = lmg_cc2ftr_interface.learned_feature(p, load_model=MODEL_CC2Vec + 'cc2ftr.pt', dictionary=self.dictionary)
File "/home/extra_space/hanwei/BATS-main/representation/CC2Vec/lmg_cc2ftr_interface.py", line 20, in learned_feature
ftr = extracted_cc2ftr(data=data, params=params)
File "/home/extra_space/hanwei/BATS-main/representation/CC2Vec/lmg_cli.py", line 131, in extracted_cc2ftr
commit_ftr = model.forward_commit_embeds_diff(pad_added_code, pad_removed_code, state_hunk, state_sent, state_word)
File "/home/extra_space/hanwei/BATS-main/representation/CC2Vec/lmg_cc2ftr_model.py", line 172, in forward_commit_embeds_diff
x_added_code = self.forward_code(x=added_code, hid_state=hid_state)
File "/home/extra_space/hanwei/BATS-main/representation/CC2Vec/lmg_cc2ftr_model.py", line 139, in forward_code
sent, state_word = self.wordRNN(torch.LongTensor(words).view(-1, self.batch_size), hid_state_word)
File "/home/hanwei/.conda/envs/hw1/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/home/extra_space/hanwei/BATS-main/representation/CC2Vec/lmg_cc2ftr_model.py", line 37, in forward
emb_out = self.embed(inp)
File "/home/hanwei/.conda/envs/hw1/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "/home/hanwei/.conda/envs/hw1/lib/python3.7/site-packages/torch/nn/modules/sparse.py", line 114, in forward
self.norm_type, self.scale_grad_by_freq, self.sparse)
File "/home/hanwei/.conda/envs/hw1/lib/python3.7/site-packages/torch/nn/functional.py", line 1467, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected object of backend CUDA but got backend CPU for argument #3 'index'
I look forward to hearing from you very much.
Metadata
Metadata
Assignees
Labels
No labels