LLM

本地大模型知识库问答

本地部署 下载大模型 大模型下载 https://www.modelscope.cn/models/AI-ModelScope/bge-large-zh-v1.5 https://www.modelscope.cn/models/ZhipuAI/chatglm3-6b ChatGLM3 git clone https://github.com/THUDM/ChatGLM3 cd ChatGLM3 pip install -r requirements.txt python from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("/home/wubigo/model/ZhipuAI/chatglm3-6b", trust_remote_code=True) model = AutoModel.from_pretrained("/home/wubigo/model/ZhipuAI/chatglm3-6b", trust_remote_code=True, device='cuda') model = model.eval() response, history = model.chat(tokenizer, "你好", history=[]) 初始化知识库 git clone --recursive https://github.com/chatchat-space/Langchain-Chatchat.git cd Langchain-Chatchat pip install -r requirements.txt python copy_config_example.py python init_database.py --recreate-vs 启动服务 python startup.py -a

LLM Notes

大模型下载 pip install modelscope from modelscope.hub.snapshot_download import snapshot_download model_dir = snapshot_download('ZhipuAI/chatglm3-6b', cache_dir='./model', revision='master') 下载 https://www.modelscope.cn/models/ZhipuAI/chatglm2-6b nvidia-smi Failed to initialize NVML: Driver/library version mismatch 这个问题出现的原因是kernel mod 的 Nvidia driver 的版本没有更新,一般情况下,重启机器就能够解决, 如果因为某些原因不能够重启的话,也有办法reload kernel mod。 简单来看,就两步 unload nvidia kernel mod reload nvidia kernel mod 执行起来就是 sudo rmmod nvidia sudo nvidia-smi 分词器(Tokenizer) tokenization算法大致经历了从word/char到subword的进化. 目前有三种主流的Subword分词算法,分别是Byte Pair Encoding (BPE), WordPiece和Unigram Language Model Back in the ancient times, before 2013, we usually encoded basic unigram tokens using simple 1’s and 0’s in a process called One-Hot encoding.

machine learning basic

机器学习是统计模型 对文本标签配对进行统计模型训练,使模型能够使用代表消息意图的预定义标签对未知输入文本进行分类 a statistical model is trained on text-label pairings, enabling the model to classify unknown input text with a pre-defined label representing the intention of the message Early neural networks Although the core ideas of neural networks were investigated in toy forms as early as the 1950s, the approach took decades to really get started. For a long time, the missing piece was a lack of an efficient way to train large neural networks.