Image-Text-to-Text
MLX
Safetensors
multilingual
GOT
ocr
ocr2.0
vision-language
got
custom_code
4-bit precision
Instructions to use mlx-community/GOT-OCR2_0-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/GOT-OCR2_0-4bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("mlx-community/GOT-OCR2_0-4bit") config = load_config("mlx-community/GOT-OCR2_0-4bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
| { | |
| "architectures": [ | |
| "GOTQwenForCausalLM" | |
| ], | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "modeling_GOT.GOTConfig", | |
| "AutoModel": "modeling_GOT.GOTQwenForCausalLM" | |
| }, | |
| "bos_token_id": 151643, | |
| "eos_token_id": 151643, | |
| "freeze_vision_tower": false, | |
| "generation_config": { | |
| "bos_token_id": 151643, | |
| "eos_token_id": 151643, | |
| "max_new_tokens": 2048, | |
| "transformers_version": "4.37.2" | |
| }, | |
| "hidden_act": "silu", | |
| "hidden_size": 1024, | |
| "im_end_token": 151858, | |
| "im_patch_token": 151859, | |
| "im_start_token": 151857, | |
| "image_token_len": 256, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 2816, | |
| "max_position_embeddings": 32768, | |
| "max_window_layers": 21, | |
| "model_type": "GOT", | |
| "num_attention_heads": 16, | |
| "num_hidden_layers": 24, | |
| "num_key_value_heads": 16, | |
| "quantization": { | |
| "group_size": 64, | |
| "bits": 4, | |
| "mode": "affine" | |
| }, | |
| "quantization_config": { | |
| "group_size": 64, | |
| "bits": 4, | |
| "mode": "affine" | |
| }, | |
| "rms_norm_eps": 1e-06, | |
| "rope_theta": 1000000.0, | |
| "sliding_window": 32768, | |
| "tie_word_embeddings": true, | |
| "transformers_version": "4.37.2", | |
| "use_cache": true, | |
| "use_im_start_end": true, | |
| "use_sliding_window": false, | |
| "vision_config": {}, | |
| "vocab_size": 151860 | |
| } |