DocBin to_bytes/to_disk 被杀死

发布于 2025-01-15 18:22:04 字数 646 浏览 1 评论 0原文

我正在处理相当大的语料库,当我尝试保存它时,我的 DocBin 对象被杀死。 to_diskto_bytes 都在打印“Killed”

我的Python知识有限,所以我不清楚如何解决这个问题。你能帮忙吗?

这是我的代码(非常简单和基本):

    nlp = spacy.blank("en")
    for text, annotations in train_data:
        doc = nlp(text)
        ents = []
        for start, end, label in eval(annotations)['entities']:
            span = doc.char_span(start, end, label=label)
            if (span is None):
                continue
            ents.append(span)   
        doc.ents = ents
        db.add(doc)

    db.to_disk("../Spacy/train.spacy")```

I am dealing with fairly big corpuses and my DocBin object gets killed when I try to save it. Both to_disk and to_bytes are printing "Killed".

I am with limited python knowledge, so it isn't obvious to me right away how I can work around the issue. Can you help?

Here is my code(very straight forward and basic):

    nlp = spacy.blank("en")
    for text, annotations in train_data:
        doc = nlp(text)
        ents = []
        for start, end, label in eval(annotations)['entities']:
            span = doc.char_span(start, end, label=label)
            if (span is None):
                continue
            ents.append(span)   
        doc.ents = ents
        db.add(doc)

    db.to_disk("../Spacy/train.spacy")```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2025-01-22 18:22:04

您的 RAM 可能已用完。相反,请将注释保存在多个 DocBin 文件中。如果您有多个 ,您可以使用 spacy train--paths.train 提供目录,而不是单个 .spacy 文件。空间大的 文件。

You are probably running out of RAM. Instead, save your annotation in multiple DocBin files. You can provide a directory to --paths.train with spacy train instead of a single .spacy file if you have multiple .spacy files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文