Closed BunnyNLP closed 2 years ago
谢谢你关注我的工作,apex的版本以及其它库的版本号可以看根目录下的environment.yml文件。你可以执行conda env create -f environment.yml安装项目需要的所有的依赖库。 五一快乐呀!
代码我更新了sentence encoder文件模型的性能会和论文一致,你可以重新下载运行
由于environment.yml中没有涉及apex的版本信息,所以我修改了运行参数已经能正常运行~非常感谢您的回复,祝你假期愉快哦~
Traceback (most recent call last): File "train_demo.py", line 370, in
main()
File "train_demo.py", line 327, in main
model = Pair(sentence_encoder, hidden_size=opt.hidden_size)#入口 models/pair.py -> Pair
File "/root/workspace/czb/ConceptFERE/fewshot_re_kit/framework.py", line 212, in train
logits, pred = model(batch, N_for_train, K,
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, kwargs)
File "/root/workspace/czb/ConceptFERE/models/pair.py", line 26, in forward
logits = self.sentence_encoder(batch)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, *kwargs)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
return self.module(inputs[0], kwargs[0])
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(*input, *kwargs)
File "/root/workspace/czb/ConceptFERE/fewshot_re_kit/sentence_encoder.py", line 488, in forward
quer_sen_hava_cpt = self.sentence_have_concept(query_sen, queryConceptID)
File "/root/workspace/czb/ConceptFERE/fewshot_re_kit/sentence_encoder.py", line 585, in sentence_have_concept
sen_vec = self.projector2(sen_vec)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1110, in _call_impl
return forward_call(input, **kwargs)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 103, in forward
return F.linear(input, self.weight, self.bias)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/apex/amp/wrap.py", line 21, in wrapper
args[i] = utils.cached_cast(cast_fn, args[i], handle.cache)
File "/root/miniconda3/envs/czb_KnowPrompt/lib/python3.8/site-packages/apex/amp/utils.py", line 97, in cached_cast
if cached_x.grad_fn.next_functions[1][0].variable is not x:
IndexError: tuple index out of range