Langchain wrapper implementation #94
kmccleary3301
started this conversation in
Show and tell
Replies: 1 comment 2 replies
-
Thanks for sharing your wrapper. It worked for me with the LLama2 model without any customization. However, I had a problem with another LLM that used special tokens like this LLM https://huggingface.co/LeoLM/leo-hessianai-13b-chat-bilingual: "32000": {
"content": "<|im_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"32001": {
"content": "<|im_end|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
} Method: 336 def _DecodeIds(self, ids):
--> 337 return _sentencepiece.SentencePieceProcessor__DecodeIds(self, ids)
IndexError: Out of range: piece id is out of range. I experimented with decode_special_tokens = False/True, but it had no effect. ids = generator.sequence_ids[0][last_newline_pos:]
decode_special_tokens = False
texts = []
ids = ids.tolist()
stuff = llm.tokenizer.decode_(ids, decode_special_tokens) This is not a real solution, but maybe it will help someone. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Langchain supports llama.cpp natively, but not exllama or exllamav2. At least two people created langchain wrappers for exllamav1, which can be viewed here and here.
I am currently building a production backend and frontend which utilizes langchain, and I borrowed and modified the first example.
Due to having some issues with Mistral-7B and ExllamaV1, I tried my luck with ExllamaV2, and it works. I've rewritten the first wrapper to work with ExllamaV2, and am sharing it here. It seems to work perfectly, but please let me know if there's an issue.
Beta Was this translation helpful? Give feedback.
All reactions