Image-Text-to-Text
MLX
Safetensors
Transformers
llava_qwen2
text-generation
conversational
custom_code
8-bit precision
Instructions to use EZCon/FastVLM-1.5B-8bit-mlx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use EZCon/FastVLM-1.5B-8bit-mlx 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("EZCon/FastVLM-1.5B-8bit-mlx") config = load_config("EZCon/FastVLM-1.5B-8bit-mlx") # 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) - Transformers
How to use EZCon/FastVLM-1.5B-8bit-mlx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="EZCon/FastVLM-1.5B-8bit-mlx", 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("EZCon/FastVLM-1.5B-8bit-mlx", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use EZCon/FastVLM-1.5B-8bit-mlx with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EZCon/FastVLM-1.5B-8bit-mlx" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EZCon/FastVLM-1.5B-8bit-mlx", "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/EZCon/FastVLM-1.5B-8bit-mlx
- SGLang
How to use EZCon/FastVLM-1.5B-8bit-mlx 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 "EZCon/FastVLM-1.5B-8bit-mlx" \ --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": "EZCon/FastVLM-1.5B-8bit-mlx", "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 "EZCon/FastVLM-1.5B-8bit-mlx" \ --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": "EZCon/FastVLM-1.5B-8bit-mlx", "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 EZCon/FastVLM-1.5B-8bit-mlx with Docker Model Runner:
docker model run hf.co/EZCon/FastVLM-1.5B-8bit-mlx
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- preprocessor_config.json +1 -2
- processor_config.json +41 -0
- tokenizer.json +2 -2
- tokenizer_config.json +7 -31
- vocab.json +0 -0
README.md
CHANGED
|
@@ -7,7 +7,7 @@ tags:
|
|
| 7 |
---
|
| 8 |
|
| 9 |
# EZCon/FastVLM-1.5B-8bit-mlx
|
| 10 |
-
This model was converted to MLX format from [`apple/FastVLM-1.5B`]() using mlx-vlm version **0.3.
|
| 11 |
Refer to the [original model card](https://huggingface.co/apple/FastVLM-1.5B) for more details on the model.
|
| 12 |
## Use with mlx
|
| 13 |
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
# EZCon/FastVLM-1.5B-8bit-mlx
|
| 10 |
+
This model was converted to MLX format from [`apple/FastVLM-1.5B`]() using mlx-vlm version **0.3.10**.
|
| 11 |
Refer to the [original model card](https://huggingface.co/apple/FastVLM-1.5B) for more details on the model.
|
| 12 |
## Use with mlx
|
| 13 |
|
preprocessor_config.json
CHANGED
|
@@ -14,7 +14,6 @@
|
|
| 14 |
"do_center_crop": true,
|
| 15 |
"do_convert_rgb": true,
|
| 16 |
"do_normalize": true,
|
| 17 |
-
"do_pad": null,
|
| 18 |
"do_rescale": true,
|
| 19 |
"do_resize": true,
|
| 20 |
"image_mean": [
|
|
@@ -29,7 +28,6 @@
|
|
| 29 |
1.0
|
| 30 |
],
|
| 31 |
"input_data_format": null,
|
| 32 |
-
"pad_size": null,
|
| 33 |
"processor_class": "FastVLMProcessor",
|
| 34 |
"resample": 3,
|
| 35 |
"rescale_factor": 0.00392156862745098,
|
|
@@ -38,3 +36,4 @@
|
|
| 38 |
"shortest_edge": 1024
|
| 39 |
}
|
| 40 |
}
|
|
|
|
|
|
| 14 |
"do_center_crop": true,
|
| 15 |
"do_convert_rgb": true,
|
| 16 |
"do_normalize": true,
|
|
|
|
| 17 |
"do_rescale": true,
|
| 18 |
"do_resize": true,
|
| 19 |
"image_mean": [
|
|
|
|
| 28 |
1.0
|
| 29 |
],
|
| 30 |
"input_data_format": null,
|
|
|
|
| 31 |
"processor_class": "FastVLMProcessor",
|
| 32 |
"resample": 3,
|
| 33 |
"rescale_factor": 0.00392156862745098,
|
|
|
|
| 36 |
"shortest_edge": 1024
|
| 37 |
}
|
| 38 |
}
|
| 39 |
+
|
processor_config.json
CHANGED
|
@@ -2,5 +2,46 @@
|
|
| 2 |
"auto_map": {
|
| 3 |
"AutoProcessor": "processing_fastvlm.FastVLMProcessor"
|
| 4 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"processor_class": "FastVLMProcessor"
|
| 6 |
}
|
|
|
|
| 2 |
"auto_map": {
|
| 3 |
"AutoProcessor": "processing_fastvlm.FastVLMProcessor"
|
| 4 |
},
|
| 5 |
+
"image_processor": {
|
| 6 |
+
"auto_map": {
|
| 7 |
+
"AutoImageProcessor": "processing_fastvlm.FastVLMImageProcessor",
|
| 8 |
+
"AutoProcessor": "processing_fastvlm.FastVLMProcessor"
|
| 9 |
+
},
|
| 10 |
+
"crop_size": {
|
| 11 |
+
"height": 1024,
|
| 12 |
+
"width": 1024
|
| 13 |
+
},
|
| 14 |
+
"data_format": "channels_first",
|
| 15 |
+
"default_to_square": false,
|
| 16 |
+
"device": null,
|
| 17 |
+
"disable_grouping": null,
|
| 18 |
+
"do_center_crop": true,
|
| 19 |
+
"do_convert_rgb": true,
|
| 20 |
+
"do_normalize": true,
|
| 21 |
+
"do_pad": null,
|
| 22 |
+
"do_rescale": true,
|
| 23 |
+
"do_resize": true,
|
| 24 |
+
"image_mean": [
|
| 25 |
+
0.0,
|
| 26 |
+
0.0,
|
| 27 |
+
0.0
|
| 28 |
+
],
|
| 29 |
+
"image_processor_type": "FastVLMImageProcessor",
|
| 30 |
+
"image_seq_length": null,
|
| 31 |
+
"image_std": [
|
| 32 |
+
1.0,
|
| 33 |
+
1.0,
|
| 34 |
+
1.0
|
| 35 |
+
],
|
| 36 |
+
"input_data_format": null,
|
| 37 |
+
"pad_size": null,
|
| 38 |
+
"processor_class": "FastVLMProcessor",
|
| 39 |
+
"resample": 3,
|
| 40 |
+
"rescale_factor": 0.00392156862745098,
|
| 41 |
+
"return_tensors": null,
|
| 42 |
+
"size": {
|
| 43 |
+
"shortest_edge": 1024
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
"processor_class": "FastVLMProcessor"
|
| 47 |
}
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ec23d32bfebacd1282375a053db63076675f588b20c7df4b075286851b0675a5
|
| 3 |
+
size 11413376
|
tokenizer_config.json
CHANGED
|
@@ -1,43 +1,19 @@
|
|
| 1 |
{
|
| 2 |
"add_prefix_space": false,
|
| 3 |
-
"
|
| 4 |
-
"151643": {
|
| 5 |
-
"content": "<|endoftext|>",
|
| 6 |
-
"lstrip": false,
|
| 7 |
-
"normalized": false,
|
| 8 |
-
"rstrip": false,
|
| 9 |
-
"single_word": false,
|
| 10 |
-
"special": true
|
| 11 |
-
},
|
| 12 |
-
"151644": {
|
| 13 |
-
"content": "<|im_start|>",
|
| 14 |
-
"lstrip": false,
|
| 15 |
-
"normalized": false,
|
| 16 |
-
"rstrip": false,
|
| 17 |
-
"single_word": false,
|
| 18 |
-
"special": true
|
| 19 |
-
},
|
| 20 |
-
"151645": {
|
| 21 |
-
"content": "<|im_end|>",
|
| 22 |
-
"lstrip": false,
|
| 23 |
-
"normalized": false,
|
| 24 |
-
"rstrip": false,
|
| 25 |
-
"single_word": false,
|
| 26 |
-
"special": true
|
| 27 |
-
}
|
| 28 |
-
},
|
| 29 |
-
"additional_special_tokens": [
|
| 30 |
-
"<|im_start|>",
|
| 31 |
-
"<|im_end|>"
|
| 32 |
-
],
|
| 33 |
"auto_map": {
|
| 34 |
"AutoProcessor": "processing_fastvlm.FastVLMProcessor"
|
| 35 |
},
|
|
|
|
| 36 |
"bos_token": null,
|
| 37 |
"clean_up_tokenization_spaces": false,
|
| 38 |
"eos_token": "<|im_end|>",
|
| 39 |
"errors": "replace",
|
| 40 |
-
"extra_special_tokens":
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
"model_max_length": 8192,
|
| 42 |
"pad_token": "<|endoftext|>",
|
| 43 |
"padding_side": "right",
|
|
|
|
| 1 |
{
|
| 2 |
"add_prefix_space": false,
|
| 3 |
+
"additional_special_tokens": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"auto_map": {
|
| 5 |
"AutoProcessor": "processing_fastvlm.FastVLMProcessor"
|
| 6 |
},
|
| 7 |
+
"backend": "tokenizers",
|
| 8 |
"bos_token": null,
|
| 9 |
"clean_up_tokenization_spaces": false,
|
| 10 |
"eos_token": "<|im_end|>",
|
| 11 |
"errors": "replace",
|
| 12 |
+
"extra_special_tokens": [
|
| 13 |
+
"<|im_start|>",
|
| 14 |
+
"<|im_end|>"
|
| 15 |
+
],
|
| 16 |
+
"is_local": true,
|
| 17 |
"model_max_length": 8192,
|
| 18 |
"pad_token": "<|endoftext|>",
|
| 19 |
"padding_side": "right",
|
vocab.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|