Image-Text-to-Text
Transformers
Safetensors
qwen3_vl
unsloth
conversational
4-bit precision
bitsandbytes
Instructions to use KalvinPhan/MathCoder-VL-34bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KalvinPhan/MathCoder-VL-34bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="KalvinPhan/MathCoder-VL-34bit") 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("KalvinPhan/MathCoder-VL-34bit") model = AutoModelForImageTextToText.from_pretrained("KalvinPhan/MathCoder-VL-34bit") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KalvinPhan/MathCoder-VL-34bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KalvinPhan/MathCoder-VL-34bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KalvinPhan/MathCoder-VL-34bit", "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/KalvinPhan/MathCoder-VL-34bit
- SGLang
How to use KalvinPhan/MathCoder-VL-34bit 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 "KalvinPhan/MathCoder-VL-34bit" \ --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": "KalvinPhan/MathCoder-VL-34bit", "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 "KalvinPhan/MathCoder-VL-34bit" \ --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": "KalvinPhan/MathCoder-VL-34bit", "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" } } ] } ] }' - Unsloth Studio
How to use KalvinPhan/MathCoder-VL-34bit with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KalvinPhan/MathCoder-VL-34bit to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for KalvinPhan/MathCoder-VL-34bit to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for KalvinPhan/MathCoder-VL-34bit to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="KalvinPhan/MathCoder-VL-34bit", max_seq_length=2048, ) - Docker Model Runner
How to use KalvinPhan/MathCoder-VL-34bit with Docker Model Runner:
docker model run hf.co/KalvinPhan/MathCoder-VL-34bit
| { | |
| "architectures": [ | |
| "Qwen3VLForConditionalGeneration" | |
| ], | |
| "torch_dtype": "bfloat16", | |
| "eos_token_id": 151645, | |
| "image_token_id": 151655, | |
| "model_type": "qwen3_vl", | |
| "pad_token_id": 151654, | |
| "quantization_config": { | |
| "_load_in_4bit": true, | |
| "_load_in_8bit": false, | |
| "bnb_4bit_compute_dtype": "bfloat16", | |
| "bnb_4bit_quant_storage": "uint8", | |
| "bnb_4bit_quant_type": "nf4", | |
| "bnb_4bit_use_double_quant": true, | |
| "llm_int8_enable_fp32_cpu_offload": false, | |
| "llm_int8_has_fp16_weight": false, | |
| "llm_int8_skip_modules": [ | |
| "embed_tokens", | |
| "embedding", | |
| "lm_head", | |
| "multi_modal_projector", | |
| "merger", | |
| "modality_projection", | |
| "router", | |
| "visual", | |
| "vision_tower", | |
| "model.language_model.layers.3.mlp", | |
| "model.visual.blocks.23.attn", | |
| "model.language_model.layers.0.self_attn", | |
| "model.visual.blocks.22.mlp", | |
| "model.visual.blocks.19.attn", | |
| "model.language_model.layers.0.mlp", | |
| "model.visual.blocks.20.attn", | |
| "model.visual.merger", | |
| "model.visual.blocks.15.attn", | |
| "model.visual.blocks.22.attn", | |
| "model.language_model.layers.27.mlp", | |
| "model.visual.blocks.21.attn", | |
| "model.visual.blocks.18.attn", | |
| "model.visual.blocks.17.mlp", | |
| "model.visual.blocks.17.attn", | |
| "model.visual.blocks.19.mlp", | |
| "model.visual.blocks.14.mlp", | |
| "model.visual.blocks.16.attn", | |
| "model.visual.blocks.16.mlp", | |
| "model.visual.blocks.21.mlp", | |
| "model.visual.blocks.15.mlp", | |
| "model.visual.blocks.14.attn", | |
| "model.visual.blocks.18.mlp", | |
| "model.visual.blocks.20.mlp", | |
| "model.language_model.layers.2.mlp", | |
| "model.visual.blocks.13.mlp", | |
| "model.visual.blocks.23.mlp", | |
| "model.visual.blocks.13.attn", | |
| "model.visual.blocks.11.mlp", | |
| "model.visual.blocks.12.attn", | |
| "model.visual.blocks.12.mlp", | |
| "model.visual.blocks.11.attn", | |
| "model.visual.blocks.10.attn", | |
| "model.visual.blocks.10.mlp", | |
| "model.visual.blocks.0.attn", | |
| "model.visual.blocks.7.mlp", | |
| "model.visual.blocks.9.mlp", | |
| "model.visual.blocks.9.attn", | |
| "model.visual.blocks.6.attn", | |
| "model.visual.blocks.4.mlp", | |
| "model.visual.blocks.3.mlp", | |
| "model.visual.blocks.4.attn", | |
| "model.visual.blocks.2.attn", | |
| "model.visual.blocks.3.attn", | |
| "model.visual.blocks.8.mlp", | |
| "model.visual.blocks.8.attn", | |
| "model.visual.blocks.5.mlp", | |
| "model.visual.blocks.7.attn", | |
| "model.visual.blocks.6.mlp", | |
| "model.visual.blocks.5.attn", | |
| "model.visual.blocks.1.mlp", | |
| "model.visual.blocks.1.attn", | |
| "model.visual.blocks.2.mlp", | |
| "model.visual.blocks.0.mlp" | |
| ], | |
| "llm_int8_threshold": 6.0, | |
| "load_in_4bit": true, | |
| "load_in_8bit": false, | |
| "quant_method": "bitsandbytes" | |
| }, | |
| "text_config": { | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token_id": 151643, | |
| "torch_dtype": "bfloat16", | |
| "eos_token_id": 151645, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 6144, | |
| "max_position_embeddings": 262144, | |
| "model_type": "qwen3_vl_text", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 28, | |
| "num_key_value_heads": 8, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": { | |
| "mrope_interleaved": true, | |
| "mrope_section": [ | |
| 24, | |
| 20, | |
| 20 | |
| ], | |
| "rope_type": "default" | |
| }, | |
| "rope_theta": 5000000, | |
| "tie_word_embeddings": true, | |
| "use_cache": true, | |
| "vocab_size": 151936 | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers_version": "4.57.1", | |
| "unsloth_fixed": true, | |
| "video_token_id": 151656, | |
| "vision_config": { | |
| "deepstack_visual_indexes": [ | |
| 5, | |
| 11, | |
| 17 | |
| ], | |
| "depth": 24, | |
| "torch_dtype": "bfloat16", | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "hidden_size": 1024, | |
| "in_channels": 3, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 4096, | |
| "model_type": "qwen3_vl", | |
| "num_heads": 16, | |
| "num_position_embeddings": 2304, | |
| "out_hidden_size": 2048, | |
| "patch_size": 16, | |
| "spatial_merge_size": 2, | |
| "temporal_patch_size": 2 | |
| }, | |
| "vision_end_token_id": 151653, | |
| "vision_start_token_id": 151652 | |
| } | |