-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
1.缺少依赖库导入
代码中有
def build_tree(schema, name='root'):
"""
Build the schema tree.
"""
schema_tree = SchemaTree(name)
for s in schema:
if isinstance(s, str):
schema_tree.add_child(SchemaTree(s))
elif isinstance(s, dict):
for k, v in s.items():
if isinstance(v, str):
child = [v]
elif isinstance(v, list):
添加---------------------
from paddlenlp.taskflow.utils import SchemaTree
2.程序部分有误
Traceback (most recent call last):
File "data_distill.py", line 128, in
do_data_distill()
File "data_distill.py", line 90, in do_data_distill
args.task_type)
File "/home/aistudio/data_distill/utils.py", line 510, in synthetic2distill
for key1 in pred.keys():
AttributeError: 'list' object has no attribute 'keys'
源码为:
for key1 in pred.keys():
for s in pred[key1]:
ent = {
"text": s['text'],
"type": key1,
"start_index": s['start']
}
entity_list.append(ent)
修改为:
上述错误无,变为:TypeError: list indices must be integers or slices, not str
for key1 in pred:
for s in pred[key1]:
继续修改
for key1 in pred:
for s in key1:
报错:
File "/home/aistudio/data_distill/utils.py", line 513, in synthetic2distill
"text": s['text'],
TypeError: string indices must be integers
提个issue待解决吧