{"id":19054657,"url":"https://github.com/ssbuild/llm_finetuning","last_synced_at":"2025-07-16T18:40:47.234Z","repository":{"id":153472952,"uuid":"622621532","full_name":"ssbuild/llm_finetuning","owner":"ssbuild","description":"Large language Model fintuning  bloom , opt , gpt, gpt2 ,llama,llama-2,cpmant and so on","archived":false,"fork":false,"pushed_at":"2024-04-24T16:02:26.000Z","size":333,"stargazers_count":97,"open_issues_count":4,"forks_count":11,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-07-11T23:04:07.200Z","etag":null,"topics":["adalora","bloom","cpmant","gpt","gpt2","llama","llama2","lora","mistral","opt","qlora"],"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/ssbuild.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-02T16:44:14.000Z","updated_at":"2025-03-08T12:31:37.000Z","dependencies_parsed_at":"2024-07-27T20:05:57.255Z","dependency_job_id":null,"html_url":"https://github.com/ssbuild/llm_finetuning","commit_stats":{"total_commits":234,"total_committers":2,"mean_commits":117.0,"dds":"0.46153846153846156","last_synced_commit":"a97f06f8a69da113749c251ce3e769affdf4b5d6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ssbuild/llm_finetuning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_finetuning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_finetuning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_finetuning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_finetuning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbuild","download_url":"https://codeload.github.com/ssbuild/llm_finetuning/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_finetuning/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265530558,"owners_count":23783112,"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":["adalora","bloom","cpmant","gpt","gpt2","llama","llama2","lora","mistral","opt","qlora"],"created_at":"2024-11-08T23:39:16.152Z","updated_at":"2025-07-16T18:40:47.216Z","avatar_url":"https://github.com/ssbuild.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## update information\r\n   - [deep_training](https://github.com/ssbuild/deep_training)\r\n\r\n```text\r\n    2024-04-23 support qwen2\r\n    2024-04-22 简化配置\r\n    2023-11-27 yi modle_type change to llama\r\n    2023-11-15 support load custom model , only modify config/constant_map.py\r\n    2023-10-09 support accelerator trainer\r\n    2023-10-07 support colossalai trainer\r\n    2023-09-26 support transformers trainer\r\n    2023-08-16 推理可选使用 Rope NtkScale , 不训练扩展推理长度\r\n    2023-08-02 增加 muti lora infer 例子, 手动升级 aigc_zoo , pip install -U git+https://github.com/ssbuild/deep_training.zoo.git --force-reinstall --no-deps\r\n    2023-06-13 fix llama resize_token_embeddings\r\n    2023-06-01 support deepspeed training for lora adalora prompt,0.1.9 和 0.1.10合并\r\n    2023-05-27 add qlora transformers\u003e=4.30\r\n    2023-05-24 fix p-tuning-v2 load weight bugs\r\n    2023-05-12 fix lora int8 多卡训练 , ppo training move to https://github.com/ssbuild/rlhf_llm\r\n    2023-05-02 增加p-tuning-v2\r\n    2023-04-28 deep_training 0.1.3 pytorch-lightning 改名 ligntning ，旧版本 deep_training \u003c= 0.1.2\r\n    2023-04-23 增加lora merge权重（修改infer_lora_finetuning.py enable_merge_weight 选项）\r\n    2023-04-11 升级 lora , 增加adalora\r\n```\r\n   \r\n\r\n## install\r\n  - pip install -U -r requirements.txt\r\n  - 如果无法安装， 可以切换官方源 pip install -i https://pypi.org/simple -U -r requirements.txt\r\n\r\n```text\r\n\r\n# flash-attention对显卡算例要求算力7.5 以上 ， 下面可选安装 ，如果卡不支持可以不安装。\r\ngit clone -b https://github.com/Dao-AILab/flash-attention\r\ncd flash-attention \u0026\u0026 pip install .\r\npip install csrc/layer_norm\r\npip install csrc/rotary\r\n```\r\n\r\n## weigtht select one is suitable for you\r\n支持且不限于以下权重    \r\n- [Qwen1.5-1.8B-Chat](https://huggingface.co/Qwen/Qwen1.5-1.8B-Chat)\r\n- [Qwen1.5-7B-Chat](https://huggingface.co/Qwen/Qwen1.5-7B-Chat)\r\n- [Qwen1.5-14B-Chat](https://huggingface.co/Qwen/Qwen1.5-14B-Chat)\r\n- [Qwen1.5-32B-Chat](https://huggingface.co/Qwen/Qwen1.5-32B-Chat)\r\n- [zephyr-7b-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta)\r\n- [mistral-7b-sft-beta](https://huggingface.co/HuggingFaceH4/mistral-7b-sft-beta)\r\n- [Yi-6B](https://huggingface.co/01-ai/Yi-6B) \r\n- [Yi-6B-200K](https://huggingface.co/01-ai/Yi-6B-200K)\r\n- [Yi-34B](https://huggingface.co/01-ai/Yi-34B)\r\n- [Yi-34B-200K](https://huggingface.co/01-ai/Yi-34B-200K)\r\n- [Yi-34B-Chat](https://huggingface.co/01-ai/Yi-34B-Chat)\r\n- [LingoWhale-8B](https://www.modelscope.cn/models/DeepLang/LingoWhale-8B)\r\n- [CausalLM-14B](https://huggingface.co/CausalLM/14B)\r\n- [CausalLM-7B](https://huggingface.co/CausalLM/7B)\r\n- [BlueLM-7B-Chat](https://huggingface.co/vivo-ai/BlueLM-7B-Chat)\r\n- [BlueLM-7B-Chat-32K](https://huggingface.co/vivo-ai/BlueLM-7B-Chat-32K)\r\n- [BlueLM-7B-Base](https://huggingface.co/vivo-ai/BlueLM-7B-Base)\r\n- [BlueLM-7B-Base-32K](https://huggingface.co/vivo-ai/BlueLM-7B-Base-32K)\r\n- [XVERSE-13B-Chat](https://huggingface.co/xverse/XVERSE-13B-Chat)\r\n- [xverse-13b-chat-int4](https://huggingface.co/ssbuild/xverse-13b-chat-int4)\r\n- [XVERSE-13B](https://huggingface.co/xverse/XVERSE-13B)\r\n- [xverse-13b-int4](https://huggingface.co/ssbuild/xverse-13b-int4)\r\n- [Skywork-13B-base](https://huggingface.co/Skywork/Skywork-13B-base)\r\n- [internlm-chat-20b](https://huggingface.co/internlm/internlm-chat-20b)\r\n- [internlm-20b](https://huggingface.co/internlm/internlm-20b)\r\n- [internlm-chat-7b](https://huggingface.co/internlm/internlm-chat-7b)\r\n- [internlm-chat-7b-8k](https://huggingface.co/internlm/internlm-chat-7b-8k)\r\n- [internlm-7b](https://huggingface.co/internlm/internlm-7b)\r\n- [internlm-chat-7b-int4](https://huggingface.co/ssbuild/internlm-chat-7b-int4)\r\n- [bloom预训练模型](https://huggingface.co/bigscience)\r\n- [bloom第三方中文训练模型](https://huggingface.co/Langboat/bloom-6b4-zh)  # 注意 需要修改tokenizer_config.json BloomTokenizer -\u003e BloomTokenizerFast\r\n- [tigerbot](https://huggingface.co/TigerResearch)\r\n- [opt预训练模型](https://huggingface.co/facebook)\r\n- [llama 官方权重转换](https://huggingface.co/decapoda-research) #  llama 词典等下载地址 https://huggingface.co/hf-internal-testing/llama-tokenizer\r\n- [llama vicuna-7B第三方权重1](https://huggingface.co/TheBloke/vicuna-7B-1.1-HF)\r\n- [llama vicuna-7B第三方权重2](https://huggingface.co/Tribbiani/vicuna-7b)\r\n- [cpm-ant-10b](https://huggingface.co/openbmb/cpm-ant-10b)\r\n- [rwkv](https://huggingface.co/BlinkDL) 需要转换权重\r\n- [rwkv](https://huggingface.co/RWKV/rwkv-4-169m-pile) hf 权重\r\n- [Llama2-Chinese-7b-Chat](https://huggingface.co/FlagAlpha/Llama2-Chinese-7b-Chat)\r\n- [Llama2-Chinese-13b-Chat](https://huggingface.co/FlagAlpha/Llama2-Chinese-13b-Chat)\r\n- [TransGPT](https://huggingface.co/DUOMO-Lab/TransGPT-v0) Llama2中文权重\r\n- [tigerbot-13b-chat](https://huggingface.co/TigerResearch/tigerbot-13b-chat) Llama2中文权重\r\n\r\n## data sample\r\n- [open_data 不定时更新数据集](https://github.com/ssbuild/open_data)\r\n   \r\n单条数据示例\r\n```text\r\nrole one of user system function assistant\r\nq question optional\r\na answer   must\r\n\r\n```\r\n\r\n```json\r\n{\"id\": 1, \"paragraph\": [{\"q\": \"从南京到上海的路线\", \"a\": [\"你好，南京到上海的路线如下：\", \"1. 南京到上海，可以乘坐南京地铁1号线，在南京站乘坐轨道交通1号线。\", \"2. 南京到浦东机场，可以搭乘上海地铁1号，在陆家嘴站乘坐地铁1线，在浦东国际机场站乘坐机场快线，前往上海浦东国际机场。\", \"3. 上海到南京，可以换乘上海地铁2号线，从南京站换乘地铁2线，再从南京南站换乘地铁1路，然后到达上海站\"]}]}\r\n{\"id\": 2, \"paragraph\": [{\"q\": \"写一个诗歌，关于冬天\", \"a\": [\"冬夜寂静冷，\", \"云在天边飘，\", \"冰封白雪上， \", \"寒冷像一场雪。\", \" \", \"雪花融化成冰，\", \"像那雪花飘洒，\", \"在寒冷的冬天，\", \"感受春天的喜悦。\", \" 冬日里，\", \"风雪渐消，\", \"一片寂静，\", \"把快乐和温暖带回家。\"]}]}\r\n{\"id\": 3, \"paragraph\": [{\"q\": \"晚上睡不着应该怎么办\", \"a\": [\"晚上睡不着可能会让你感到焦虑或不舒服,但以下是一些可以帮助你入睡的方法:\", \"\", \"1. 制定规律的睡眠时间表:保持规律的睡眠时间表可以帮助你建立健康的睡眠习惯,使你更容易入睡。尽量在每天的相同时间上床,并在同一时间起床。\", \"2. 创造一个舒适的睡眠环境:确保睡眠环境舒适,安静,黑暗且温度适宜。可以使用舒适的床上用品,并保持房间通风。\", \"3. 放松身心:在睡前做些放松的活动,例如泡个热水澡,听些轻柔的音乐,阅读一些有趣的书籍等,有助于缓解紧张和焦虑,使你更容易入睡。\", \"4. 避免饮用含有咖啡因的饮料:咖啡因是一种刺激性物质,会影响你的睡眠质量。尽量避免在睡前饮用含有咖啡因的饮料,例如咖啡,茶和可乐。\", \"5. 避免在床上做与睡眠无关的事情:在床上做些与睡眠无关的事情,例如看电影,玩游戏或工作等,可能会干扰你的睡眠。\", \"6. 尝试呼吸技巧:深呼吸是一种放松技巧,可以帮助你缓解紧张和焦虑,使你更容易入睡。试着慢慢吸气,保持几秒钟,然后缓慢呼气。\", \"\", \"如果这些方法无法帮助你入睡,你可以考虑咨询医生或睡眠专家,寻求进一步的建议。\"]}]}\r\n```\r\n\r\n或者\r\n\r\n```json\r\n{\"id\": 1, \"conversations\": [{\"from\": \"user\", \"value\": \"从南京到上海的路线\"}, {\"from\": \"assistant\", \"value\": [\"你好，南京到上海的路线如下：\", \"1. 南京到上海，可以乘坐南京地铁1号线，在南京站乘坐轨道交通1号线。\", \"2. 南京到浦东机场，可以搭乘上海地铁1号，在陆家嘴站乘坐地铁1线，在浦东国际机场站乘坐机场快线，前往上海浦东国际机场。\", \"3. 上海到南京，可以换乘上海地铁2号线，从南京站换乘地铁2线，再从南京南站换乘地铁1路，然后到达上海站\"]}]}\r\n{\"id\": 2, \"conversations\": [{\"from\": \"user\", \"value\": \"写一个诗歌，关于冬天\"}, {\"from\": \"assistant\", \"value\": [\"冬夜寂静冷，\", \"云在天边飘，\", \"冰封白雪上， \", \"寒冷像一场雪。\", \" \", \"雪花融化成冰，\", \"像那雪花飘洒，\", \"在寒冷的冬天，\", \"感受春天的喜悦。\", \" 冬日里，\", \"风雪渐消，\", \"一片寂静，\", \"把快乐和温暖带回家。\"]}]}\r\n{\"id\": 3, \"conversations\": [{\"from\": \"user\", \"value\": \"晚上睡不着应该怎么办\"}, {\"from\": \"assistant\", \"value\": [\"晚上睡不着可能会让你感到焦虑或不舒服,但以下是一些可以帮助你入睡的方法:\", \"\", \"1. 制定规律的睡眠时间表:保持规律的睡眠时间表可以帮助你建立健康的睡眠习惯,使你更容易入睡。尽量在每天的相同时间上床,并在同一时间起床。\", \"2. 创造一个舒适的睡眠环境:确保睡眠环境舒适,安静,黑暗且温度适宜。可以使用舒适的床上用品,并保持房间通风。\", \"3. 放松身心:在睡前做些放松的活动,例如泡个热水澡,听些轻柔的音乐,阅读一些有趣的书籍等,有助于缓解紧张和焦虑,使你更容易入睡。\", \"4. 避免饮用含有咖啡因的饮料:咖啡因是一种刺激性物质,会影响你的睡眠质量。尽量避免在睡前饮用含有咖啡因的饮料,例如咖啡,茶和可乐。\", \"5. 避免在床上做与睡眠无关的事情:在床上做些与睡眠无关的事情,例如看电影,玩游戏或工作等,可能会干扰你的睡眠。\", \"6. 尝试呼吸技巧:深呼吸是一种放松技巧,可以帮助你缓解紧张和焦虑,使你更容易入睡。试着慢慢吸气,保持几秒钟,然后缓慢呼气。\", \"\", \"如果这些方法无法帮助你入睡,你可以考虑咨询医生或睡眠专家,寻求进一步的建议。\"]}]}\r\n```\r\n\r\n\r\n## infer\r\n    # infer_finetuning.py 推理微调模型\r\n    # infer_lora_finetuning.py 推理微调模型\r\n    # infer_ptuning.py 推理p-tuning-v2微调模型\r\n     python infer_finetuning.py\r\n\r\n\r\n\r\n## training\r\n```text\r\n# 制作数据\r\ncd scripts\r\nbash train_full.sh -m dataset \r\nor\r\nbash train_lora.sh -m dataset \r\nor\r\nbash train_ptv2.sh -m dataset \r\n\r\n注: num_process_worker 为多进程制作数据 ， 如果数据量较大 ， 适当调大至cpu数量\r\ndataHelper.make_dataset_with_args(data_args.train_file,mixed_data=False, shuffle=True,mode='train',num_process_worker=0)\r\n\r\n# 全参数训练 \r\n    bash train_full.sh -m train\r\n    \r\n# lora adalora ia3 \r\n    bash train_lora.sh -m train\r\n    \r\n# ptv2\r\n    bash train_ptv2.sh -m train\r\n```\r\n   \r\n## 训练参数\r\n[训练参数](args.MD)\r\n\r\n## 友情链接\r\n\r\n- [pytorch-task-example](https://github.com/ssbuild/pytorch-task-example)\r\n- [moss_finetuning](https://github.com/ssbuild/moss_finetuning)\r\n- [chatglm_finetuning](https://github.com/ssbuild/chatglm_finetuning)\r\n- [chatglm2_finetuning](https://github.com/ssbuild/chatglm2_finetuning)\r\n- [chatglm3_finetuning](https://github.com/ssbuild/chatglm3_finetuning)\r\n- [t5_finetuning](https://github.com/ssbuild/t5_finetuning)\r\n- [llm_finetuning](https://github.com/ssbuild/llm_finetuning)\r\n- [llm_rlhf](https://github.com/ssbuild/llm_rlhf)\r\n- [chatglm_rlhf](https://github.com/ssbuild/chatglm_rlhf)\r\n- [t5_rlhf](https://github.com/ssbuild/t5_rlhf)\r\n- [rwkv_finetuning](https://github.com/ssbuild/rwkv_finetuning)\r\n- [baichuan_finetuning](https://github.com/ssbuild/baichuan_finetuning)\r\n- [xverse_finetuning](https://github.com/ssbuild/xverse_finetuning)\r\n- [internlm_finetuning](https://github.com/ssbuild/internlm_finetuning)\r\n- [qwen_finetuning](https://github.com/ssbuild/qwen_finetuning)\r\n- [skywork_finetuning](https://github.com/ssbuild/skywork_finetuning)\r\n- [bluelm_finetuning](https://github.com/ssbuild/bluelm_finetuning)\r\n- [yi_finetuning](https://github.com/ssbuild/yi_finetuning)\r\n\r\n## \r\n    纯粹而干净的代码\r\n\r\n## Star History\r\n\r\n[![Star History Chart](https://api.star-history.com/svg?repos=ssbuild/llm_finetuning\u0026type=Date)](https://star-history.com/#ssbuild/llm_finetuning\u0026Date)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbuild%2Fllm_finetuning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbuild%2Fllm_finetuning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbuild%2Fllm_finetuning/lists"}