wzh19960613/mobileclip2-b-safetensors
0
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
Sources
mobileclip2_b.pt: the official Apple full checkpoint from `apple/MobileCLIP2-B`.mobileclip2_b.ts: the Ultralytics text encoder TorchScript export from `ultralytics/assets` GitHub release, used for compatibility with the Ultralytics inference path.tokenizer.min.json: the CLIP BPE tokenizer from `openai/clip-vit-base-patch32`.
Conversion
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.safetensorsKey layout:
- text-only: unprefixed text semantic keys, such as
token_embedding.weight. - image-only: unprefixed image semantic keys, such as
cls_tokenandblocks.0.*. - full:
text.*andimage.*prefixes, pluslogit_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.
