模型地址:https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat
微调工具:PEFT 或者 https://github.com/hiyouga/LLaMA-Factory.git
使用 Lora 方式进行微调,得到一个权重模型,然后和原始模型进行合并(通过脚本)
首先将safetensors格式转成gguf的格式,方便llama.cpp进行量化
然后进行量化,可以使用:https://github.com/ggerganov/llama.cpp
1、下载 wangshenzhi 的 llama3 的中文模型;https://huggingface.co/shenzhi-wang/Llama3-8B-Chinese-Chat
2、下载 llama3-factory 用来微调;https://github.com/hiyouga/LLaMA-Factory
3、根据阿里云的教程进行后续的操作;https://help.aliyun.com/zh/pai/use-cases/fine-tune-a-llama-3-model-with-llama-factory
4、测试微调的模型没问题之后,开始对模型进行量化;https://github.com/ggerganov/llama.cpp
训练完毕:
模型导出:
-rw-r--r-- 1 root root 725 May 20 10:41 config.json
-rw-r--r-- 1 root root 147 May 20 10:41 generation_config.json
-rw-r--r-- 1 root root 1003M May 20 10:41 model-00001-of-00017.safetensors
-rw-r--r-- 1 root root 913M May 20 10:41 model-00002-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00003-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00004-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00005-of-00017.safetensors
-rw-r--r-- 1 root root 913M May 20 10:41 model-00006-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00007-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00008-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:41 model-00009-of-00017.safetensors
-rw-r--r-- 1 root root 913M May 20 10:42 model-00010-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:42 model-00011-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:42 model-00012-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:42 model-00013-of-00017.safetensors
-rw-r--r-- 1 root root 913M May 20 10:42 model-00014-of-00017.safetensors
-rw-r--r-- 1 root root 945M May 20 10:42 model-00015-of-00017.safetensors
-rw-r--r-- 1 root root 225M May 20 10:42 model-00016-of-00017.safetensors
-rw-r--r-- 1 root root 1003M May 20 10:42 model-00017-of-00017.safetensors
-rw-r--r-- 1 root root 24K May 20 10:42 model.safetensors.index.json
-rw-r--r-- 1 root root 439 May 20 10:42 special_tokens_map.json
-rw-r--r-- 1 root root 51K May 20 10:42 tokenizer_config.json
-rw-r--r-- 1 root root 8.7M May 20 10:42 tokenizer.json
量化导出:
// TODO 转成 gguf 格式
自定义训练数据结果演示