__----~~~~~~~~~~~------___
. . ~~//====...... __--~ ~~
-. \_|// |||\\ ~~~~~~::::... /~
___-==_ _-~o~ \/ ||| \\ _/~~-
__---~~~.==~||\=_ -_--~/_-~|- |\\ \\ _/~
_-~~ .=~ | \\-_ '-~7 /- / || \ /
.~ .~ | \\ -_ / /- / || \ /
/ ____ / | \\ ~-_/ /|- _/ .|| \ /
|~~ ~~|--~~~~--_ \ ~==-/ | \~--===~~ .\
' ~-| /| |-~\~~ __--~~
|-~~-_/ | | ~\_ _-~ /\
/ \ \__ \/~ \__
_--~ _/ | .-~~____--~-/ ~~==.
((->/~ '.|||' -_| ~~-/ , . _||
-_ ~\ ~~---l__i__i__i--~~_/
_-~-__ ~) \--______________--~~
//.-~~~-~_--~- |-------~~~~~~~~
//.-~~~--\
神獸保佑,程式碼沒Bug!
在這裡感謝HERO的幫助
langchain_llama
-model (放llama ,text2vec-base-chinese的位置)
-script (放llama_langChain_embedding.py)
-data (放資料 .txt)
Dockerfile
requirement.txt
DELL(Dell7920) ------ /mnt/hdd1_4t/james_df/langchain/models
4060(PC0137) ------ /mnt/sda1/DF/llama_chain/models
我是用了
這兩個TW中文llama2
- 這個model是輕量級 還有是專用在中文embeddings的 無論是繁體字或簡體字
- 大部分用家都一致好評 (主要是這個) text2vec-base-chinese 表现最好
GGML的講解 Chatbot开发三剑客:LLAMA、LangChain和Python
以下都是cpp慢到死的評論
Extremely slow?
Llama-cpp-python is slower than llama.cpp by more than 25%. Let's get it resolved
Speed too slow
我自己也試用cpp的程式 也可能是我寫不對 所以執行速度可能有點奇怪
可以看我的程式碼
llama_cpp.py
但是在用linux docker的時候 無法更新sqlite3
Chroma requires SQLite > 3.35, if you encounter issues with having too low of a SQLite version please try the following.
所以我用了
sys.modules["sqlite3"] = sys.modules.pop("pysqlite3")
覆寫預設的 sqlite3 函式庫
整個langchain可以參考Langchain - Mistral 7B 模型實作day-1
可以參考 如何利用量化在低資源情況下執行70B的LLaMA2模型?
創建一個HuggingFacePipeline實例,用於後續的語言生成
system prompt格式可以參考以下Make a chain的部份
YT Customizing the Prompt - RetrievalQA withLLaMA2-7B .ipynb