Instructions to use microsoft/Lens with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use microsoft/Lens with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("microsoft/Lens", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps
- Draw Things
- DiffusionBee
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
| 33 |
<p>
|
| 34 |
<a href="https://arxiv.org/abs/PLACEHOLDER"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-Paper-b31b1b?logo=arxiv&logoColor=white" height="22" /></a>
|
| 35 |
|
| 36 |
-
<a href="https://huggingface.co/
|
| 37 |
|
| 38 |
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-green.svg" height="22" /></a>
|
| 39 |
</p>
|
|
@@ -307,9 +307,9 @@ The default GPT-OSS encoder and FLUX.2 VAE are loaded from Hugging Face. Make su
|
|
| 307 |
|
| 308 |
| Repo | Description | Recommended Steps | CFG |
|
| 309 |
| :--- | :--- | :---: | :---: |
|
| 310 |
-
| [`
|
| 311 |
-
| [`
|
| 312 |
-
| [`
|
| 313 |
|
| 314 |
Pick a variant by passing its repo id to `--repo_id` (CLI) or `LensPipeline.from_pretrained(...)` (Python).
|
| 315 |
|
|
@@ -324,7 +324,7 @@ import torch
|
|
| 324 |
from lens import LensPipeline
|
| 325 |
|
| 326 |
pipe = LensPipeline.from_pretrained(
|
| 327 |
-
"
|
| 328 |
).to("cuda")
|
| 329 |
|
| 330 |
image = pipe(
|
|
@@ -366,7 +366,7 @@ python inference.py --prompt "a cat" --disable_mxfp4 --offload
|
|
| 366 |
|
| 367 |
| Flag | Description | Default |
|
| 368 |
| :--- | :--- | :--- |
|
| 369 |
-
| `--repo_id` | HF repo id (or local path) of the assembled Lens pipeline | `
|
| 370 |
| `--base_resolution` | `1024` or `1440` | `1440` |
|
| 371 |
| `--aspect_ratio` | `1:2`, `9:16`, `2:3`, `3:4`, `1:1`, `4:3`, `3:2`, `16:9`, `2:1` | `1:1` |
|
| 372 |
| `--steps` | Number of denoising steps | `20` |
|
|
|
|
| 33 |
<p>
|
| 34 |
<a href="https://arxiv.org/abs/PLACEHOLDER"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-Paper-b31b1b?logo=arxiv&logoColor=white" height="22" /></a>
|
| 35 |
|
| 36 |
+
<a href="https://huggingface.co/microsoft/Lens"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97-Models-yellow" height="22" /></a>
|
| 37 |
|
| 38 |
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-green.svg" height="22" /></a>
|
| 39 |
</p>
|
|
|
|
| 307 |
|
| 308 |
| Repo | Description | Recommended Steps | CFG |
|
| 309 |
| :--- | :--- | :---: | :---: |
|
| 310 |
+
| [`microsoft/Lens`](https://huggingface.co/microsoft/Lens) | **Default.** RL-tuned for visual quality | 20 | 5.0 |
|
| 311 |
+
| [`microsoft/Lens-Turbo`](https://huggingface.co/microsoft/Lens-Turbo) | Distilled from the RL model for fast 4-step sampling | 4 | 1.0 |
|
| 312 |
+
| [`microsoft/Lens-Base`](https://huggingface.co/microsoft/Lens-Base) | Supervised base model (no RL, no distillation) | 50 | 5.0 |
|
| 313 |
|
| 314 |
Pick a variant by passing its repo id to `--repo_id` (CLI) or `LensPipeline.from_pretrained(...)` (Python).
|
| 315 |
|
|
|
|
| 324 |
from lens import LensPipeline
|
| 325 |
|
| 326 |
pipe = LensPipeline.from_pretrained(
|
| 327 |
+
"microsoft/Lens", torch_dtype=torch.bfloat16
|
| 328 |
).to("cuda")
|
| 329 |
|
| 330 |
image = pipe(
|
|
|
|
| 366 |
|
| 367 |
| Flag | Description | Default |
|
| 368 |
| :--- | :--- | :--- |
|
| 369 |
+
| `--repo_id` | HF repo id (or local path) of the assembled Lens pipeline | `microsoft/Lens` |
|
| 370 |
| `--base_resolution` | `1024` or `1440` | `1440` |
|
| 371 |
| `--aspect_ratio` | `1:2`, `9:16`, `2:3`, `3:4`, `1:1`, `4:3`, `3:2`, `16:9`, `2:1` | `1:1` |
|
| 372 |
| `--steps` | Number of denoising steps | `20` |
|