CoolFace
Modelpublic

wzh19960613/mobileclip2-b-safetensors

sourceHugging Faceotherupdated 3mo agoView on Hugging Face
0likes
Model Card

mobileclip2-b-safetensors

Chinese documentation: README_CN.md.

Usage is documented in `github.com/wzh19960613/mobileclip2-b-rs`.

This repository contains SafeTensors exports of Apple MobileCLIP2-B weights for a Rust loader, plus the CLIP BPE tokenizer.

Contents

FilePurpose
convert_ts_to_safetensors.pyConversion script. It supports Apple .pt exports for text, image, and full, plus the Ultralytics .ts text export.
tokenizer.min.jsonCLIP BPE tokenizer, sourced from openai/clip-vit-base-patch32.
mobileclip2_b.safetensorsText-only weights, 149 tensors, kept compatible with the older file name.
mobileclip2_b_image.safetensorsImage-only weights, 162 tensors.
mobileclip2_b_full.safetensorsFull weights, text.* + image.* + logit_scale, 312 tensors.

Sources

Conversion

bash
python convert_ts_to_safetensors.py \
    --input /path/to/mobileclip2_b.pt \
    --component text \
    --output mobileclip2_b.safetensors

python convert_ts_to_safetensors.py \
    --input /path/to/mobileclip2_b.pt \
    --component image \
    --output mobileclip2_b_image.safetensors

python convert_ts_to_safetensors.py \
    --input /path/to/mobileclip2_b.pt \
    --component full \
    --output mobileclip2_b_full.safetensors

python convert_ts_to_safetensors.py \
    --input /path/to/mobileclip2_b.ts \
    --component text \
    --output mobileclip2_b.safetensors

Key layout:

  • —text-only: unprefixed text semantic keys, such as token_embedding.weight.
  • —image-only: unprefixed image semantic keys, such as cls_token and blocks.0.*.
  • —full: text.* and image.* prefixes, plus logit_scale.

License

convert_ts_to_safetensors.py is MIT licensed. The model weights are derived from Apple's official MobileCLIP2-B release and follow the Apple Sample Code License / Apple ML Research Model Terms of Use, for research use only. tokenizer.min.json is sourced from the OpenAI CLIP tokenizer and follows its MIT License.