{"id":28604623,"url":"https://github.com/apple/ml-fastvlm","last_synced_at":"2025-09-06T17:08:17.205Z","repository":{"id":294496163,"uuid":"976325482","full_name":"apple/ml-fastvlm","owner":"apple","description":"This repository contains the official implementation of \"FastVLM: Efficient Vision Encoding for Vision Language Models\" - CVPR 2025","archived":false,"fork":false,"pushed_at":"2025-05-05T22:59:29.000Z","size":10962,"stargazers_count":5917,"open_issues_count":35,"forks_count":362,"subscribers_count":64,"default_branch":"main","last_synced_at":"2025-09-04T00:42:02.182Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apple.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2025-05-01T22:56:43.000Z","updated_at":"2025-09-04T00:29:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"1cc05ce9-b66b-4f40-9a24-2b5ec2a07236","html_url":"https://github.com/apple/ml-fastvlm","commit_stats":null,"previous_names":["apple/ml-fastvlm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/apple/ml-fastvlm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fml-fastvlm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fml-fastvlm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fml-fastvlm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fml-fastvlm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apple","download_url":"https://codeload.github.com/apple/ml-fastvlm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apple%2Fml-fastvlm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273933933,"owners_count":25193602,"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-06T02:00:13.247Z","response_time":2576,"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":"2025-06-11T18:01:14.188Z","updated_at":"2025-09-06T17:08:17.198Z","avatar_url":"https://github.com/apple.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# FastVLM: Efficient Vision Encoding for Vision Language Models\n\nThis is the official repository of\n**[FastVLM: Efficient Vision Encoding for Vision Language Models](https://www.arxiv.org/abs/2412.13303). (CVPR 2025)**\n\n[//]: # (![FastViTHD Performance]\u0026#40;docs/acc_vs_latency_qwen-2.png\u0026#41;)\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/acc_vs_latency_qwen-2.png\" alt=\"Accuracy vs latency figure.\" width=\"400\"/\u003e\n\u003c/p\u003e\n\n### Highlights\n* We introduce FastViTHD, a novel hybrid vision encoder designed to output fewer tokens and significantly reduce encoding time for high-resolution images.  \n* Our smallest variant outperforms LLaVA-OneVision-0.5B with 85x faster Time-to-First-Token (TTFT) and 3.4x smaller vision encoder.\n* Our larger variants using Qwen2-7B LLM outperform recent works like Cambrian-1-8B while using a single image encoder with a 7.9x faster TTFT.\n* Demo iOS app to demonstrate the performance of our model on a mobile device.\n\n\u003ctable\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003cimg src=\"docs/fastvlm-counting.gif\" alt=\"FastVLM - Counting\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"docs/fastvlm-handwriting.gif\" alt=\"FastVLM - Handwriting\"\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003cimg src=\"docs/fastvlm-emoji.gif\" alt=\"FastVLM - Emoji\"\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Getting Started\nWe use LLaVA codebase to train FastVLM variants. In order to train or finetune your own variants, \nplease follow instructions provided in [LLaVA](https://github.com/haotian-liu/LLaVA) codebase. \nWe provide instructions for running inference with our models.   \n\n### Setup\n```bash\nconda create -n fastvlm python=3.10\nconda activate fastvlm\npip install -e .\n```\n\n### Model Zoo\nFor detailed information on various evaluations, please refer to our [paper](https://www.arxiv.org/abs/2412.13303).\n\n| Model        | Stage |                                            Pytorch Checkpoint (url)                                             |\n|:-------------|:-----:|:---------------------------------------------------------------------------------------------------------------:|\n| FastVLM-0.5B |   2   | [fastvlm_0.5b_stage2](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_0.5b_stage2.zip) |\n|              |   3   | [fastvlm_0.5b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_0.5b_stage3.zip) |\n| FastVLM-1.5B |   2   | [fastvlm_1.5b_stage2](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_1.5b_stage2.zip) |\n|              |   3   | [fastvlm_1.5b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_1.5b_stage3.zip)  |\n| FastVLM-7B   |   2   | [fastvlm_7b_stage2](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_7b_stage2.zip)  |\n|              |   3   | [fastvlm_7b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_7b_stage3.zip)  |\n\nTo download all the pretrained checkpoints run the command below (note that this might take some time depending on your connection so might be good to grab ☕️ while you wait).\n\n```bash\nbash get_models.sh   # Files will be downloaded to `checkpoints` directory.\n```\n\n### Usage Example\nTo run inference of PyTorch checkpoint, follow the instruction below\n```bash\npython predict.py --model-path /path/to/checkpoint-dir \\\n                  --image-file /path/to/image.png \\\n                  --prompt \"Describe the image.\"\n```\n\n### Inference on Apple Silicon\nTo run inference on Apple Silicon, pytorch checkpoints have to be exported to format \nsuitable for running on Apple Silicon, detailed instructions and code can be found [`model_export`](model_export/) subfolder.\nPlease see the README there for more details.\n\nFor convenience, we provide 3 models that are in Apple Silicon compatible format: [fastvlm_0.5b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_0.5b_stage3_llm.fp16.zip), \n[fastvlm_1.5b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_1.5b_stage3_llm.int8.zip), \n[fastvlm_7b_stage3](https://ml-site.cdn-apple.com/datasets/fastvlm/llava-fastvithd_7b_stage3_llm.int4.zip). \nWe encourage developers to export the model of their choice with the appropriate quantization levels following \nthe instructions in [`model_export`](model_export/).\n\n### Inference on Apple Devices\nTo run inference on Apple devices like iPhone, iPad or Mac, see [`app`](app/) subfolder for more details.\n\n## Citation\nIf you found this code useful, please cite the following paper:\n```\n@InProceedings{fastvlm2025,\n  author = {Pavan Kumar Anasosalu Vasu, Fartash Faghri, Chun-Liang Li, Cem Koc, Nate True, Albert Antony, Gokul Santhanam, James Gabriel, Peter Grasch, Oncel Tuzel, Hadi Pouransari},\n  title = {FastVLM: Efficient Vision Encoding for Vision Language Models},\n  booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n  month = {June},\n  year = {2025},\n}\n```\n\n## Acknowledgements\nOur codebase is built using multiple opensource contributions, please see [ACKNOWLEDGEMENTS](ACKNOWLEDGEMENTS) for more details. \n\n## License\nPlease check out the repository [LICENSE](LICENSE) before using the provided code and\n[LICENSE_MODEL](LICENSE_MODEL) for the released models.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fml-fastvlm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapple%2Fml-fastvlm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapple%2Fml-fastvlm/lists"}