{"id":18608957,"url":"https://github.com/harperreed/mlx_clip","last_synced_at":"2025-05-08T01:44:10.216Z","repository":{"id":229691299,"uuid":"777380806","full_name":"harperreed/mlx_clip","owner":"harperreed","description":"A simple package to use CLIP on apple silicon using the MLX libraries from Apple","archived":false,"fork":false,"pushed_at":"2024-03-27T16:52:08.000Z","size":321,"stargazers_count":69,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T01:44:04.568Z","etag":null,"topics":["apple","clip","mlx","openai"],"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/harperreed.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-03-25T18:39:35.000Z","updated_at":"2025-02-21T15:26:05.000Z","dependencies_parsed_at":"2024-11-07T03:04:54.667Z","dependency_job_id":"e423401c-3eb0-4e0a-94fc-9f458d5e2df5","html_url":"https://github.com/harperreed/mlx_clip","commit_stats":null,"previous_names":["harperreed/mlx-clip","harperreed/mlx_clip"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Fmlx_clip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Fmlx_clip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Fmlx_clip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Fmlx_clip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harperreed","download_url":"https://codeload.github.com/harperreed/mlx_clip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252983757,"owners_count":21835758,"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":["apple","clip","mlx","openai"],"created_at":"2024-11-07T03:04:46.948Z","updated_at":"2025-05-08T01:44:10.192Z","avatar_url":"https://github.com/harperreed.png","language":"Python","funding_links":[],"categories":["Libraries and Tools","Rising projects"],"sub_categories":["2024"],"readme":"# MLX_CLIP 📚🤖\n\n[![GitHub](https://img.shields.io/github/license/harperreed/mlx-clip)](https://github.com/harperreed/mlx-clip/blob/main/LICENSE)\n\nWelcome to the MLX_CLIP repository! 🎉 This repository contains an implementation of the CLIP (Contrastive Language-Image Pre-training) model using the MLX library. CLIP is a powerful model that learns to associate images with their corresponding textual descriptions, enabling various downstream tasks such as image retrieval and zero-shot classification. 🖼️📝\n\n## Features ✨\n\n- Easy-to-use MLX_CLIP model for generating image and text embeddings\n- Support for loading pre-trained CLIP weights from Hugging Face\n- Efficient conversion of weights to MLX format for optimal performance\n- Seamless integration with the MLX library for accelerated inference on Apple Silicon devices\n\n## Getting Started 🚀\n\nTo get started with MLX_CLIP, follow these steps:\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/harperreed/mlx_clip.git\n   ```\n\n2. Install the required dependencies:\n   ```\n   pip install -r requirements.txt\n   ```\n\n3. Load the pre-trained CLIP model:\n   ```python\n   from mlx_clip import mlx_clip\n\n   model_dir = \"path/to/pretrained/model\"\n   clip = mlx_clip(model_dir)\n   ```\n\n4. Use the CLIP model for generating image and text embeddings:\n   ```python\n   image_path = \"path/to/image.jpg\"\n   image_embedding = clip.image_encoder(image_path)\n\n   text = \"A description of the image\"\n   text_embedding = clip.text_encoder(text)\n   ```\n\n\n\n## Examples 💡\n\nCheck out the `example.py` file for a simple example of how to use MLX_CLIP to generate image and text embeddings.\n\n## Model Conversion 🔄\n\nMLX_CLIP provides a convenient utility to convert pre-trained CLIP weights from the Hugging Face repository to the MLX format. To convert weights, use the `convert_weights` function from `mlx_clip.convert`:\n\n```python\nfrom mlx_clip.convert import convert_weights\n\nhf_repo = \"openai/clip-vit-base-patch32\"\nmlx_path = \"path/to/save/converted/model\"\nconvert_weights(hf_repo, mlx_path)\n```\n\n## Contributing 🤝\n\nContributions to MLX_CLIP are welcome! If you encounter any issues, have suggestions for improvements, or want to add new features, please open an issue or submit a pull request. Make sure to follow the existing code style and provide appropriate documentation for your changes.\n\n## License 📜\n\nMLX_CLIP is licensed under the [MIT License](LICENSE).\n\n## Acknowledgments 🙏\n\nMLX_CLIP is heavily based on the [mlx-experiments clip implementation](https://github.com/ml-explore/mlx-examples/tree/main/clip). Special thanks to the MLX team for their incredible work!\n\n## Contact 📞\n\nFor any questions or inquiries, feel free to reach out to the project maintainer:\n\nHarper Reed\n- Email: harper@modest.com\n- GitHub: [harperreed](https://github.com/harperreed)\n\nHappy coding with MLX_CLIP! 😄💻🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharperreed%2Fmlx_clip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharperreed%2Fmlx_clip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharperreed%2Fmlx_clip/lists"}