We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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
The text was updated successfully, but these errors were encountered:
adj_matrix, one_hot_matrix, tokens = dataset[i][field] # 填充邻接矩阵到 max_len × max_len adj_matrix_padded = np.pad(adj_matrix, ((0, max_len - adj_matrix.shape[0]), (0, max_len - adj_matrix.shape[1])), 'constant') one_hot_matrix_padded = np.pad(one_hot_matrix, ((0, max_len - adj_matrix.shape[0]), (0, max_len - adj_matrix.shape[1])), 'constant') # 将填充后的结果重新组合成 tuple dataset[i][field] = (adj_matrix_padded, adj_matrix_padded, tokens) 这样就可以解决了 But!我现在遇到数据集不完整问题
Sorry, something went wrong.
No branches or pull requests
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
The text was updated successfully, but these errors were encountered: