Instructions to use mikefish/viking-klein-4b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mikefish/viking-klein-4b-lora with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.2-klein-base-4B", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("mikefish/viking-klein-4b-lora") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Viking blue-and-gold paired editing LoRA
Current release: batch5, fresh rank/alpha32 adapter trained for2000 optimizer updates on300 manually accepted single-person pairs (240train/30validation/30test), full-frame512 RGB, LR0.0001 and four microbatches per update. Local RTX4090, AI Toolkit revision a8dfcf7d7e2b38ccc7b2fb68ece9c6358e61e7a7. Targets were generated locally with Qwen2.1 and contain helmet, blue-and-gold paint and Viking clothing.
Trained on Klein base4B; evaluated on vendor-distilled Klein4B at2 and4steps. This specializes an existing model; it is not custom student distillation. Pinned revisions are in models.json.
Usage
Download viking-editing-lora.safetensors and the matching updated prompt-embeddings.pt and fixed-prompt.txt. Old prompt embeddings describe the previous dataset. ComfyUI text-encoding workflows can use fixed-prompt.txt with their existing text encoder; no separate embedding file is necessary unless the workflow explicitly loads cached embeddings.
hf download mikefish/viking-klein-4b-lora --local-dir viking-lora
hf download black-forest-labs/FLUX.2-klein-4B --revision e7b7dc27f91deacad38e78976d1f2b499d76a294 --local-dir klein-4b
python viking-lora/inference_server.py --model klein-4b --adapter viking-lora/viking-editing-lora.safetensors --embeddings viking-lora/prompt-embeddings.pt --precision fp16 --steps 4
The complete Diffusers pipeline supplies VAE and scheduler. Cached embeddings avoid loading a text encoder in the service. Strength1 and guidance1 were evaluated. Four steps is the provisional quality default; two steps also works. Existing NF4 support remains available but this release was evaluated only in FP16. Dependency snapshot records the existing Windows environment; adapt local configuration paths.
Limitations
Four fixed validation sources only; test untouched. Detailed gear and paint, but identity/expression drift and occasional paint leakage onto hands remain. No claim of improvement over the previous release on identical inputs. See RESULTS.md. Mean RTX4090 inference0.76s at2steps and1.00s at4steps across four requests, not a network benchmark. FP16 peak8.34GiB; RTX2080 8GB requires further memory optimization and actual speed verification.
No source photographs or optimizer state are uploaded. Base licensing is provided in its official repository. Previous release is recoverable at revision 5b52f3deb0fb3f4110f0ec96f8905191c32a63ef
- Downloads last month
- 4
Model tree for mikefish/viking-klein-4b-lora
Base model
black-forest-labs/FLUX.2-klein-base-4B