Skip to content

MLX example? #31

@maxlund

Description

@maxlund

Hi, wanted to do some quick tests using aimv2-large-patch14-224-lit with the MLX backend but can't seem to find any convenience function to encode text in the repo? Digging through the code for a little while now and not seeing anything like the image encoding example using MLX:

from PIL import Image
import mlx.core as mx

from aim.v2.utils import load_pretrained
from aim.v1.torch.data import val_transforms

img = Image.open(...)
model = load_pretrained("aimv2-large-patch14-336", backend="mlx")
transform = val_transforms(img_size=336)

inp = transform(img).unsqueeze(0)
inp = mx.array(inp.numpy())
features = model(inp)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions