{"id":18336700,"url":"https://github.com/adrianbzg/llm-distributed-finetune","last_synced_at":"2025-10-07T17:12:30.235Z","repository":{"id":216841598,"uuid":"655251976","full_name":"AdrianBZG/LLM-distributed-finetune","owner":"AdrianBZG","description":"Tune efficiently any LLM model from HuggingFace using distributed training (multiple GPU) and DeepSpeed. Uses Ray AIR to orchestrate the training on multiple AWS GPU instances","archived":false,"fork":false,"pushed_at":"2023-06-20T08:25:26.000Z","size":21878,"stargazers_count":57,"open_issues_count":1,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-08T23:36:05.085Z","etag":null,"topics":["aws","deep-learning","distributed-training","falcon","fine-tuning","huggingface","large-language-models","natural-language-processing","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdrianBZG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-06-18T10:54:23.000Z","updated_at":"2025-05-04T03:55:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac45fa38-94fd-4019-ab32-301d8ed90722","html_url":"https://github.com/AdrianBZG/LLM-distributed-finetune","commit_stats":null,"previous_names":["adrianbzg/llm-distributed-finetune"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AdrianBZG/LLM-distributed-finetune","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianBZG%2FLLM-distributed-finetune","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianBZG%2FLLM-distributed-finetune/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianBZG%2FLLM-distributed-finetune/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianBZG%2FLLM-distributed-finetune/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdrianBZG","download_url":"https://codeload.github.com/AdrianBZG/LLM-distributed-finetune/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdrianBZG%2FLLM-distributed-finetune/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278811851,"owners_count":26050183,"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-10-07T02:00:06.786Z","response_time":59,"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":["aws","deep-learning","distributed-training","falcon","fine-tuning","huggingface","large-language-models","natural-language-processing","transformers"],"created_at":"2024-11-05T20:08:38.540Z","updated_at":"2025-10-07T17:12:30.206Z","avatar_url":"https://github.com/AdrianBZG.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Finetuning Large Language Models Efficiently on a Distributed Cluster\n\nThis repository is a boilerplate/fingerprint to fine tune any HuggingFace Large Language Model, such as FALCON-7B, using a distributed cluster.\nThe purpose of this repo is to make it straightforward to fine tune any model efficiently by leveraging multi-GPU training.\nIt uses Ray AIR to orchestrate the cluster on AWS, and DeepSpeed for parameter+optimizer sharding + offloading.\n\nThe following FALCON-7B model was fine-tuned using this repo: [https://huggingface.co/AdrianBZG/falcon-7b-spanish-8bit](https://huggingface.co/AdrianBZG/falcon-7b-spanish-8bit)\n\n## Setup\n\nFirst, you need to clone the repo:\n\n`git clone https://github.com/AdrianBZG/LLM-distributed-finetune`\n\nThen, configure your aws credentials using the `awscli` package command `aws configure`. This will allow Ray to spawn the head node and provision workers with the auto-scaling mechanism. If you don't have `awscli`, you can install it using `pip install awscli`.\n\n## Working with the Ray cluster and submitting finetuning jobs\n\nTo spawn the cluster, simply run:\n\n`ray up ray_cluster.yaml`\n\nOnce Ray has finished setting up the cluster, you can attach to the head node by doing:\n\n`ray attach ray_cluster.yaml`\n\nNow, to run a finetuning job, you can use the script `finetune.py` under `/src`.\n\nAn example usage is as below:\n\n`python finetune.py --model=\"tiiuae/falcon-7b\" --num-workers 4 --data alpaca_data_cleaned.json`\n\nThis will run a finetuning on the FALCON-7B model using 4 GPU workers, and the Alpaca instruction dataset. Feel free to adjust the arguments for your own purposes.\n\nWhen you are finished, you can turn off the cluster with:\n\n`ray down ray_cluster.yaml`\n\n## Changing DeepSpeed configuration\n\nTo tune the DeepSpeed configuration for your specific use case, edit the file on `config/deepspeed.json`. If you want to disable DeepSpeed, you can pass the `--no-deepspeed` parameter to the `finetune.py` script.\n\n# Datasets\n\nI have successfully fine-tuned FALCON-7B on the following 2 datasets:\n\n- Alpaca: [https://huggingface.co/datasets/yahma/alpaca-cleaned](https://huggingface.co/datasets/yahma/alpaca-cleaned)\n- Alpaca Spanish: [https://huggingface.co/datasets/bertin-project/alpaca-spanish](https://huggingface.co/datasets/bertin-project/alpaca-spanish)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbzg%2Fllm-distributed-finetune","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianbzg%2Fllm-distributed-finetune","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianbzg%2Fllm-distributed-finetune/lists"}