Views
No views yet
| Configuration | Explanation |
|---|---|
BASELINE | a reference functionally equivalent to the original model |
BASIC | all linear algebraic operands quantized to MXINT8-64, and all other operations transformed to approximated kernel simulations |
pip install dmx_compressor1from PIL import Image
2import requests
3
4from transformers import CLIPProcessor, CLIPModel
5from dmx.compressor.modeling import DmxModel
6
7model = CLIPModel.from_pretrained("d-matrix/clip-vit-base-patch32")
8processor = CLIPProcessor.from_pretrained("d-matrix/clip-vit-base-patch32")
9
10url = "http://images.cocodataset.org/val2017/000000039769.jpg"
11image = Image.open(requests.get(url, stream=True).raw)
12
13inputs = processor(
14 text=["a photo of a cat", "a photo of a dog"],
15 images=image,
16 return_tensors="pt",
17 padding=True,
18)
19
20model = DmxModel.from_torch(model)
21outputs = model(**inputs)