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 Settings
- Draw Things
- DiffusionBee
LoboForge Lens LoRA Trainer — open-source LoRA training for Lens-Base (16GB+, ComfyUI export)
#2
by LoboForge - opened
LoboForge LensTrainer
We built an open-source LoRA trainer for microsoft/Lens-Base and wanted to share it with the Lens community.
GitHub: https://github.com/LoboForge/LoboForge-LensTrainer
Docs Space: https://huggingface.co/spaces/LoboForge/LoboForge-LensTrainer
Example LoRA: https://huggingface.co/LoboForge/lens-lora-sebastian-jessica-v2
What it does
- Config-driven training —
python train.py <preset.yaml>with explicit CLI flags (--dataset-path,--steps,--resolution 0for native aspect,--resume latest, etc.) - Aligned with Lens — flow-match training, GPT-OSS multi-layer text features, Flux2 VAE latents; uses the official
microsoft/Lenspackage fromvendor/Lens - 16GB-friendly — CPU offload + disk caching for text embeddings and latents (training loop keeps mostly DiT + LoRA on GPU)
- ComfyUI-ready export — LoRA keys remapped to
diffusion_model.* - One-command setup —
bash scripts/quickstart.shinstallsvendor/Lens, venv deps, HF auth, and downloadsmodels/Lens-Basevia the Hub (avoids broken git-lfs pointer downloads)
Quick start
git clone https://github.com/LoboForge/LoboForge-LensTrainer.git
cd LoboForge-LensTrainer
# Accept Lens-Base license + authenticate
export HF_TOKEN=hf_...
bash scripts/quickstart.sh
python train.py configs/train_lora_lens_base_24gb.yaml \
--dataset-path /path/to/images_and_captions \
--output-dir ./output/my-lora \
--job-name my-lora \
--model-repo ./models/Lens-Base \
--steps 2000 \
--resolution 0 \
--disable-mxfp4

LoboForge changed discussion title from LoboForge LensTrainer — open-source LoRA training for Lens-Base (16GB+, ComfyUI export) to LoboForge Lens LoRA Trainer — open-source LoRA training for Lens-Base (16GB+, ComfyUI export)