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
|
@@ -342,6 +342,7 @@ To trade speed for VRAM, replace `.to("cuda")` with `pipe.enable_model_cpu_offlo
|
|
| 342 |
|
| 343 |
```bash
|
| 344 |
python inference.py \
|
|
|
|
| 345 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 346 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 347 |
--steps 20 --cfg 5.0 --n 1 --seed 42 \
|
|
@@ -352,14 +353,14 @@ python inference.py \
|
|
| 352 |
|
| 353 |
```bash
|
| 354 |
python inference.py \
|
| 355 |
-
--
|
| 356 |
-
--
|
| 357 |
```
|
| 358 |
|
| 359 |
**A100 / V100 (no MXFP4 kernels)** — dequantize the GPT-OSS encoder to bf16:
|
| 360 |
|
| 361 |
```bash
|
| 362 |
-
python inference.py --prompt "a cat" --disable_mxfp4 --offload
|
| 363 |
```
|
| 364 |
|
| 365 |
### Options
|
|
|
|
| 342 |
|
| 343 |
```bash
|
| 344 |
python inference.py \
|
| 345 |
+
--repo_id "microsoft/Lens" \
|
| 346 |
--prompt "A cinematic mountain lake at sunrise, soft mist, detailed reflections" \
|
| 347 |
--base_resolution 1440 --aspect_ratio 1:1 \
|
| 348 |
--steps 20 --cfg 5.0 --n 1 --seed 42 \
|
|
|
|
| 353 |
|
| 354 |
```bash
|
| 355 |
python inference.py \
|
| 356 |
+
--repo_id "microsoft/Lens" \
|
| 357 |
+
--prompt "a red fox in snow|a glass greenhouse at night"
|
| 358 |
```
|
| 359 |
|
| 360 |
**A100 / V100 (no MXFP4 kernels)** — dequantize the GPT-OSS encoder to bf16:
|
| 361 |
|
| 362 |
```bash
|
| 363 |
+
python inference.py --repo_id "microsoft/Lens" --prompt "a cat" --disable_mxfp4 --offload
|
| 364 |
```
|
| 365 |
|
| 366 |
### Options
|