第3节课笔记 (15班) #160
szhowardhuang
started this conversation in
笔记
Replies: 1 comment
-
https://gvxxiiwsufy.feishu.cn/wiki/NCClweMjkiAwxwkXXcOcqAV2nXe?from=from_copylink |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
按照LangChain教程,



1) 安装环境,过程顺利,huggingface 下载 sentence transformer,要用镜像站点。model可以存在之前创建的/root/model目录里面。
2) 代码下载, 可下载到code目录,不过之后脚本或者代码要注意目录
3)数据收集, 建立data目录 /root/data , 把数据集放到此目录. 把脚本拷贝到data目录, cp -r /root/code/tutorial/langchain/demo/ ./
4)构建向量数据库, 执行create_db.py即可。注意调整model路径, 数据库文件会存到当前python执行路径
5)部署web demo,由于我用VSC remote,懒得改隧道端口。所以更改一下教程里面的server port。
执行刚开始要等一下

效果如下, 类似的问题得到不同的结果,看起来要用中文切片模型。

为了确认是否切片模型造成乱码,下载bge-large-zh
import os
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
os.system('huggingface-cli download --resume-download BAAI/bge-large-zh --local-dir /root/model/bge-large-zh')
修改构建向量数据库模型和查询向量数据库模型,记得删除之前建立的数据库。
embeddings = HuggingFaceEmbeddings(model_name="/root/model/bge-large-zh")
效果如下

Beta Was this translation helpful? Give feedback.
All reactions