Run this model with HF Jobs
Run apple/aimv2-large-patch14-224 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/apple/aimv2-large-patch14-224. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/apple/aimv2-large-patch14-224 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use apple/aimv2-large-patch14-224 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use apple/aimv2-large-patch14-224 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-feature-extraction", model="apple/aimv2-large-patch14-224", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModel processor = AutoImageProcessor.from_pretrained("apple/aimv2-large-patch14-224", trust_remote_code=True) model = AutoModel.from_pretrained("apple/aimv2-large-patch14-224", trust_remote_code=True, device_map="auto") - MLX
How to use apple/aimv2-large-patch14-224 with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] hf download apple/aimv2-large-patch14-224 --local-dir aimv2-large-patch14-224
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Image and Text features
Hello , could you please give a simple example of obtaining text features and imager features. Only image feature example has been added.
Doing it with MLX was kind of the point. I'm digging around in the repo, think you can get the tokenizer from from transformers:
processor = AutoProcessor.from_pretrained(
"apple/aimv2-large-patch14-224-lit",
)
then just find that in the library code and start looking around for a way to get the input_ids that should be what you calling in.venv/lib/python3.10/site-packages/aim/v2/mlx/models.py
It's this call:
class AIMv2LiT(nn.Module):
...
def encode_text(
self,
input_ids: mx.array,
mask: Optional[mx.array] = None,
output_features: bool = False,
) -> Union[mx.array, Tuple[mx.array, Tuple[mx.array, ...]]]:
out = self.text_encoder(input_ids, mask=mask, output_features=output_features)
out = self.text_projector(out)
return out
I'm gonna give up here for now, this is a sidetrack for something else. Please ping me if you fix a way to test it out in MLX!