{"id":20895615,"url":"https://github.com/yatenglg/simple-local-qa","last_synced_at":"2025-08-09T09:13:54.622Z","repository":{"id":192763323,"uuid":"686955596","full_name":"yatengLG/Simple-Local-QA","owner":"yatengLG","description":"用最简单的代码带你实现基于大模型的本地知识库问答系统","archived":false,"fork":false,"pushed_at":"2023-09-05T08:02:33.000Z","size":7941,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T01:42:14.814Z","etag":null,"topics":["chatbot","chatglm","embedding","knowledge-base","llm","text2vec"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yatengLG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-04T09:55:03.000Z","updated_at":"2025-03-22T03:19:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"900bb1ae-e85e-4a4b-b766-151a60df3817","html_url":"https://github.com/yatengLG/Simple-Local-QA","commit_stats":null,"previous_names":["yatenglg/simple-local-qa"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yatengLG%2FSimple-Local-QA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yatengLG%2FSimple-Local-QA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yatengLG%2FSimple-Local-QA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yatengLG%2FSimple-Local-QA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yatengLG","download_url":"https://codeload.github.com/yatengLG/Simple-Local-QA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339287,"owners_count":21087213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatglm","embedding","knowledge-base","llm","text2vec"],"created_at":"2024-11-18T10:29:37.334Z","updated_at":"2025-04-11T03:42:01.516Z","avatar_url":"https://github.com/yatengLG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Local QA\n欢迎使用Simple Local QA\n\n![本地知识库问答](./pics/知识库问答.gif)\n\n演示中所使用的大模型为:chatglm2-6b-int4，显存占用6G\n\n演示中所使用Embedding为:text2vec-large-chinese，项目在编码过程中，采用分批编码，显存占用也控制在6G以内。\n\n## 一. 简介\n\n本项目是本地知识库问答系统的简易版实现，但具有本地知识问答的所有功能。\n\n通过从本项目中，你可以得到：\n1. 了解基于大模型的本地知识库的运作原理\n2. 了解如何构建一个本地知识库\n3. 通过修改少量代码，定制专属于自己的知识库\n\n## 二. 知识库格式\n项目数据库由三部分组成：index.faiss，doc.pkl，file.pkl\n\n1. index.faiss  通过faiss存储向量，并计算相似度\n2. doc.pkl      列表形式，存储分割后的内容片段\n3. file.pkl     集合形式，存储知识库内相关文件的文件名\n\n## 三. 使用\n### 1. 克隆项目\n\n```bash\ngit clone https://github.com/https://github.com/yatengLG/Simple-Local-QA.git\n```\n\n### 2. 下载模型\n\n项目通过transformers库载入LLM与Embedding，常见的huggubgface上的大模型基本都支持;也可以自行载入模型。\n\n如需使用其他模型请自行下载即可，\n\n| 模型 | 下载地址 |\n|----|----|\n| chatglm2-6b-int4 | https://huggingface.co/THUDM/codegeex2-6b-int4/tree/main |\n| chatglm2-6b-32k-int4 | https://huggingface.co/THUDM/chatglm2-6b-32k-int4 |\n| chatglm2-6b | https://huggingface.co/THUDM/chatglm2-6b/tree/main |\n| chatglm2-6b-32k | https://huggingface.co/THUDM/chatglm2-6b-32k/tree/main |\n| text2vec-large-chinese | https://huggingface.co/shibing624/text2vec-base-chinese/tree/main |\n| 其他模型 | .... |\n\n\n### 3. 运行\n\n项目目前只提供了web UI调用\n\n运行前，配置模型路径，使用的设备后，执行：\n```bash\npython webui.py\n```\n\n## 四. 改进方向\n\n1. 添加对其他格式文件的支持\n2. 对于特定结构的pdf文件，优化读取，可进一步提升问答质量\n3. 尝试添加对公式、表格、图片等的支持\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyatenglg%2Fsimple-local-qa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyatenglg%2Fsimple-local-qa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyatenglg%2Fsimple-local-qa/lists"}