Views
No views yet
mlx-community/SmolVLM-256M-Instruct-bf16pip install mlx-vlm1from mlx_vlm import load, generate
2from mlx_vlm.prompt_utils import apply_chat_template
3from mlx_vlm.utils import load_config
4from PIL import Image
5import json
6
7# Load the FINE-TUNED MLX model (not base model!)
8model_path = "truworthai/Combined-mlx" # This repo contains the fine-tuned weights
9
10try:
11 # Load the fine-tuned model with adapters
12 model, processor = load(model_path)
13 print("✅ Loaded FINE-TUNED MLX model with learned weights!")
14
15 # Load training configuration
16 config = load_config(model_path)
17
18except Exception as e:
19 print(f"⚠️ Loading fine-tuned model failed, falling back to base: {e}")
20 # Fallback to base model
21 model, processor = load("mlx-community/SmolVLM-256M-Instruct-bf16")
22 config = load_config("mlx-community/SmolVLM-256M-Instruct-bf16")1# Load your brake component image
2image = Image.open("brake_component.jpg")
3
4# Ask brake-specific questions
5question = "What is the OEM part number of this brake component?"
6
7# Format the prompt
8formatted_prompt = apply_chat_template(processor, config, question, num_images=1)
9
10# Generate response using fine-tuned weights
11response = generate(
12 model,
13 processor,
14 formatted_prompt,
15 [image],
16 verbose=False,
17 max_tokens=100,
18 temp=0.3
19)
20print(f"Fine-tuned model response: {response}")config.json: Model configurationmodel.safetensors or model.npz: Base model weights (if included)adapters.safetensors or adapters.npz: FINE-TUNED LoRA ADAPTER WEIGHTS ⚡️adapter_config.json: Adapter configurationtokenizer.json: Tokenizer configurationpreprocessor_config.json: Image preprocessing configtraining_args.json: Training hyperparameters usedtrainer_state.json: Training state and metricsmlx_model_info.json: Training metadata and learned mappingstraining_images/: Reference images from training data (if included)README.md: This documentationmlx-vlm library for loading and inference| Feature | This Model | Base Model |
|---|---|---|
| Fine-tuned Weights | ✅ YES | ❌ No |
| Brake Component Knowledge | ✅ Specialized | ❌ General |
| Domain-Specific Responses | ✅ Trained | ❌ Generic |
| Visual Pattern Learning | ✅ 2 patterns | ❌ Base only |