# LLM_data_for_research --- # LLM模型 * 課程筆記- 為何要微調(Why finetune) * https://hackmd.io/@YungHuiHsu/HJ6AT8XG6 ### 官方github: **https://github.com/meta-llama/llama3** * Llama中文社区 * https://github.com/LlamaFamily/Llama-Chinese * [中文llama alpaca](<https://reurl.cc/QRorD9>) * Hugging face : * [Huggingface](<https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct>) * Llama3-Finetuning: * https://github.com/taishan1994/Llama3-Finetuning * https://anakin.ai/blog/how-to-fine-tune-llama-3/ * TW-llm * https://github.com/MiuLab/Taiwan-LLM?tab=readme-ov-file * https://hackmd.io/@ai-in-a-box/SJjaC20ST * 微調成特殊模型需要: PEFT、LORA、bitssandbytes、transformer、Hagging face * Dataset 需要多少問答資料、格式、硬體需求(GPU、RAM)、訓練約多久,貌似是一個jsonl文件 * 使用模型 meta、google、qwen 決定,params數量 * 微調方式:問答 or 丟資料 方式微調 * AI server的模型負荷能力 * 訓練套件:pytorch or tensorflow or keras --- # 術語(Terminlogy) | 術語 | 解釋 | | -------- | -------- | | vllm | vLLM是伯克利大学LMSYS组织开源的大语言模型高速推理框架 | | prompt | 問llm模型的話 | | history | 對話的歷史紀綠 | | Quant | https://zhuanlan.zhihu.com/p/690739797 | | checkpoint | 训练过程中保存的模型状态和参数的快照 | | GGML | 用于优化和加速大型语言模型(LLM)的库,引入量化技术和其他优化策略,使得在资源受限的环境能够高效地运行模型 | | RAG | AG是一種結合了檢索(Retrieval)和生成(Generation)的模型架構。它首先從大量數據中檢索相關資訊,然後基於這些資訊生成回應。| |GGUF | ollama部屬自定義模型用格式 | |llama.cpp | 模型轉檔套件 | |QLoRA/LoRA/PEFT| 微調套件 | |acclerate | 微調套件 | |bitsandbytes | 微調套件 | |transformers | 微調套件 | |w64devkit | 模型量化套件套件 | --- # 模型微調(llama_factory) * LLaMA-Factory参数的解答: * https://blog.csdn.net/m0_69655483/article/details/138229566 * GPU試算 * https://www.techbang.com/posts/110553-can-your-gpu-run-big-models-like-llama-2-get-tested-with-this * 使用LLaMa-Factory简单高效微调大模型 * [各種訓練指令](<https://zhuanlan.zhihu.com/p/689333581>) * How to Fine-Tune LLaMA 3: An Easy Guide * https://anakin.ai/blog/how-to-fine-tune-llama-3/ * Llama3-8B-Instruct + LLaMA-Factory 中文微调 => 至關重要 * [Llama3-8B-Instruct + LLaMA-Factory 中文微调 | 本地部署教程](<https://caovan.com/llama3-8b-instruct-llama-factory-zhongwenweidiao-bendebushujiaocheng/.html>) * hf to GGUF 再交給ollama推理 * [Ollama教程——进阶篇:【自定义模型】如何将模型高效导入到ollama框架](<https://blog.csdn.net/TianYa707722173/article/details/138160326>) * [大模型训练入门必备技术,llama.cpp助力模型转换及量化,小白也能学会?](<https://www.bilibili.com/read/cv34152234/>) * [How to convert HuggingFace model to GGUF format](<https://github.com/ggerganov/llama.cpp/discussions/2948>) * [Llama3-8B-Chinese-Chat Hugging face](<https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat>) * [抓別人的 GGUF 模型,用 Ollama 在本機執行!](<https://ywctech.net/ml-ai/ollama-import-custom-gguf/>) * [Ollama on Windows:本地运行大型语言模型(LLM)的新利器](<https://www.sysgeek.cn/ollama-on-windows/#0-%E4%BB%80%E4%B9%88%E6%98%AF-ollama%EF%BC%9F>) * [將 HuggingFace 模型轉換為 GGUF 及使用 llama.cpp 進行量化 ](<https://medium.com/@NeroHin/%E5%B0%87-huggingface-%E6%A0%BC%E5%BC%8F%E6%A8%A1%E5%BC%8F%E8%BD%89%E6%8F%9B%E7%82%BA-gguf-%E4%BB%A5inx-text-bailong-instruct-7b-%E7%82%BA%E4%BE%8B-a2cfdd892cbc>) * [如何用hugging face hub一键下载模型并将模型转换为gguf格式(支持自定义量化)](<https://blog.csdn.net/2301_78453609/article/details/136989524>) * [模型量化和gguf转换](<https://blog.csdn.net/lengyoumo/article/details/138867085>) * [llama.cpp](<https://github.com/ggerganov/llama.cpp>) * [使用 llama.cpp 將 LLaMa 模型轉換為 GGUF 格式](<https://reurl.cc/LWoyq7>) * [Huggingface 模型轉成 GGUF, 以讓 Ollama 使用](<https://moon-half.info/p/5781>) * [使用llama.cpp实现LLM大模型的格式转换、量化、推理、部署](<https://blog.csdn.net/qq_38628046/article/details/139006498#_143>) * 多卡微調 * https://blog.csdn.net/qq_43128256/article/details/136738734 --- # 多卡推理訓練 https://blog.csdn.net/qq_34243930/article/details/106695877 --- # 資料集格式 * LLM Dataset * https://github.com/mlabonne/llm-datasets * 大模型在自定义数据集 lora 训练与部署 * https://blog.csdn.net/sjxgghg/article/details/137656248 * 自建数据集,利用LLama-Factory微调大模型 * https://zhuanlan.zhihu.com/p/696478678 * llama3-06 基于llama-factory和自定义数据集进行模型微调(video) * https://www.zhihu.com/zvideo/1767997876238860289 * llama factory * https://github.com/hiyouga/LLaMA-Factory/tree/main/data * https://github.com/hiyouga/LLaMA-Factory/blob/main/data/README_zh.md * https://reurl.cc/Rqoj4Z * 多模態數據集 * https://tianchi.aliyun.com/dataset/145784 * 資料集種類 * Alpaca ,instruction和input可以都填充进内容,如把问题作为input,把“回答问题这一要求”作为instruction。据说这种指令微调数据集的格式效果比较好。 * KTO * multimodel * Sharegpt * OpenAI --- # ollama佈屬 * [ollama github](<https://github.com/ollama/ollama>) --- # RAG 框架 && Langchain * [基于llama3和langchain使用RAG搭建你的私有知识库!](<https://segmentfault.com/a/1190000044836695>) * [LangChain RAG實作教學,結合Llama3讓LLM可以讀取PDF和DOC文件,並產生回應](<https://reurl.cc/z1k3DN>) * [LangChain 分包](<https://blog.csdn.net/lovechris00/article/details/137470483>) * [LangChain 怎麼玩?用 Document Loaders / Text Splitter 處理多種類型的資料](<https://myapollo.com.tw/blog/langchain-document-loaders-text-splitters/>) * [RAG實作教學,LangChain + Llama2 |創造你的個人LLM](<https://medium.com/@cch.chichieh/rag%E5%AF%A6%E4%BD%9C%E6%95%99%E5%AD%B8-langchain-llama2-%E5%89%B5%E9%80%A0%E4%BD%A0%E7%9A%84%E5%80%8B%E4%BA%BAllm-d6838febf8c4>) * [Langchain ollama 搭配](<http://docs.autoinfra.cn/docs/integrations/llms/ollama#%E8%AE%BE%E7%BD%AE-setup>) * [Langchain tutorial](<https://www.bing.com/search?q=tutorial&qs=OS&pq=turitor&sk=UT1OS1&sc=10-7&cvid=1BB340C49A174C1D81A218EA4A127988&FORM=QBRE&sp=3&lq=0>) * [Langsmith](<https://developer.volcengine.com/articles/7370375414524411931>) * [langchain 文件加载器使用教程](<https://blog.csdn.net/HRG520JN/article/details/136934005>) * [使用LangChain框架加载与解析txt,markdown,pdf,jpg格式文档](<https://blog.csdn.net/qq_45257495/article/details/135357123>) * [RAG 優化技巧| 7 大挑戰與解決方式 | 增進你的 LLM](<https://medium.com/@cch.chichieh/rag-%E5%84%AA%E5%8C%96%E6%8A%80%E5%B7%A7-7-%E5%A4%A7%E6%8C%91%E6%88%B0%E8%88%87%E8%A7%A3%E6%B1%BA%E6%96%B9%E5%BC%8F-%E5%A2%9E%E9%80%B2%E4%BD%A0%E7%9A%84-llm-0e4ac8adc6df>) * [LangChain系列使用指南:LangChain快速入门](<https://blog.csdn.net/wjjc1017/article/details/136770349>) * [Chroma 自查询](<https://python.langchain.com.cn/docs/modules/data_connection/retrievers/how_to/self_query/chroma_self_query>) * [Retrievers](<https://python.langchain.com/v0.1/docs/modules/data_connection/retrievers/>) --- # 多模態LLM模型 * Chinese-LLaVA * https://github.com/LinkSoul-AI/Chinese-LLaVA * llava & openvino * https://docs.openvino.ai/2024/notebooks/llava-multimodal-chatbot-with-output.html * How to Fine-Tune LLaVA on Your Custom Dataset * https://medium.com/ubiai-nlp/how-to-fine-tune-llava-on-your-custom-dataset-aca118a90bc3 * clip-vit-large-patch14 多模態模型 --- # 架設LLM_CIM **1. 使用 openvino 去部屬LLM模型 2. windows訓練,ubuntu做系統 3. CUDA的 多卡訓練推理 4. LLM模型的選擇 => 多模態?l、lama?、llava?、other? 5. Dataset的架構 6. 多模態如何微調 7. llama-factory 套件的理解 8. torch模型轉換成openvino格式** ## ubuntu安裝llama-factory https://blog.csdn.net/python12345678_/article/details/140346926