Instructions to use mlx-community/Lens-Turbo-3.8B-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Lens-Turbo-3.8B-8bit with MLX:
# Download the model from the Hub pip install huggingface_hub[hf_xet] huggingface-cli download --local-dir Lens-Turbo-3.8B-8bit mlx-community/Lens-Turbo-3.8B-8bit
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Atomic Chat
Add Lens-Turbo-3.8B-8bit DiT weights + model card
Browse files- .gitattributes +1 -0
- README.md +26 -5
- config.json +38 -0
- model.safetensors +3 -0
- sample.png +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
sample.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -6,10 +6,31 @@ tags: [mlx, text-to-image, diffusion, lens, lens-turbo, apple-silicon]
|
|
| 6 |
base_model: microsoft/Lens-Turbo
|
| 7 |
---
|
| 8 |
|
| 9 |
-
# Lens-Turbo-3.8B-8bit (MLX)
|
| 10 |
|
| 11 |
-
MLX conversion of [microsoft/Lens-Turbo](https://huggingface.co/microsoft/Lens-Turbo) —
|
| 12 |
-
distilled 4-step
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
base_model: microsoft/Lens-Turbo
|
| 7 |
---
|
| 8 |
|
| 9 |
+
# Lens-Turbo-3.8B-8bit (MLX)
|
| 10 |
|
| 11 |
+
Apple **MLX** conversion of [microsoft/Lens-Turbo](https://huggingface.co/microsoft/Lens-Turbo) —
|
| 12 |
+
the **distilled 4-step** sibling of Lens (identical 3.8B DiT architecture; sample at **4 steps,
|
| 13 |
+
guidance 1.0**). int8 (group_size 64), ~4.39 GB. DiT-only (MIT); the GPT-OSS-20B encoder (Apache-2.0) and FLUX.2 VAE
|
| 14 |
+
load from source. Architecture is byte-identical to base Lens, which is parity-locked vs the PT
|
| 15 |
+
reference (DiT cosine 0.999999); this variant inherits that port.
|
| 16 |
|
| 17 |
+

|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
from lens_mlx.pipeline_mlx import LensPipeline # github.com/xocialize-code/lens-mlx
|
| 23 |
+
|
| 24 |
+
# `base` = a microsoft/Lens snapshot (tokenizer + GPT-OSS encoder + FLUX.2 VAE).
|
| 25 |
+
pipe = LensPipeline.from_pretrained(base, dit_repo="mlx-community/Lens-Turbo-3.8B-8bit")
|
| 26 |
+
img = pipe("A serene lake below snow-capped mountains, golden hour.",
|
| 27 |
+
height=1024, width=1024, num_inference_steps=4, guidance_scale=1.0, seed=42)
|
| 28 |
+
img.save("out.png")
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
> Tip: page weights into memory before the first forward (`mx.eval` the params) when loading
|
| 32 |
+
> from slow/external storage, to avoid a Metal command-buffer watchdog timeout at large sizes.
|
| 33 |
+
|
| 34 |
+
## License
|
| 35 |
+
DiT weights MIT (from microsoft/Lens-Turbo) · GPT-OSS-20B encoder Apache-2.0 (not re-hosted) ·
|
| 36 |
+
FLUX.2 VAE under its own terms (not re-hosted). Upstream: [microsoft/Lens-Turbo](https://huggingface.co/microsoft/Lens-Turbo).
|
config.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "LensTransformer2DModel",
|
| 3 |
+
"_diffusers_version": "0.37.1",
|
| 4 |
+
"attention_head_dim": 64,
|
| 5 |
+
"axes_dims_rope": [
|
| 6 |
+
8,
|
| 7 |
+
28,
|
| 8 |
+
28
|
| 9 |
+
],
|
| 10 |
+
"enc_hidden_dim": 2880,
|
| 11 |
+
"gate_mlp": true,
|
| 12 |
+
"in_channels": 128,
|
| 13 |
+
"inner_dim": 1536,
|
| 14 |
+
"multi_layer_encoder_feature": true,
|
| 15 |
+
"num_attention_heads": 24,
|
| 16 |
+
"num_layers": 48,
|
| 17 |
+
"out_channels": 32,
|
| 18 |
+
"patch_size": 2,
|
| 19 |
+
"rms_norm": true,
|
| 20 |
+
"selected_layer_index": [
|
| 21 |
+
5,
|
| 22 |
+
11,
|
| 23 |
+
17,
|
| 24 |
+
23
|
| 25 |
+
],
|
| 26 |
+
"mlx_format": true,
|
| 27 |
+
"quantization": {
|
| 28 |
+
"group_size": 64,
|
| 29 |
+
"bits": 8,
|
| 30 |
+
"keep_hi_precision": [
|
| 31 |
+
"img_in",
|
| 32 |
+
"txt_in",
|
| 33 |
+
"proj_out",
|
| 34 |
+
"time_text_embed",
|
| 35 |
+
"norm_out"
|
| 36 |
+
]
|
| 37 |
+
}
|
| 38 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:30e44edf95750cf241b3b47dbd086984d472c7c9900036d4545a1079aadb0ef2
|
| 3 |
+
size 4386667927
|
sample.png
ADDED
|
Git LFS Details
|