llama_index 信任远程代码=True

vojdkbi0  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(21)

问题验证

  • 我已经在文档和discord上寻找答案。

问题

我正在尝试获取jina运行的onnx。它告诉我,我必须传递参数 "trust_remote_code=True",但我无法这样做,因为它是在Llama Index Embeddings Guide文档示例中描述的。

from llama_index.embeddings import OptimumEmbedding

OptimumEmbedding.create_and_save_optimum_model(
     "jinaai/jina-embeddings-v2-base-de", "./JinaONNX"
)

可能是我太笨了,找不到正确的地方插入它,但是非常感谢帮助!

agyaoht7

agyaoht71#

  • 🤖*

Hey @Bearsaerker!很高兴看到你又提出了一个有趣的问题。希望你过得很好!
根据提供的上下文,看起来你正在尝试使用 trust_remote_code=True 参数初始化 OptimumEmbedding 模型。然而,在你提供的例子中, OptimumEmbedding 模型在没有任何参数的情况下被初始化。
trust_remote_code=True 参数通常用于初始化 HuggingFaceEmbedding 模型,就像 jina_embeddings.ipynb 示例中的代码片段所示:

# download model locally
# note: you need enough RAM+compute to run this
embed_model = HuggingFaceEmbedding(
    model_name=model_name, trust_remote_code=True
)

在这个代码中, HuggingFaceEmbedding 模型使用 model_name 变量和 trust_remote_code 参数被初始化,该参数被设置为 True。这意味着当必要时,模型会信任并执行远程代码。
如果你试图使用 trust_remote_code=True 参数与 OptimumEmbedding 模型一起使用,那么可能这个参数不受支持。我建议你查看 OptimumEmbedding 模型的文档或源代码,以查看是否支持这个参数。
如果你仍然遇到问题,能否请你提供更多关于你收到的错误信息以及你正在尝试运行的确切代码的信息?这将帮助我更好地理解问题并提供更准确的解决方案。

来源

这个回复旨在帮助你节省时间并提高效率。它不是精确的解决方案,而是你自己研究的一个起点。
请帮我变得更有用!如果这个回复对你有帮助,请留下一个👍;如果它无关紧要,请留下一个👎。
如果你想继续讨论,请用 @dosu-bot 开始你的回复。

bz4sfanl

bz4sfanl2#

请尝试一下。我成功通过了 trust_remote_code ,使用了 export_kwargs

db2dz4w8

db2dz4w83#

@logan-markewich Could you please assist @shaoyu-lu with the issue of passing parameters using export_kwargs when initializing the OptimumEmbedding model? They have provided an example where they successfully passed the parameters. Thank you!

Details

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

  • To continue the conversation, mention @dosu.*

相关问题