---
title: Lens-3.8B-4bit
canonical_url: "https://www.modelscope.cn/models/mlx-community/Lens-3.8B-4bit"
md_url: "https://www.modelscope.cn/models/mlx-community/Lens-3.8B-4bit.md"
repository: mlx-community/Lens-3.8B-4bit
last_updated: 2026-06-21
license: mit
pipeline_tag: text-to-image-synthesis
tasks:
  - text-to-image-synthesis
base_model:
  - microsoft/Lens
base_model_relation: finetune
parameters: 664.4M
tensor_type:
  - BF16
  - U32
library_name:
  - mlx
  - lora
  - safetensors
  - pytorch
frameworks:
  - pytorch
downloads: 18
stars: 0
tags:
  - mlx
  - text-to-image
  - diffusion
  - lens
  - apple-silicon
  - quantized
---

# Lens-3.8B-4bit

> Lens-3.8B-4bit - mlx-community 在 ModelScope 开源的模型。Lens-3.8B-4bit (MLX)

mlx-community/Lens-3.8B-4bit 是 ModelScope 魔搭社区上的 664.4M 参数text-to-image-synthesis模型，采用 mit 许可，基于 microsoft/Lens 构建。

- **Repository**: mlx-community/Lens-3.8B-4bit
- **License**: mit
- **Tasks**: text-to-image-synthesis
- **Parameters**: 664.4M
- **Base model**: microsoft/Lens
- **Tags**: mlx, text-to-image, diffusion, lens, apple-silicon, quantized
- **Downloads**: 18
- **Stars**: 0
- **Last updated**: 2026-06-21

Source: https://www.modelscope.cn/models/mlx-community/Lens-3.8B-4bit

---

# Lens-3.8B-4bit (MLX)

Apple **MLX** conversion of the [`microsoft/Lens`](https://huggingface.co/microsoft/Lens)
3.8B text-to-image DiT — **int4 (group_size 64), keeping the small in/out/time projections at bf16 for fidelity. ~3.5x smaller than bf16.** ~2.35 GB.

This repo contains the **DiT only** (MIT). The full pipeline also uses the GPT-OSS-20B text
encoder (Apache-2.0) and the FLUX.2 semantic VAE, pulled from source by the loader (see
**License**). Full-precision: [Lens-3.8B-bf16](https://huggingface.co/mlx-community/Lens-3.8B-bf16).

Fidelity: single-pass DiT cosine **0.9976** vs the PyTorch reference. Quantization changes the
denoise trajectory, so quantized samples differ in composition from bf16 but are equally sharp.

![sample](sample.png)

## Usage

```python
from lens_mlx.pipeline_mlx import LensPipeline   # github.com/xocialize/lens-mlx

# `base` = a microsoft/Lens snapshot providing the tokenizer, GPT-OSS encoder, and FLUX.2 VAE.
pipe = LensPipeline.from_pretrained(base, dit_repo="mlx-community/Lens-3.8B-4bit")
img = pipe("A serene lake below snow-capped mountains, golden hour.",
           height=1024, width=1024, num_inference_steps=20, seed=42)
img.save("out.png")
```

## License
- **DiT weights (this repo):** MIT, from `microsoft/Lens`.
- **GPT-OSS-20B encoder:** Apache-2.0 (reuse `mlx-community/gpt-oss-20b-MXFP4-*`).
- **FLUX.2 VAE:** its own (FLUX.2-dev) terms — **not re-hosted**; fetched from source.

Upstream: [microsoft/Lens](https://huggingface.co/microsoft/Lens) ·
MLX port: [xocialize/lens-mlx](https://github.com/xocialize/lens-mlx)
