Views
No views yet
clip-vit-base-patch16.
Refer to the original model card for more details on the model.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-patch16mlx-examples.1git clone git@github.com:ml-explore/mlx-examples.git
2cd clip
3pip install -r requirements.txt1from PIL import Image
2import clip
3
4model, tokenizer, img_processor = clip.load("mlx_model")
5inputs = {
6 "input_ids": tokenizer(["a photo of a cat", "a photo of a dog"]),
7 "pixel_values": img_processor(
8 [Image.open("assets/cat.jpeg"), Image.open("assets/dog.jpeg")]
9 ),
10}
11output = model(**inputs)
12
13# Get text and image embeddings:
14text_embeds = output.text_embeds
15image_embeds = output.image_embeds