ml-aim icon indicating copy to clipboard operation
ml-aim copied to clipboard

MLX example?

Open maxlund opened this issue 10 months ago • 0 comments

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)

maxlund avatar Jan 26 '25 16:01 maxlund