{"id":21135254,"url":"https://github.com/cloneofsimo/fim-llama-deepspeed","last_synced_at":"2025-07-29T04:07:35.864Z","repository":{"id":214972628,"uuid":"737807549","full_name":"cloneofsimo/fim-llama-deepspeed","owner":"cloneofsimo","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-01T15:30:22.000Z","size":710,"stargazers_count":31,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T09:47:32.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cloneofsimo.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":"2024-01-01T15:20:45.000Z","updated_at":"2024-05-24T05:30:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"61c3e5a1-3def-43a9-811c-99c65151b714","html_url":"https://github.com/cloneofsimo/fim-llama-deepspeed","commit_stats":null,"previous_names":["cloneofsimo/fim-llama-deepspeed"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cloneofsimo/fim-llama-deepspeed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloneofsimo%2Ffim-llama-deepspeed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloneofsimo%2Ffim-llama-deepspeed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloneofsimo%2Ffim-llama-deepspeed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloneofsimo%2Ffim-llama-deepspeed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloneofsimo","download_url":"https://codeload.github.com/cloneofsimo/fim-llama-deepspeed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloneofsimo%2Ffim-llama-deepspeed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267626875,"owners_count":24117707,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-20T06:46:57.093Z","updated_at":"2025-07-29T04:07:35.692Z","avatar_url":"https://github.com/cloneofsimo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FIM-LLAMA and Deepspeed FIM Trainer\n\n\nhttps://github.com/cloneofsimo/fim-llama-deepspeed/assets/35953539/e5f4e48c-c46b-4d33-a57a-05ce9568a795\n\n\nLink to [Huggingface model](https://huggingface.co/cloneofsimo/fim-llama), fine-tuned [Tulu-2-dpo](https://huggingface.co/allenai/tulu-2-dpo-70b) for FIM capability based on this code.\n\n---\n\nTrain llama to have Fill-in-the-middle capability, with pure deepspeed.\n\nIt is mostly copy-paste from [deepspeed-examples](https://github.com/microsoft/DeepSpeedExamples/blob/master/applications/DeepSpeed-Chat/training/step1_supervised_finetuning/main.py).\n\n## Installation\n\n```bash\ndeepspeed --num_gpus 8 main.py\n```\n\n## How to prompt FIM-LLAMA?\n\nThe model is trained with new tokens : \n\n```python\nnew_tokens = [\"\u003c|SUFFIX|\u003e\", \"\u003c|PREFIX|\u003e\", \"\u003c|order|\u003e\", \"\u003c|STARTFIM|\u003e\",\"\u003c|ENDMIDDLE|\u003e\", \"\u003c|MIDDLE_0|\u003e\", \"\u003c|MIDDLE_1|\u003e\", \"\u003c|MIDDLE_2|\u003e\", \"\u003c|MIDDLE_3|\u003e\", \"\u003c|MIDDLE_4|\u003e\", \"\u003c|MIDDLE_5|\u003e\", \"\u003c|MIDDLE_6|\u003e\"],\n```\n\nHere is how you would prompt it:\n\n```python\ninstruction = f\"\u003c|user|\u003e Complete the following text. \u003c|assistant|\u003e\u003c|STARTFIM|\u003e\u003c|SUFFIX|\u003e{suffix}\u003c|PREFIX|\u003e{prefix}\u003c|MIDDLE|\u003e\u003c|MIDDLE_N|\u003e\"\n```\n\n* $N$ is order of magnitude of the middle you want to fill in.\n* Document is in form of prefix + MIDDLE_YOU_WANT + suffix.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloneofsimo%2Ffim-llama-deepspeed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloneofsimo%2Ffim-llama-deepspeed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloneofsimo%2Ffim-llama-deepspeed/lists"}