Instructions to use SeanScripts/Molmo-72B-0924-nf4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SeanScripts/Molmo-72B-0924-nf4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="SeanScripts/Molmo-72B-0924-nf4", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("SeanScripts/Molmo-72B-0924-nf4", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SeanScripts/Molmo-72B-0924-nf4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SeanScripts/Molmo-72B-0924-nf4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SeanScripts/Molmo-72B-0924-nf4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/SeanScripts/Molmo-72B-0924-nf4
- SGLang
How to use SeanScripts/Molmo-72B-0924-nf4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SeanScripts/Molmo-72B-0924-nf4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SeanScripts/Molmo-72B-0924-nf4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SeanScripts/Molmo-72B-0924-nf4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SeanScripts/Molmo-72B-0924-nf4", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use SeanScripts/Molmo-72B-0924-nf4 with Docker Model Runner:
docker model run hf.co/SeanScripts/Molmo-72B-0924-nf4
float16 or bfloat16?
Currently this model quantization is using float16. I ran a quick check on the error introduced by quantization of each tensor, and found that the average error per parameter is an order of magnitude higher with bfloat16 compared to float16. I also checked the error of the log base 2 of the parameters, since bfloat16 should be able to cover a wider range of magnitudes. However, the average error in the log of the parameters was also about an order of magnitude higher for bfloat16 compared to float16.
Calculated over all but the embedding and final out tensors, which I couldn't fit on my total available memory for this computation (probably could have with more efficiency but this should be a good start):
Average fp16 error: 3.756e-05
Average fp16 error in the log2 of the params: 0.000934
Average bf16 error: 0.000268
Average bf16 error in the log2 of the params: 0.00720
I don't have the resources to try to measure the perplexity or benchmarks, which would probably be preferable. Benchmarks would be especially useful for seeing how much performance has been lost compared to the non-quantized model, if anyone has the resources to run them. I might be able to run a few slowly with a small sample size.
Let me know your thoughts on whether you prefer float16 vs bfloat16 for this. I've mostly heard that bfloat16 is just better overall, but seeing an order of magnitude higher average error makes me question that. If you think the bfloat16 version would be better, I can upload it.