Instructions to use YuCollection/Lens-Diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use YuCollection/Lens-Diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("YuCollection/Lens-Diffusers", 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 Settings
- Draw Things
- DiffusionBee
Update README.md
Browse files
README.md
CHANGED
|
@@ -101,9 +101,11 @@ Pick a variant by passing its repo id to `--repo_id` (CLI) or `LensPipeline.from
|
|
| 101 |
```python
|
| 102 |
import torch
|
| 103 |
from lens import LensPipeline
|
|
|
|
| 104 |
pipe = LensPipeline.from_pretrained(
|
| 105 |
"microsoft/Lens", torch_dtype=torch.bfloat16
|
| 106 |
).to("cuda")
|
|
|
|
| 107 |
image = pipe(
|
| 108 |
prompt="A cat holding a sign that says \"hello world\"",
|
| 109 |
base_resolution=1440, aspect_ratio="1:1",
|
|
@@ -112,6 +114,7 @@ image = pipe(
|
|
| 112 |
).images[0]
|
| 113 |
image.save("lens.png")
|
| 114 |
```
|
|
|
|
| 115 |
To trade speed for VRAM, replace `.to("cuda")` with `pipe.enable_model_cpu_offload()`.
|
| 116 |
|
| 117 |
**CLI — basic usage:**
|
|
|
|
| 101 |
```python
|
| 102 |
import torch
|
| 103 |
from lens import LensPipeline
|
| 104 |
+
|
| 105 |
pipe = LensPipeline.from_pretrained(
|
| 106 |
"microsoft/Lens", torch_dtype=torch.bfloat16
|
| 107 |
).to("cuda")
|
| 108 |
+
|
| 109 |
image = pipe(
|
| 110 |
prompt="A cat holding a sign that says \"hello world\"",
|
| 111 |
base_resolution=1440, aspect_ratio="1:1",
|
|
|
|
| 114 |
).images[0]
|
| 115 |
image.save("lens.png")
|
| 116 |
```
|
| 117 |
+
|
| 118 |
To trade speed for VRAM, replace `.to("cuda")` with `pipe.enable_model_cpu_offload()`.
|
| 119 |
|
| 120 |
**CLI — basic usage:**
|