Instructions to use microsoft/Lens-Turbo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use microsoft/Lens-Turbo 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-Turbo", 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
|
@@ -332,7 +332,7 @@ pipe = LensPipeline.from_pretrained(
|
|
| 332 |
image = pipe(
|
| 333 |
prompt="A cat holding a sign that says hello world",
|
| 334 |
base_resolution=1440, aspect_ratio="1:1",
|
| 335 |
-
num_inference_steps=
|
| 336 |
generator=torch.Generator("cuda").manual_seed(0),
|
| 337 |
).images[0]
|
| 338 |
image.save("lens.png")
|
|
@@ -347,7 +347,7 @@ python inference.py \
|
|
| 347 |
--repo_id "microsoft/Lens-Turbo" \
|
| 348 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 349 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 350 |
-
--steps
|
| 351 |
--out ./outputs
|
| 352 |
```
|
| 353 |
|
|
@@ -356,13 +356,18 @@ python inference.py \
|
|
| 356 |
```bash
|
| 357 |
python inference.py \
|
| 358 |
--repo_id "microsoft/Lens-Turbo" \
|
|
|
|
| 359 |
--prompt "a red fox in snow|a glass greenhouse at night"
|
| 360 |
```
|
| 361 |
|
| 362 |
**A100 / V100 (no MXFP4 kernels)** — dequantize the GPT-OSS encoder to bf16:
|
| 363 |
|
| 364 |
```bash
|
| 365 |
-
python inference.py
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
```
|
| 367 |
|
| 368 |
### Options
|
|
|
|
| 332 |
image = pipe(
|
| 333 |
prompt="A cat holding a sign that says hello world",
|
| 334 |
base_resolution=1440, aspect_ratio="1:1",
|
| 335 |
+
num_inference_steps=4, guidance_scale=1.0,
|
| 336 |
generator=torch.Generator("cuda").manual_seed(0),
|
| 337 |
).images[0]
|
| 338 |
image.save("lens.png")
|
|
|
|
| 347 |
--repo_id "microsoft/Lens-Turbo" \
|
| 348 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 349 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 350 |
+
--steps 4 --cfg 1.0 --n 1 --seed 42 \
|
| 351 |
--out ./outputs
|
| 352 |
```
|
| 353 |
|
|
|
|
| 356 |
```bash
|
| 357 |
python inference.py \
|
| 358 |
--repo_id "microsoft/Lens-Turbo" \
|
| 359 |
+
--steps 4 --cfg 1.0 \
|
| 360 |
--prompt "a red fox in snow|a glass greenhouse at night"
|
| 361 |
```
|
| 362 |
|
| 363 |
**A100 / V100 (no MXFP4 kernels)** — dequantize the GPT-OSS encoder to bf16:
|
| 364 |
|
| 365 |
```bash
|
| 366 |
+
python inference.py \
|
| 367 |
+
--repo_id "microsoft/Lens-Turbo" \
|
| 368 |
+
--steps 4 --cfg 1.0 \
|
| 369 |
+
--prompt "a cat" \
|
| 370 |
+
--disable_mxfp4 --offload
|
| 371 |
```
|
| 372 |
|
| 373 |
### Options
|