错误描述
我尝试在这个示例中运行代码片段
https://docs.llamaindex.ai/en/stable/examples/embeddings/text_embedding_inference/
得到了以下错误
JSONDecodeError Traceback (most recent call last)
<ipython-input-26-a7c0f9477fcc> in <cell line: 13>()
11
12
---> 13 embeddings = embed_model.get_text_embedding("Hello World!")
14 print(len(embeddings))
15 print(embeddings[:5])
8 frames
/usr/lib/python3.10/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
版本
使用的是提供的colab笔记本
重现步骤
在这里运行colab笔记本
https://docs.llamaindex.ai/en/stable/examples/embeddings/text_embedding_inference/
相关日志/回溯
- 无响应*
5条答案
按热度按时间vof42yt11#
嘿 @nitskoh! 👋 我在您等待人工维护者时为您提供帮助,解决bug、问题等。让我们一起解决这些bug吧!
要解决在运行LlamaIndex示例中的文本嵌入推理代码片段时遇到的
JSONDecodeError
错误,请确保您使用的模型名称正确且受Predibase支持。错误表明模型部署ID可能未在Predibase中找到。以下是一些排查和解决问题的步骤:
model_name
是正确的,并列在Predibase支持的模型中。您可以参考Predibase文档以获取支持的模型列表: Predibase Models 。PREDIBASE_API_TOKEN
设置正确且有效。base_url
正确设置为文本嵌入服务的端点。默认URL设置为http://127.0.0.1:8080
,但可能需要根据您的部署配置进行更新。这里是引发错误的相关代码部分:
此外,如果您使用的是 LlamaIndex 中的
HuggingFaceEmbedding
类,请确保模型和分词器正确初始化。以下是HuggingFaceEmbedding
类的代码片段:确保模型和分词器正确设置,并且
max_length
和pooling
参数已正确配置。这应该有助于解决JSONDecodeError
1(https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/llms/llama-index-llms-predibase/llama_index/llms/predibase/base.py)2(https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/llama_index/legacy/embeddings/text_embeddings_inference.py)3(https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/llama_index/embeddings/text_embeddings_inference/base.py)4(https://github.com/run-llama/llama_index/blob/main/llama-index-legacy/llama_index/legacy/embeddings/huggingface.py) 。92dk7w1h2#
这没有帮助。因为我正在使用你的示例
dy2hfwbg3#
看起来第一步是部署嵌入服务器,这听起来像是一个付费选项,如描述 here 。
cc: @namin@tobi
unhi4e5o4#
它不是付费的,但在使用之前需要将其部署到某个地方(本地Docker,Web服务等)。
kadbb4595#
感谢你的留言,@logan-markewich。你使用过哪些部署方法?