utils报错
moonpieyo opened this issue · 1 comments
Traceback (most recent call last):
File "D:\研究生文件\文献\自然语言处理\代码集\KGAN-2.0\KGAN-2.0\main_total.py", line 493, in
a_acc, a_f1, a_time = train_bert(args, times=i)
File "D:\研究生文件\文献\自然语言处理\代码集\KGAN-2.0\KGAN-2.0\main_total.py", line 193, in train_bert
dataset, graph_embeddings, n_train, n_test = build_dataset(args=args, is_bert=True)
File "D:\研究生文件\文献\自然语言处理\代码集\KGAN-2.0\KGAN-2.0\utils.py", line 718, in build_dataset
dataset, vocab = load_data_dep_bert(ds_name=args.ds_name, is_bert = args.is_bert)
File "D:\研究生文件\文献\自然语言处理\代码集\KGAN-2.0\KGAN-2.0\utils.py", line 535, in load_data_dep_bert
train_set = pad_seq(dataset=train_set, field='adj', max_len=max_bert_len, symbol=-1)
File "D:\研究生文件\文献\自然语言处理\代码集\KGAN-2.0\KGAN-2.0\utils.py", line 31, in pad_seq
((0, max_len-dataset[i][field].shape[0]), (0, max_len-dataset[i][field].shape[0])), 'constant')
AttributeError: 'tuple' object has no attribute 'shape'
跑main-total的时候出现了这个错误,显示dataset[i][field]是元组,没办法和整数做减法,然后这里改了之后上一行np.pad(dataset[i][field]也有问题,因为它是元组,填充的时候显示ValueError: could not broadcast input array from shape (11,11) into shape (11,),不知道为什么别人跑好像没有问题,是不是版本不对呀,我用的是python3.9