Views
No views yet
| Metric | Value |
|---|---|
| Original (FP16) | ~14.0 GB |
| Quantized (W4A16) | ~6.12 GB |
| Reduction | ~56.3% |
| Memory Saved | ~7.9 GB |
1from transformers import AutoModelForImageTextToText, AutoProcessor, GenerationConfig
2from PIL import Image
3import requests
4
5# Load model and processor
6processor = AutoProcessor.from_pretrained(
7 "ronantakizawa/molmoact-7b-d-awq-w4a16",
8 trust_remote_code=True,
9 torch_dtype='auto',
10 device_map='auto'
11)
12
13model = AutoModelForCausalLM.from_pretrained(
14 "ronantakizawa/molmoact-7b-d-awq-w4a16",
15 trust_remote_code=True,
16 torch_dtype='auto',
17 device_map='auto'
18)
19
20# Process the image and text
21inputs = processor.process(
22 images=[Image.open(requests.get("https://picsum.photos/id/237/536/354", stream=True).raw)],
23 text="What actions can be performed with the objects in this image?"
24)
25
26# Move inputs to the correct device and make a batch of size 1
27inputs = {k: v.to(model.device).unsqueeze(0) for k, v in inputs.items()}
28
29# Generate output
30output = model.generate_from_batch(
31 inputs,
32 GenerationConfig(max_new_tokens=200, stop_strings="<|endoftext|>"),
33 tokenizer=processor.tokenizer
34)
35
36# Decode the generated tokens
37generated_tokens = output[0, inputs['input_ids'].size(1):]
38generated_text = processor.tokenizer.decode(generated_tokens, skip_special_tokens=True)
39print(generated_text)1from PIL import Image
2image = Image.open(...)
3if image.mode != "RGB":
4 image = image.convert("RGB")1@misc{molmoact-7b-d-awq,
2 title={MolmoAct-7B-D AWQ 4-bit},
3 author={Quantized by ronantakizawa},
4 year={2025},
5 url={https://huggingface.co/ronantakizawa/molmoact-7b-d-awq-w4a16}
6}