Views
No views yet
mlx-community/SmolVLM-256M-Instruct-bf16pip install mlx-vlm1from mlx_vlm import load
2import json
3import os
4
5# Load the base MLX model
6model, processor = load("mlx-community/SmolVLM-256M-Instruct-bf16")
7
8# Load the fine-tuned artifacts
9model_info_path = "mlx_model_info.json"
10if os.path.exists(model_info_path):
11 with open(model_info_path, 'r') as f:
12 model_info = json.load(f)
13 print(f"✅ Loaded fine-tuned model with {model_info.get('training_examples_count', 0)} training examples")
14
15# Check for adapter weights
16adapters_path = "adapters/adapter_config.json"
17if os.path.exists(adapters_path):
18 with open(adapters_path, 'r') as f:
19 adapter_config = json.load(f)
20 print(f"🎯 Found MLX adapters with {adapter_config.get('training_examples', 0)} training examples")1from mlx_vlm import generate
2from mlx_vlm.prompt_utils import apply_chat_template
3from mlx_vlm.utils import load_config
4from PIL import Image
5
6# Load your image
7image = Image.open("your_image.jpg")
8
9# Ask a question
10question = "What type of brake component is this?"
11
12# Format the prompt
13config = load_config("mlx-community/SmolVLM-256M-Instruct-bf16")
14formatted_prompt = apply_chat_template(processor, config, question, num_images=1)
15
16# Generate response
17response = generate(model, processor, formatted_prompt, [image], verbose=False, max_tokens=100)
18print(f"Model response: {response}")mlx_model_info.json: Training metadata and learned mappingstraining_images/: Reference images from training dataadapters/: MLX LoRA adapter weights and configuration (if available)README.md: This documentationmlx-community/SmolVLM-256M-Instruct-bf16)adapters/ folder for MLX-specific fine-tuned weights