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
- paddlepaddle:2.6.1 - paddlepaddle-gpu: - paddlenlp: 2.7.0
In the script:
for i, d in enumerate(data): label = decode(pred_ids[i], id_vocabs) result = { "text": d, "label": label, } if label not in name_dict: scores_can = all_scores_can[i] pred_ids_can = all_preds_can[i] labels_can = search(scores_can, pred_ids_can, 0, [], 0) labels_can.sort(key=lambda d: -d[1]) for labels in labels_can: cls_label_can = decode(labels[0], id_vocabs) if cls_label_can in name_dict: result["label"] = cls_label_can break else: labels_can = bk_tree.search_similar_word(label) result["label"] = labels_can[0][0] result["category"] = name_dict[result["label"]] results.append(result) return results
If labels_can is empty, accessing labels_can[0][0] may raise an IndexError.
labels_can
labels_can[0][0]
IndexError
Perhaps this is a way of modification:
labels_can = bk_tree.search_similar_word(label) if len(labels_can) != 0: result["label"] = labels_can[0][0]
result["category"] = name_dict[result["label"]]
If the issue in 1 is resolved, a KeyError might still occur in this section of the script.
KeyError
Training with a small sample and adjusting the mapping JSON may lead to issues.
The text was updated successfully, but these errors were encountered:
Thank you for reporting the bug issue. You are welcome to create a pull request to address the bug based on your preferred method of modification.
Sorry, something went wrong.
We made some changes in directory structure, the new path https://github.com/PaddlePaddle/PaddleNLP/tree/develop/legacy/examples/text_to_knowledge
Thank you for your trust. I will submit my solution code in the coming days.
wawltor
No branches or pull requests
软件环境
重复问题
错误描述
In the script:
If
labels_can
is empty, accessinglabels_can[0][0]
may raise anIndexError
.Perhaps this is a way of modification:
If the issue in 1 is resolved, a
KeyError
might still occur in this section of the script.稳定复现步骤 & 代码
Training with a small sample and adjusting the mapping JSON may lead to issues.
The text was updated successfully, but these errors were encountered: