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
|
@@ -326,7 +326,7 @@ import torch
|
|
| 326 |
from lens import LensPipeline
|
| 327 |
|
| 328 |
pipe = LensPipeline.from_pretrained(
|
| 329 |
-
"microsoft/Lens
|
| 330 |
).to("cuda")
|
| 331 |
|
| 332 |
image = pipe(
|
|
@@ -344,7 +344,7 @@ To trade speed for VRAM, replace `.to("cuda")` with `pipe.enable_model_cpu_offlo
|
|
| 344 |
|
| 345 |
```bash
|
| 346 |
python inference.py \
|
| 347 |
-
--repo_id "microsoft/Lens
|
| 348 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 349 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 350 |
--steps 20 --cfg 5.0 --n 1 --seed 42 \
|
|
@@ -355,14 +355,14 @@ python inference.py \
|
|
| 355 |
|
| 356 |
```bash
|
| 357 |
python inference.py \
|
| 358 |
-
--repo_id "microsoft/Lens
|
| 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 --repo_id "microsoft/Lens
|
| 366 |
```
|
| 367 |
|
| 368 |
### Options
|
|
|
|
| 326 |
from lens import LensPipeline
|
| 327 |
|
| 328 |
pipe = LensPipeline.from_pretrained(
|
| 329 |
+
"microsoft/Lens", torch_dtype=torch.bfloat16
|
| 330 |
).to("cuda")
|
| 331 |
|
| 332 |
image = pipe(
|
|
|
|
| 344 |
|
| 345 |
```bash
|
| 346 |
python inference.py \
|
| 347 |
+
--repo_id "microsoft/Lens" \
|
| 348 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 349 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 350 |
--steps 20 --cfg 5.0 --n 1 --seed 42 \
|
|
|
|
| 355 |
|
| 356 |
```bash
|
| 357 |
python inference.py \
|
| 358 |
+
--repo_id "microsoft/Lens" \
|
| 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 --repo_id "microsoft/Lens" --prompt "a cat" --disable_mxfp4 --offload
|
| 366 |
```
|
| 367 |
|
| 368 |
### Options
|