Я пытаюсь генерировать встраивание, используя API вывода об объятия с Langchain в Python, но я сталкиваюсь с проблемами. Моя цель состоит в том, чтобы использовать API (не локальные модели) для генерации встроений для текста, в частности, с моделью Trancermers/All-Minilm-L6-V2. Я использую Langchain-guggingface == 0.2.0 и Huggingface-hub == 0,31.2 в среде Conda с Python 3.10.
Вот контекст: У меня есть достоверный токен API обнимающего лица в качестве переменной среды (HuggingFaceHub_API_TOKEN), и я хочу интегрировать этот с Langchain для Ambeddings.
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
File d:\Python_Env\LangChain\venv\lib\site-packages\requests\models.py:974, in Response.json(self, **kwargs)
973 try:
--> 974 return complexjson.loads(self.text, **kwargs)
975 except JSONDecodeError as e:
976 # Catch JSON-related errors and raise as requests.JSONDecodeError
977 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File d:\Python_Env\LangChain\venv\lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File d:\Python_Env\LangChain\venv\lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ``s`` (a ``str`` instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File d:\Python_Env\LangChain\venv\lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, 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)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last)
Cell In[12], line 16
14 text = "LangChain makes LLM applications modular"
15 #query_embedding = embeddings.embed_query(text)
---> 16 document_embeddings = embeddings.embed_documents([text, "HuggingFace provides great models"])
File d:\Python_Env\LangChain\venv\lib\site-packages\langchain_community\embeddings\huggingface.py:472, in HuggingFaceInferenceAPIEmbeddings.embed_documents(self, texts)
441 """Get the embeddings for a list of texts.
442
443 Args:
(...)
462 hf_embeddings.embed_documents(texts)
463 """ # noqa: E501
464 response = requests.post(
465 self._api_url,
466 headers=self._headers,
(...)
470 },
471 )
--> 472 return response.json()
File d:\Python_Env\LangChain\venv\lib\site-packages\requests\models.py:978, in Response.json(self, **kwargs)
974 return complexjson.loads(self.text, **kwargs)
975 except JSONDecodeError as e:
976 # Catch JSON-related errors and raise as requests.JSONDecodeError
977 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 978 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Что я проверил:
мой токен для обнимающего лица действителен и имеет разрешения API вывода.
Модель предложения-трансформировании/All-minilm-l6-v2 общедоступны и доступны через UI.>
Я пытаюсь генерировать встраивание, используя API вывода об объятия с Langchain в Python, но я сталкиваюсь с проблемами. Моя цель состоит в том, чтобы использовать API (не локальные модели) для генерации встроений для текста, в частности, с моделью Trancermers/All-Minilm-L6-V2. Я использую Langchain-guggingface == 0.2.0 и Huggingface-hub == 0,31.2 в среде Conda с Python 3.10. Вот контекст: У меня есть достоверный токен API обнимающего лица в качестве переменной среды (HuggingFaceHub_API_TOKEN), и я хочу интегрировать этот с Langchain для Ambeddings.[code]from langchain_community.embeddings import HuggingFaceInferenceAPIEmbeddings import os
# Fails here vector = embeddings.embed_query("Test query") [/code] [b] ошибка: [/b] [code]--------------------------------------------------------------------------- JSONDecodeError Traceback (most recent call last) File d:\Python_Env\LangChain\venv\lib\site-packages\requests\models.py:974, in Response.json(self, **kwargs) 973 try: --> 974 return complexjson.loads(self.text, **kwargs) 975 except JSONDecodeError as e: 976 # Catch JSON-related errors and raise as requests.JSONDecodeError 977 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
File d:\Python_Env\LangChain\venv\lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 343 if (cls is None and object_hook is None and 344 parse_int is None and parse_float is None and 345 parse_constant is None and object_pairs_hook is None and not kw): --> 346 return _default_decoder.decode(s) 347 if cls is None:
File d:\Python_Env\LangChain\venv\lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 """Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end()
File d:\Python_Env\LangChain\venv\lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, 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)
During handling of the above exception, another exception occurred:
JSONDecodeError Traceback (most recent call last) Cell In[12], line 16 14 text = "LangChain makes LLM applications modular" 15 #query_embedding = embeddings.embed_query(text) ---> 16 document_embeddings = embeddings.embed_documents([text, "HuggingFace provides great models"])
File d:\Python_Env\LangChain\venv\lib\site-packages\langchain_community\embeddings\huggingface.py:472, in HuggingFaceInferenceAPIEmbeddings.embed_documents(self, texts) 441 """Get the embeddings for a list of texts. 442 443 Args: (...) 462 hf_embeddings.embed_documents(texts) 463 """ # noqa: E501 464 response = requests.post( 465 self._api_url, 466 headers=self._headers, (...) 470 }, 471 ) --> 472 return response.json()
File d:\Python_Env\LangChain\venv\lib\site-packages\requests\models.py:978, in Response.json(self, **kwargs) 974 return complexjson.loads(self.text, **kwargs) 975 except JSONDecodeError as e: 976 # Catch JSON-related errors and raise as requests.JSONDecodeError 977 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError --> 978 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 1 column 1 (char 0) [/code] [b] Что я проверил: [/b] мой токен для обнимающего лица действителен и имеет разрешения API вывода. Модель предложения-трансформировании/All-minilm-l6-v2 общедоступны и доступны через UI.>
Я пытаюсь генерировать встраивание, используя API вывода об объятия с Langchain в Python, но я сталкиваюсь с проблемами. Моя цель состоит в том, чтобы использовать API (не локальные модели) для генерации встроений для текста, в частности, с моделью...
Я использую API-интерфейсы вывода Huggingface для базового приложения GenAI с использованием Llama 3.2 и Mistral. При вызове API я получаю следующую ошибку:
(MaxRetryError( HTTPSConnectionPool(host='api-inference.huggingface.co', port=443): Max...
Я следую руководству LangChain по созданию чат-бота и получил успешный результат на первом этапе. После привязки инструментов и завершения второго шага возникает следующая ошибка:
Traceback (most recent call last):
File \beegmodel.py , line 111, in...
Я следую руководству LangChain по созданию чат-бота и получил успешный результат на первом этапе. После привязки инструментов и завершения второго шага возникает следующая ошибка:
Traceback (most recent call last):
File \beegmodel.py , line 111, in...
Когда я пытаюсь загрузить эту модель внедрения, я сталкиваюсь с сигтермом. Этого не происходит при работе на моем Macbook Air M1, но происходит при работе в пространстве с обновленным процессором и постоянной памятью. Любая помощь будет оценена по...