Image-Text-to-Text
Transformers
Safetensors
multilingual
minicpmv
feature-extraction
minicpm-v
vision
ocr
multi-image
video
custom_code
conversational
4-bit precision
gptq
Instructions to use openbmb/MiniCPM-V-4-GPTQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-V-4-GPTQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="openbmb/MiniCPM-V-4-GPTQ", 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 AutoModel model = AutoModel.from_pretrained("openbmb/MiniCPM-V-4-GPTQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openbmb/MiniCPM-V-4-GPTQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openbmb/MiniCPM-V-4-GPTQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openbmb/MiniCPM-V-4-GPTQ", "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/openbmb/MiniCPM-V-4-GPTQ
- SGLang
How to use openbmb/MiniCPM-V-4-GPTQ 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 "openbmb/MiniCPM-V-4-GPTQ" \ --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": "openbmb/MiniCPM-V-4-GPTQ", "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 "openbmb/MiniCPM-V-4-GPTQ" \ --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": "openbmb/MiniCPM-V-4-GPTQ", "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 openbmb/MiniCPM-V-4-GPTQ with Docker Model Runner:
docker model run hf.co/openbmb/MiniCPM-V-4-GPTQ
| { | |
| "use_cache": true, | |
| "query_num": 64, | |
| "image_size": 448, | |
| "drop_vision_last_layer": false, | |
| "batch_vision_input": true, | |
| "use_image_id": true, | |
| "vision_batch_size": 16, | |
| "slice_config": { | |
| "return_dict": true, | |
| "output_hidden_states": false, | |
| "torchscript": false, | |
| "dtype": null, | |
| "pruned_heads": {}, | |
| "tie_word_embeddings": true, | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "is_decoder": false, | |
| "cross_attention_hidden_size": null, | |
| "add_cross_attention": false, | |
| "tie_encoder_decoder": false, | |
| "architectures": null, | |
| "finetuning_task": null, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "task_specific_params": null, | |
| "problem_type": null, | |
| "tokenizer_class": null, | |
| "prefix": null, | |
| "bos_token_id": null, | |
| "pad_token_id": null, | |
| "eos_token_id": null, | |
| "sep_token_id": null, | |
| "decoder_start_token_id": null, | |
| "max_length": 20, | |
| "min_length": 0, | |
| "do_sample": false, | |
| "early_stopping": false, | |
| "num_beams": 1, | |
| "temperature": 1.0, | |
| "top_k": 50, | |
| "top_p": 1.0, | |
| "typical_p": 1.0, | |
| "repetition_penalty": 1.0, | |
| "length_penalty": 1.0, | |
| "no_repeat_ngram_size": 0, | |
| "encoder_no_repeat_ngram_size": 0, | |
| "bad_words_ids": null, | |
| "num_return_sequences": 1, | |
| "output_scores": false, | |
| "return_dict_in_generate": false, | |
| "forced_bos_token_id": null, | |
| "forced_eos_token_id": null, | |
| "remove_invalid_values": false, | |
| "exponential_decay_length_penalty": null, | |
| "suppress_tokens": null, | |
| "begin_suppress_tokens": null, | |
| "num_beam_groups": 1, | |
| "diversity_penalty": 0.0, | |
| "_name_or_path": "", | |
| "model_type": "minicpmv", | |
| "tf_legacy_loss": false, | |
| "use_bfloat16": false, | |
| "patch_size": 14, | |
| "max_slice_nums": 9, | |
| "scale_resolution": 448, | |
| "output_attentions": false | |
| }, | |
| "slice_mode": true, | |
| "vision_config": { | |
| "return_dict": true, | |
| "output_hidden_states": false, | |
| "torchscript": false, | |
| "dtype": null, | |
| "pruned_heads": {}, | |
| "tie_word_embeddings": true, | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "is_decoder": false, | |
| "cross_attention_hidden_size": null, | |
| "add_cross_attention": false, | |
| "tie_encoder_decoder": false, | |
| "architectures": null, | |
| "finetuning_task": null, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "task_specific_params": null, | |
| "problem_type": null, | |
| "tokenizer_class": null, | |
| "prefix": null, | |
| "bos_token_id": null, | |
| "pad_token_id": null, | |
| "eos_token_id": null, | |
| "sep_token_id": null, | |
| "decoder_start_token_id": null, | |
| "max_length": 20, | |
| "min_length": 0, | |
| "do_sample": false, | |
| "early_stopping": false, | |
| "num_beams": 1, | |
| "temperature": 1.0, | |
| "top_k": 50, | |
| "top_p": 1.0, | |
| "typical_p": 1.0, | |
| "repetition_penalty": 1.0, | |
| "length_penalty": 1.0, | |
| "no_repeat_ngram_size": 0, | |
| "encoder_no_repeat_ngram_size": 0, | |
| "bad_words_ids": null, | |
| "num_return_sequences": 1, | |
| "output_scores": false, | |
| "return_dict_in_generate": false, | |
| "forced_bos_token_id": null, | |
| "forced_eos_token_id": null, | |
| "remove_invalid_values": false, | |
| "exponential_decay_length_penalty": null, | |
| "suppress_tokens": null, | |
| "begin_suppress_tokens": null, | |
| "num_beam_groups": 1, | |
| "diversity_penalty": 0.0, | |
| "_name_or_path": "", | |
| "_attn_implementation_autoset": true, | |
| "model_type": "siglip_vision_model", | |
| "tf_legacy_loss": false, | |
| "use_bfloat16": false, | |
| "hidden_size": 1152, | |
| "intermediate_size": 4304, | |
| "num_hidden_layers": 27, | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "patch_size": 14, | |
| "image_size": 980, | |
| "attention_dropout": 0.0, | |
| "layer_norm_eps": 1e-06, | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "output_attentions": false | |
| }, | |
| "patch_size": 14, | |
| "vocab_size": 73448, | |
| "max_position_embeddings": 32768, | |
| "hidden_size": 2560, | |
| "intermediate_size": 10240, | |
| "num_hidden_layers": 32, | |
| "num_attention_heads": 32, | |
| "num_key_value_heads": 2, | |
| "hidden_act": "silu", | |
| "initializer_range": 0.1, | |
| "rms_norm_eps": 1e-06, | |
| "pretraining_tp": 1, | |
| "rope_theta": 10000.0, | |
| "rope_scaling": { | |
| "factor": 1.0, | |
| "long_factor": [ | |
| 0.9977997200264581, | |
| 1.014658295992452, | |
| 1.0349680404997148, | |
| 1.059429246056193, | |
| 1.0888815016813513, | |
| 1.1243301355211495, | |
| 1.166977103606075, | |
| 1.2182568066927284, | |
| 1.2798772354275727, | |
| 1.3538666751582975, | |
| 1.4426259039919596, | |
| 1.5489853358570191, | |
| 1.6762658237220625, | |
| 1.8283407612492941, | |
| 2.0096956085876183, | |
| 2.225478927469756, | |
| 2.481536379650452, | |
| 2.784415934557119, | |
| 3.1413289096347365, | |
| 3.560047844772632, | |
| 4.048719380066383, | |
| 4.615569542115128, | |
| 5.2684819496549835, | |
| 6.014438591970396, | |
| 6.858830049237097, | |
| 7.804668263503327, | |
| 8.851768731513417, | |
| 9.99600492938444, | |
| 11.228766118181639, | |
| 12.536757560834843, | |
| 13.902257701387796, | |
| 15.303885189125953, | |
| 16.717837610115794, | |
| 18.119465097853947, | |
| 19.484965238406907, | |
| 20.792956681060105, | |
| 22.02571786985731, | |
| 23.16995406772833, | |
| 24.217054535738416, | |
| 25.16289275000465, | |
| 26.007284207271347, | |
| 26.753240849586767, | |
| 27.40615325712662, | |
| 27.973003419175363, | |
| 28.461674954469114, | |
| 28.880393889607006, | |
| 29.237306864684626, | |
| 29.540186419591297, | |
| 29.79624387177199, | |
| 30.01202719065413, | |
| 30.193382037992453, | |
| 30.34545697551969, | |
| 30.47273746338473, | |
| 30.579096895249787, | |
| 30.66785612408345, | |
| 30.741845563814174, | |
| 30.80346599254902, | |
| 30.85474569563567, | |
| 30.897392663720595, | |
| 30.932841297560394, | |
| 30.962293553185553, | |
| 30.986754758742034, | |
| 31.007064503249293, | |
| 31.02392307921529 | |
| ], | |
| "original_max_position_embeddings": 32786, | |
| "rope_type": "longrope", | |
| "short_factor": [ | |
| 0.9977997200264581, | |
| 1.014658295992452, | |
| 1.0349680404997148, | |
| 1.059429246056193, | |
| 1.0888815016813513, | |
| 1.1243301355211495, | |
| 1.166977103606075, | |
| 1.2182568066927284, | |
| 1.2798772354275727, | |
| 1.3538666751582975, | |
| 1.4426259039919596, | |
| 1.5489853358570191, | |
| 1.6762658237220625, | |
| 1.8283407612492941, | |
| 2.0096956085876183, | |
| 2.225478927469756, | |
| 2.481536379650452, | |
| 2.784415934557119, | |
| 3.1413289096347365, | |
| 3.560047844772632, | |
| 4.048719380066383, | |
| 4.615569542115128, | |
| 5.2684819496549835, | |
| 6.014438591970396, | |
| 6.858830049237097, | |
| 7.804668263503327, | |
| 8.851768731513417, | |
| 9.99600492938444, | |
| 11.228766118181639, | |
| 12.536757560834843, | |
| 13.902257701387796, | |
| 15.303885189125953, | |
| 16.717837610115794, | |
| 18.119465097853947, | |
| 19.484965238406907, | |
| 20.792956681060105, | |
| 22.02571786985731, | |
| 23.16995406772833, | |
| 24.217054535738416, | |
| 25.16289275000465, | |
| 26.007284207271347, | |
| 26.753240849586767, | |
| 27.40615325712662, | |
| 27.973003419175363, | |
| 28.461674954469114, | |
| 28.880393889607006, | |
| 29.237306864684626, | |
| 29.540186419591297, | |
| 29.79624387177199, | |
| 30.01202719065413, | |
| 30.193382037992453, | |
| 30.34545697551969, | |
| 30.47273746338473, | |
| 30.579096895249787, | |
| 30.66785612408345, | |
| 30.741845563814174, | |
| 30.80346599254902, | |
| 30.85474569563567, | |
| 30.897392663720595, | |
| 30.932841297560394, | |
| 30.962293553185553, | |
| 30.986754758742034, | |
| 31.007064503249293, | |
| 31.02392307921529 | |
| ] | |
| }, | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "mlp_bias": false, | |
| "head_dim": 128, | |
| "return_dict": true, | |
| "output_hidden_states": false, | |
| "torchscript": false, | |
| "dtype": "bfloat16", | |
| "pruned_heads": {}, | |
| "tie_word_embeddings": false, | |
| "chunk_size_feed_forward": 0, | |
| "is_encoder_decoder": false, | |
| "is_decoder": false, | |
| "cross_attention_hidden_size": null, | |
| "add_cross_attention": false, | |
| "tie_encoder_decoder": false, | |
| "architectures": [ | |
| "MiniCPMV" | |
| ], | |
| "finetuning_task": null, | |
| "id2label": { | |
| "0": "LABEL_0", | |
| "1": "LABEL_1" | |
| }, | |
| "label2id": { | |
| "LABEL_0": 0, | |
| "LABEL_1": 1 | |
| }, | |
| "task_specific_params": null, | |
| "problem_type": null, | |
| "tokenizer_class": null, | |
| "prefix": null, | |
| "bos_token_id": 1, | |
| "pad_token_id": 2, | |
| "eos_token_id": [ | |
| 2, | |
| 73440 | |
| ], | |
| "sep_token_id": null, | |
| "decoder_start_token_id": null, | |
| "max_length": 20, | |
| "min_length": 0, | |
| "do_sample": false, | |
| "early_stopping": false, | |
| "num_beams": 1, | |
| "temperature": 1.0, | |
| "top_k": 50, | |
| "top_p": 1.0, | |
| "typical_p": 1.0, | |
| "repetition_penalty": 1.0, | |
| "length_penalty": 1.0, | |
| "no_repeat_ngram_size": 0, | |
| "encoder_no_repeat_ngram_size": 0, | |
| "bad_words_ids": null, | |
| "num_return_sequences": 1, | |
| "output_scores": false, | |
| "return_dict_in_generate": false, | |
| "forced_bos_token_id": null, | |
| "forced_eos_token_id": null, | |
| "remove_invalid_values": false, | |
| "exponential_decay_length_penalty": null, | |
| "suppress_tokens": null, | |
| "begin_suppress_tokens": null, | |
| "num_beam_groups": 1, | |
| "diversity_penalty": 0.0, | |
| "_name_or_path": "/cache/shitong/autoGPTQ/models/MiniCPM-V-4", | |
| "transformers_version": "4.57.6", | |
| "auto_map": { | |
| "AutoConfig": "configuration_minicpm.MiniCPMVConfig", | |
| "AutoModel": "modeling_minicpmv.MiniCPMV", | |
| "AutoModelForCausalLM": "modeling_minicpmv.MiniCPMV" | |
| }, | |
| "model_type": "minicpmv", | |
| "version": 4.0, | |
| "tf_legacy_loss": false, | |
| "use_bfloat16": false, | |
| "output_attentions": false, | |
| "quantization_config": { | |
| "bits": 4, | |
| "group_size": 128, | |
| "damp_percent": 0.01, | |
| "desc_act": false, | |
| "static_groups": false, | |
| "sym": true, | |
| "true_sequential": true, | |
| "quant_method": "gptq", | |
| "checkpoint_format": "gptq", | |
| "model_name_or_path": null, | |
| "model_file_base_name": null | |
| } | |
| } |