spaCy 中的 LLM 模型需要 OpenAI 密钥

问题描述 投票:0回答:1

#有代码:

导入spacy

nlp = spacy.blank("en")

#下一行会抛出下面的错误

llm_ner = nlp.add_pipe(“llm_ner”)

C:\Program Files\Python311\Lib\site-packages\spacy_llm\models est\openai\model.py:25: UserWarning: 找不到访问 OpenAI API 的 API 密钥。确保您通过 https://platform.openai.com/account/api-keys 设置了 API 密钥,然后将其作为环境变量“OPENAI_API_KEY”使用。

为什么默认使用OpenAI模型?有没有办法绕过这个问题,以便 HuggingFace 的其他模型(例如 Dolly)或 spaCy 自己的 LLM 模型可以用于 NER 识别?

感谢您的帮助。

我期待连接到 spaCy 的内置 LLM 模型(甚至 HuggingFace 模型)。

spacy named-entity-recognition llm
1个回答
0
投票

以下是如何使用 Dolly 和 spaCy 进行命名实体识别的示例:https://github.com/explosion/spacy-llm/tree/main/usage_examples/ner_dolly

spacy-llm
github 有关于这些用例的大量文档。

© www.soinside.com 2019 - 2024. All rights reserved.