---
title: clip-vit-base-patch32
canonical_url: "https://www.modelscope.cn/models/mlx-community/clip-vit-base-patch32"
md_url: "https://www.modelscope.cn/models/mlx-community/clip-vit-base-patch32.md"
repository: mlx-community/clip-vit-base-patch32
last_updated: 2024-12-19
license: apache-2.0
model_type:
  - clip
architectures:
  - CLIPModel
library_name:
  - mlx
  - pytorch
frameworks:
  - pytorch
inference_backends:
  - "deploy_task vlm"
  - "sglang 0.5.2"
downloads: 990
stars: 0
---

# clip-vit-base-patch32

> clip-vit-base-patch32 - mlx-community 在 ModelScope 开源的模型。mlx-community/clip-vit-base-patch32 This model was converted to MLX format from clip-vit-base-patch32. Refer to the original model card for more details on the model. Use with mlx-examples

mlx-community/clip-vit-base-patch32 是 ModelScope 魔搭社区上的机器学习模型，采用 apache-2.0 许可，可用 deploy_task vlm、sglang 0.5.2 部署。

- **Repository**: mlx-community/clip-vit-base-patch32
- **License**: apache-2.0
- **Inference backends**: deploy_task vlm, sglang 0.5.2
- **Downloads**: 990
- **Stars**: 0
- **Last updated**: 2024-12-19

Source: https://www.modelscope.cn/models/mlx-community/clip-vit-base-patch32

---

# mlx-community/clip-vit-base-patch32
This model was converted to MLX format from [`clip-vit-base-patch32`](https://huggingface.co/openai/clip-vit-base-patch32).
Refer to the [original model card](https://huggingface.co/openai/clip-vit-base-patch32) for more details on the model.
## Use with mlx-examples

Download the repository 👇 

```
pip install huggingface_hub hf_transfer

export HF_HUB_ENABLE_HF_TRANSFER=1
huggingface-cli download --local-dir <LOCAL FOLDER PATH> mlx-community/clip-vit-base-patch32
```

Install `mlx-examples`.

```bash
git clone git@github.com:ml-explore/mlx-examples.git
cd clip
pip install -r requirements.txt
```

Run the model.

```python
from PIL import Image
import clip

model, tokenizer, img_processor = clip.load("mlx_model")
inputs = {
    "input_ids": tokenizer(["a photo of a cat", "a photo of a dog"]),
    "pixel_values": img_processor(
        [Image.open("assets/cat.jpeg"), Image.open("assets/dog.jpeg")]
    ),
}
output = model(**inputs)

# Get text and image embeddings:
text_embeds = output.text_embeds
image_embeds = output.image_embeds
```
