{"id":22352019,"url":"https://github.com/simonamdev/cake","last_synced_at":"2025-09-01T03:34:14.216Z","repository":{"id":240575449,"uuid":"748569298","full_name":"simonamdev/cake","owner":"simonamdev","description":"An efficient way to download and store Machine Learning models.","archived":false,"fork":false,"pushed_at":"2024-05-19T19:46:22.000Z","size":11219,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T12:13:45.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonamdev.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,"publiccode":null,"codemeta":null}},"created_at":"2024-01-26T09:21:27.000Z","updated_at":"2024-05-19T19:47:15.000Z","dependencies_parsed_at":"2024-05-19T21:40:50.284Z","dependency_job_id":"a7dc7a2b-3202-4351-8f15-472c55aefddd","html_url":"https://github.com/simonamdev/cake","commit_stats":null,"previous_names":["simonamdev/cake"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simonamdev/cake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonamdev%2Fcake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonamdev%2Fcake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonamdev%2Fcake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonamdev%2Fcake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonamdev","download_url":"https://codeload.github.com/simonamdev/cake/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonamdev%2Fcake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273069711,"owners_count":25040103,"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-09-01T02:00:09.058Z","response_time":120,"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-12-04T12:16:54.972Z","updated_at":"2025-09-01T03:34:14.156Z","avatar_url":"https://github.com/simonamdev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003c!-- TODO: Logo --\u003e\n\n\u003ch1\u003ecake 🍰\u003c/h1\u003e\n\n![license_shield](https://img.shields.io/github/license/simonamdev/cake?style=flat-square)\n![issues_shield](https://img.shields.io/github/issues/simonamdev/cake?style=flat-square)\n![pull_requests_shield](https://img.shields.io/github/issues-pr/simonamdev/cake?style=flat-square)\n\n\u003c/div\u003e\n\nDid you know that across 19,000 models in the hugginface `text-gen` category, there is 15.5% of duplication in weights? This results in approximately 43 Terabytes of redundantly stored weights. Arvix paper with the full result coming soon™️.\n\n**cake** is an more efficient way to download and store Machine Learning models from [🤗 Hugging Face](https://huggingface.co/). Think of it as 🐋 docker, but for ML models.\n\nLeveraging the [hugginface/safetensors](https://huggingface.co/docs/safetensors/en/index) format, it enables:\n\n- Parallelising downloads of multiple layers at the same time.\n- Robustness against network failures. `cake` caches each layer to disk, so halting half-way and retrying will not re-download already downloaded layers.\n- Deduplication of layers based on their contents, even across different models. If you download `Mistral-7B-v0.1` followed by a fine-tune of it which only modified the top two layers, then `cake` will only download the top two layers.\n\n## Roadmap\n\n- [x] Setup linting in CI\n- [x] Setup local storage based on layer hashes\n- [ ] On push to `main`, build the executable and create a release\n- [x] Make CLI arguments easier to use for download (example: `cake download foo` instead of `cake download --model-id foo`)\n- [ ] Setup config and allow overriding of storage folder, registry URL, etc\n- [ ] Setup a public facing instance of the hashes registry\n\n## Installation\n\nCurrently `cake` can only be built from source. Pre-built binaries coming soon™️.\n\n## Usage\n\n`cake help` to view how to use it.\n\n`cake download \u003cMODEL_ID\u003e` to download a model to a folder relative to `cake` called `download` (config coming soon™️).\n\nExample: `cake download KoboldAI/fairseq-dense-1.3B` will download this model: https://huggingface.co/KoboldAI/fairseq-dense-1.3B from the `main` branch.\n\n## Contributing\n\n`cake` at this time is a personal project of mine with two main aims:\n\n1. Introducing better tooling into ML workflows\n2. Learning the `rust` programming language\n\nContributions targetting either of the above are appreciated and will be reviewed on a best-effort basis.\n\n# The idea behind cake\n\nGiven a model name (example: `Mistral-7B-OpenOrca`):\n\n1. Extract the layer hashes for the model\n2. Check if all the layers are stored locally\n3. Create a diff of the layers available locally and the layers required\n4. For each layer required:\n   1. Pull only the layers required from the remote storage [1]\n   2. Compress it for local storage\n5. Once all layers are available, export a new full model file\n\n### Potential issues\n\nAs marked with [1], the \"remote storage\" is not fully figured out yet. Docker has the idea of a registry that could also work here. Using the `Range` HTTP header has allowed us to pull only specific layers from Huggingface so far.\n\nExample curl: `curl --range 262175808-379616319 -L https://huggingface.co/KoboldAI/fairseq-dense-1.3B/resolve/main/model.safetensors\\?download\\=true -o model.safetensors`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonamdev%2Fcake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonamdev%2Fcake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonamdev%2Fcake/lists"}