{"id":19054722,"url":"https://github.com/ssbuild/llm_rlhf","last_synced_at":"2025-04-24T03:27:44.417Z","repository":{"id":154208385,"uuid":"629943758","full_name":"ssbuild/llm_rlhf","owner":"ssbuild","description":"realize the reinforcement learning training for gpt2 llama bloom and so on llm model","archived":false,"fork":false,"pushed_at":"2023-09-19T09:03:03.000Z","size":397,"stargazers_count":26,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T12:17:54.798Z","etag":null,"topics":["llm","llm-rlhf","lora","reward","rlhf","trl","trlx"],"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,"zenodo":null}},"created_at":"2023-04-19T10:46:13.000Z","updated_at":"2024-11-01T12:33:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"e30f35d0-74b0-4a5c-a101-ff5b4d398bad","html_url":"https://github.com/ssbuild/llm_rlhf","commit_stats":null,"previous_names":["ssbuild/llm_rlhf"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_rlhf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_rlhf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_rlhf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ssbuild%2Fllm_rlhf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ssbuild","download_url":"https://codeload.github.com/ssbuild/llm_rlhf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250554399,"owners_count":21449606,"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":["llm","llm-rlhf","lora","reward","rlhf","trl","trlx"],"created_at":"2024-11-08T23:39:30.237Z","updated_at":"2025-04-24T03:27:44.404Z","avatar_url":"https://github.com/ssbuild.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n## llm reinforcement learning\r\n    Realize the reinforcement learning training for gpt2 llama bloom,cpm-ant and so on.\r\n\r\n\r\n## update information\r\n- [deep_training](https://github.com/ssbuild/deep_training)\r\n\r\n```text\r\n    06-13 fix llama resize_token_embeddings\r\n    06-01 支持lora deepspeed 训练，0.1.9 和 0.1.10合并\r\n    05-27 add qlora transformers\u003e=4.30\r\n```\r\n\r\n## install\r\n    python \u003e= 3.10\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## weigtht select one is suitable for you\r\n支持且不限于以下权重\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\r\n\r\n## data sample\r\n\r\n```json\r\n{\r\n\t\"prompt\": \"\\n\\nHuman:你能描述如何清除笔记本计算机屏幕上的指纹和污垢的步骤吗?\\n\\nAssistant:是的,也许。为了清洁你的屏幕,你首先需要使用微纤维布或软溼布,轻轻地擦拭屏幕表面。接下来,你会想抓住一个软,无毛巾,微纤维清洁布,轻轻地擦回屏幕上去除指纹和污垢。\\n\\nHuman:我可以将伊索普罗素酒精喷射到布上,并以这种方式清洗它吗?\\n\\nAssistant:\",\r\n\t\"response\": \" 是的,你可以这样做,以帮助布从屏幕上收集更多的污垢。 请确保始终使用干净的软布,而不是一块粗糙的、粗糙的或结构化的材料,并确保它是无毛布的。\",\r\n\t\"chosen\": \" 是的,你可以这样做,以帮助布从屏幕上收集更多的污垢。 请确保始终使用干净的软布,而不是一块粗糙的、粗糙的或结构化的材料,并确保它是无毛布的。\",\r\n\t\"rejected\": \" 是的,你可以直接将它喷射到布上。\"\r\n}\r\n```\r\n\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\n    python data_utils.py\r\n    注: num_process_worker 为多进程制作数据 ， 如果数据量较大 ， 适当调大至cpu数量\r\n    dataHelper.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    python train.py\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- [chatmoss_finetuning](https://github.com/ssbuild/chatmoss_finetuning)\r\n- [chatglm_finetuning](https://github.com/ssbuild/chatglm_finetuning)\r\n- [chatglm2_finetuning](https://github.com/ssbuild/chatglm2_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- [baichuan2_finetuning](https://github.com/ssbuild/baichuan2_finetuning)\r\n- [internlm_finetuning](https://github.com/ssbuild/internlm_finetuning)\r\n- [qwen_finetuning](https://github.com/ssbuild/qwen_finetuning)\r\n- [xverse_finetuning](https://github.com/ssbuild/xverse_finetuning)\r\n- [aigc_serving](https://github.com/ssbuild/aigc_serving)\r\n\r\n## \r\n    纯粹而干净的代码","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbuild%2Fllm_rlhf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssbuild%2Fllm_rlhf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssbuild%2Fllm_rlhf/lists"}