Instructions to use mlx-community/idefics2-8b-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/idefics2-8b-8bit 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/idefics2-8b-8bit") config = load_config("mlx-community/idefics2-8b-8bit") # 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
Upload 12 files
Browse filesFiles changed (12)
- README.mdAdded+41
- added_tokens.jsonAdded+5
- config.jsonAdded+34
- model-00001-of-00002.safetensorsAdded+3
- model-00002-of-00002.safetensorsAdded+3
- model.safetensors.index.jsonAdded
- preprocessor_config.jsonAdded+26
- processor_config.jsonAdded+4
- special_tokens_map.jsonAdded+53
- tokenizer.jsonAdded
- tokenizer.modelAdded+3
- tokenizer_config.jsonAdded+70
1234567891011121314151617181920212223242526272829303132333435363738394041---language:- enlicense: apache-2.0tags:- multimodal- vision- image-text-to-text- mlxdatasets:- HuggingFaceM4/OBELICS- laion/laion-coco- wikipedia- facebook/pmd- pixparse/idl-wds- pixparse/pdfa-eng-wds- wendlerc/RenderedText- HuggingFaceM4/the_cauldron- teknium/OpenHermes-2.5- GAIR/lima- databricks/databricks-dolly-15k- meta-math/MetaMathQA- TIGER-Lab/MathInstruct- microsoft/orca-math-word-problems-200k- camel-ai/math- AtlasUnified/atlas-math-sets- tiedong/goat---
# mlx-community/idefics2-8b-8bitThis model was converted to MLX format from [`HuggingFaceM4/idefics2-8b`]() using mlx-vllm version **0.0.4**.Refer to the [original model card](https://huggingface.co/HuggingFaceM4/idefics2-8b) for more details on the model.## Use with mlx
```bashpip install -U mlx-vlm```
```bashpython -m mlx_vlm.generate --model mlx-community/idefics2-8b-8bit --max-tokens 100 --temp 0.0```12345{ "<end_of_utterance>": 32002, "<fake_token_around_image>": 32000, "<image>": 32001}12345678910111213141516171819202122232425262728293031323334{ "architectures": [ "Idefics2ForConditionalGeneration" ], "image_token_id": 32001, "model_type": "idefics2", "perceiver_config": { "model_type": "idefics2" }, "quantization": { "group_size": 64, "bits": 8 }, "text_config": { "max_position_embeddings": 32768, "model_type": "mistral", "pad_token_id": 0, "rms_norm_eps": 1e-05, "vocab_size": 32003 }, "tie_word_embeddings": false, "torch_dtype": "float32", "transformers_version": "4.39.0.dev0", "use_cache": true, "vision_config": { "hidden_size": 1152, "image_size": 980, "intermediate_size": 4304, "model_type": "idefics2", "num_attention_heads": 16, "num_hidden_layers": 27, "patch_size": 14 }}123version https://git-lfs.github.com/spec/v1oid sha256:7be8c0e81e3a86c808ab25ae143f7d0cb28adfcefe1d3e70ae54dd5aa9ad4f79size 5313954350123version https://git-lfs.github.com/spec/v1oid sha256:4dae6e019c163b348a6839e9167d4b74d6c707f3b9272218839e829ac1782298size 41292486131234567891011121314151617181920212223242526{ "do_convert_rgb": true, "do_image_splitting": true, "do_normalize": true, "do_pad": true, "do_rescale": true, "do_resize": true, "image_mean": [ 0.5, 0.5, 0.5 ], "image_processor_type": "Idefics2ImageProcessor", "image_std": [ 0.5, 0.5, 0.5 ], "processor_class": "Idefics2Processor", "resample": 2, "rescale_factor": 0.00392156862745098, "size": { "longest_edge": 980, "shortest_edge": 378 }}1234{ "image_seq_len": 64, "processor_class": "Idefics2Processor"}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253{ "additional_special_tokens": [ { "content": "<fake_token_around_image>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "<image>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, { "content": "<end_of_utterance>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false } ], "bos_token": { "content": "<s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:dadfd56d766715c61d2ef780a525ab43b8e6da4de6865bda3d95fdef5e134055size 49344312345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970{ "add_bos_token": true, "add_eos_token": false, "added_tokens_decoder": { "0": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "<s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "2": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32000": { "content": "<fake_token_around_image>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32001": { "content": "<image>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32002": { "content": "<end_of_utterance>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "additional_special_tokens": [ "<fake_token_around_image>", "<image>", "<end_of_utterance>" ], "bos_token": "<s>", "clean_up_tokenization_spaces": false, "eos_token": "</s>", "model_max_length": 1000000000000000019884624838656, "pad_token": "<unk>", "processor_class": "Idefics2Processor", "sp_model_kwargs": {}, "spaces_between_special_tokens": false, "tokenizer_class": "LlamaTokenizer", "unk_token": "<unk>", "use_default_system_prompt": true}README.mdAdded+41
added_tokens.jsonAdded+5
config.jsonAdded+34
model-00001-of-00002.safetensorsAdded+3
model-00002-of-00002.safetensorsAdded+3
model.safetensors.index.jsonAdded
preprocessor_config.jsonAdded+26
processor_config.jsonAdded+4
special_tokens_map.jsonAdded+53
tokenizer.jsonAdded
tokenizer.modelAdded+3
tokenizer_config.jsonAdded+70