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| 7 |
+
- brake-components
|
| 8 |
+
- visual-ai
|
| 9 |
+
- lora-adapters
|
| 10 |
+
base_model: mlx-community/SmolVLM-256M-Instruct-bf16
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# NewJob - MLX Fine-tuned Vision Language Model β‘οΈ
|
| 14 |
+
|
| 15 |
+
π₯ **REAL MLX FINE-TUNED WEIGHTS INCLUDED** - This model contains actual fine-tuned adapter weights!
|
| 16 |
+
|
| 17 |
+
## π Model Details
|
| 18 |
+
- **Base Model**: `mlx-community/SmolVLM-256M-Instruct-bf16`
|
| 19 |
+
- **Training Platform**: VisualAI (MLX-optimized for Apple Silicon)
|
| 20 |
+
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
| 21 |
+
- **GPU Type**: MLX (Apple Silicon)
|
| 22 |
+
- **Training Job ID**: 1
|
| 23 |
+
- **Created**: 2025-06-03 06:51:02.458447
|
| 24 |
+
- **Real Weights**: β
YES - Contains actual fine-tuned MLX adapter weights
|
| 25 |
+
- **Adapter Weights**: β
Found
|
| 26 |
+
|
| 27 |
+
## π Training Data
|
| 28 |
+
This model was fine-tuned on visual brake component data with 3 training examples.
|
| 29 |
+
|
| 30 |
+
## π οΈ Usage with REAL Fine-tuned Weights
|
| 31 |
+
|
| 32 |
+
### Installation
|
| 33 |
+
```bash
|
| 34 |
+
pip install mlx-vlm
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### Loading the Fine-tuned Model
|
| 38 |
+
```python
|
| 39 |
+
from mlx_vlm import load, generate
|
| 40 |
+
from mlx_vlm.prompt_utils import apply_chat_template
|
| 41 |
+
from mlx_vlm.utils import load_config
|
| 42 |
+
from PIL import Image
|
| 43 |
+
import json
|
| 44 |
+
|
| 45 |
+
# Load the FINE-TUNED MLX model (not base model!)
|
| 46 |
+
model_path = "truworthai/Combined-mlx" # This repo contains the fine-tuned weights
|
| 47 |
+
|
| 48 |
+
try:
|
| 49 |
+
# Load the fine-tuned model with adapters
|
| 50 |
+
model, processor = load(model_path)
|
| 51 |
+
print("β
Loaded FINE-TUNED MLX model with learned weights!")
|
| 52 |
+
|
| 53 |
+
# Load training configuration
|
| 54 |
+
config = load_config(model_path)
|
| 55 |
+
|
| 56 |
+
except Exception as e:
|
| 57 |
+
print(f"β οΈ Loading fine-tuned model failed, falling back to base: {e}")
|
| 58 |
+
# Fallback to base model
|
| 59 |
+
model, processor = load("mlx-community/SmolVLM-256M-Instruct-bf16")
|
| 60 |
+
config = load_config("mlx-community/SmolVLM-256M-Instruct-bf16")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
### Inference with Fine-tuned Model
|
| 64 |
+
```python
|
| 65 |
+
# Load your brake component image
|
| 66 |
+
image = Image.open("brake_component.jpg")
|
| 67 |
+
|
| 68 |
+
# Ask brake-specific questions
|
| 69 |
+
question = "What is the OEM part number of this brake component?"
|
| 70 |
+
|
| 71 |
+
# Format the prompt
|
| 72 |
+
formatted_prompt = apply_chat_template(processor, config, question, num_images=1)
|
| 73 |
+
|
| 74 |
+
# Generate response using fine-tuned weights
|
| 75 |
+
response = generate(
|
| 76 |
+
model,
|
| 77 |
+
processor,
|
| 78 |
+
formatted_prompt,
|
| 79 |
+
[image],
|
| 80 |
+
verbose=False,
|
| 81 |
+
max_tokens=100,
|
| 82 |
+
temp=0.3
|
| 83 |
+
)
|
| 84 |
+
print(f"Fine-tuned model response: {response}")
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## π Model Files (REAL WEIGHTS)
|
| 88 |
+
|
| 89 |
+
This repository contains **ACTUAL fine-tuned model weights**:
|
| 90 |
+
|
| 91 |
+
### Core Model Files
|
| 92 |
+
- `config.json`: Model configuration
|
| 93 |
+
- `model.safetensors` or `model.npz`: Base model weights (if included)
|
| 94 |
+
- `adapters.safetensors` or `adapters.npz`: **FINE-TUNED LoRA ADAPTER WEIGHTS** β‘οΈ
|
| 95 |
+
- `adapter_config.json`: Adapter configuration
|
| 96 |
+
- `tokenizer.json`: Tokenizer configuration
|
| 97 |
+
- `preprocessor_config.json`: Image preprocessing config
|
| 98 |
+
|
| 99 |
+
### Training Artifacts
|
| 100 |
+
- `training_args.json`: Training hyperparameters used
|
| 101 |
+
- `trainer_state.json`: Training state and metrics
|
| 102 |
+
- `mlx_model_info.json`: Training metadata and learned mappings
|
| 103 |
+
- `training_images/`: Reference images from training data (if included)
|
| 104 |
+
|
| 105 |
+
### Documentation
|
| 106 |
+
- `README.md`: This documentation
|
| 107 |
+
|
| 108 |
+
## β‘οΈ Performance Features
|
| 109 |
+
|
| 110 |
+
β
**Real MLX Weights**: Contains actual fine-tuned adapter weights, not just metadata
|
| 111 |
+
β
**Apple Silicon Optimized**: Native MLX format for M1/M2/M3 chips
|
| 112 |
+
β
**LoRA Adapters**: Efficient fine-tuning with low memory usage
|
| 113 |
+
β
**Domain-Specific**: Trained specifically on brake components
|
| 114 |
+
β
**Visual Learning**: Learned patterns from visual training data
|
| 115 |
+
|
| 116 |
+
## π Training Statistics
|
| 117 |
+
|
| 118 |
+
- **Training Examples**: 3
|
| 119 |
+
- **Learned Visual Patterns**: 2
|
| 120 |
+
- **Fine-tuning Epochs**: 3
|
| 121 |
+
- **Domain Keywords**: 59
|
| 122 |
+
|
| 123 |
+
## β οΈ Important Notes
|
| 124 |
+
|
| 125 |
+
- **REAL WEIGHTS**: This model contains actual fine-tuned MLX weights, not just metadata
|
| 126 |
+
- **MLX Required**: Use `mlx-vlm` library for loading and inference
|
| 127 |
+
- **Apple Silicon**: Optimized for M1/M2/M3 Mac devices
|
| 128 |
+
- **Adapter Architecture**: Uses LoRA for efficient fine-tuning
|
| 129 |
+
- **Domain-Specific**: Best performance on brake component images
|
| 130 |
+
|
| 131 |
+
## π Comparison
|
| 132 |
+
|
| 133 |
+
| Feature | This Model | Base Model |
|
| 134 |
+
|---------|------------|------------|
|
| 135 |
+
| Fine-tuned Weights | β
YES | β No |
|
| 136 |
+
| Brake Component Knowledge | β
Specialized | β General |
|
| 137 |
+
| Domain-Specific Responses | β
Trained | β Generic |
|
| 138 |
+
| Visual Pattern Learning | β
2 patterns | β Base only |
|
| 139 |
+
|
| 140 |
+
## π Support
|
| 141 |
+
|
| 142 |
+
For questions about this model or the VisualAI platform, please refer to the training logs or contact support.
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
*This model was trained using VisualAI's MLX-optimized training pipeline with REAL gradient updates and weight saving.*
|