Replies: 1 comment
-
Hey there, @hodgesz! Great to see you diving into the TypeScript waters after your Python SDK adventures. 🚀 From the error message you provided, it seems like the issue is related to the loading of the Hugging Face model. The error message "Unexpected token '<', "<!doctype "... is not valid JSON" typically occurs when the response expected to be in JSON format is actually HTML or XML. This often happens when an API call is made, and the server responds with an error page in HTML instead of the expected JSON data. In your case, it seems like the Hugging Face model is not being loaded correctly. The error is thrown when the library tries to parse the model's configuration file, which should be in JSON format. However, it seems like the library is receiving an HTML response instead, which is why the JSON parsing fails. This could be due to several reasons:
As for the rest of your code, it seems to be correct. You are correctly initializing the However, please note that the I hope this helps! If you have any more questions or if the issue persists, please provide more details so I can assist you better. Sources
|
Beta Was this translation helpful? Give feedback.
-
Checked other resources
Commit to Help
Example Code
Description
Does this look right to you?
I am currently getting the following error in the above try / catch
SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON
at JSON.parse ()
at getModelJSON (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:15678:15)
at async Promise.all (:5173/index 0)
at async loadTokenizer (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:19114:16)
at async AutoTokenizer.from_pretrained (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:22265:46)
at async Promise.all (:5173/index 0)
at async loadItems (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:30612:3)
at async pipeline (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:30572:19)
at async HuggingFaceTransformersEmbeddings.runEmbedding (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:30677:18)
at async HuggingFaceTransformersEmbeddings.embedQuery (@langchain_community_embeddings_hf_transformers.js?v=eb99f90c:30671:18)
Something went wrong
System Info
This is on Mac and Node version is 10.5.0
npm list
[email protected] /Users/hodgesz/VsCodeProjects/job_interviews/ai-frontend-workshop/my-gpt
├── @qdrant/[email protected]
├── @types/[email protected]
├── @types/[email protected]
├── @typescript-eslint/[email protected]
├── @typescript-eslint/[email protected]
├── @vitejs/[email protected]
├── @xenova/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
Beta Was this translation helpful? Give feedback.
All reactions