DEV Community

Zhongkai Fu
Zhongkai Fu

Posted on

Virtual Clothes Try-On by TensorSharp

The video shows virtual cloth try on demo by TensorSharp using Unsloth Qwen Image Edit 2511 models.

Here are models using in this demo:

Qwen-Image-Edit MMDiT DiT (the --model GGUF) unsloth/Qwen-Image-Edit-2511-GGUF e.g. qwen-image-edit-2511-Q4_K_M.gguf
Qwen-Image-Edit Qwen-Image VAE (required) QuantStack/Qwen-Image-Edit-GGUF VAE/Qwen_Image-VAE.safetensors — place next to the DiT or pass --qwen-image-vae
Qwen-Image-Edit Qwen2.5-VL-7B text encoder (required) unsloth/Qwen2.5-VL-7B-Instruct-GGUF Optional vision mmproj: mmproj-BF16.gguf (same repo) for image-grounded edits
Qwen-Image-Edit Lightning LoRA (optional, 4/8-step) lightx2v/Qwen-Image-Edit-2511-Lightning Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors via --qwen-image-lora

For TensorSharp.Server (OpenAI/Ollama comptiable API endpoint and WebUX chat), it can be launched by this command line:

TensorSharp.Server.exe --model c:\Works\models\qwen-image-edit-2511-Q4_K_M.gguf --qwen-image-vae c:\Works\models\Qwen_Image-VAE.safetensors --qwen-image-vl c:\Works\models\qwen-image-te-Qwen2.5-VL-7B-Q4_K_M.gguf --qwen-image-mmproj c:\works\models\Qwen2.5-VL-7B-mmproj-BF16.gguf --backend ggml_cuda --qwen-image-lora c:\Works\models\Qwen-Image-Edit-2511-Lightning-8steps-V1.0-bf16.safetensors

Here is an benchmarks results comparing to stable-diffusion.cpp:

Image editing (stable-diffusion)

Same input image, prompt, resolution, step count, cfg and seed for every engine. Timings are each engine's own pipeline timers (TensorSharp's [pipe-timing] phases + server elapsedSeconds; sd.cpp's phase logs + generate_image total), so weight-file loading and HTTP/process overhead are excluded on both sides. total (warm) is the steady-state request on an already-running server; first request (cold) additionally pays TensorSharp's per-request DiT rebuild + graph capture on a fresh server (a CLI engine has no such distinction). Lower is better.

Qwen-Image-Edit 2511 (Q2_K DiT + Lightning 4-step LoRA) — image_edit on CUDA, 544x1184, 4 steps

Engine total (warm) per step sampling text encode VAE encode VAE decode first request (cold)
TensorSharp 40.44 s 7.57 s 30.27 s 7.45 s 0.54 s 1.51 s 54.11 s
stable-diffusion.cpp 48.16 s 9.43 s 37.73 s 4.47 s 1.92 s 2.57 s

TensorSharp vs stable-diffusion.cpp (ratio = stable-diffusion.cpp time / TensorSharp time; > 1.0× = TensorSharp faster): total (warm) 1.19×, per step 1.25×, sampling 1.25×, text encode 0.60×, VAE encode 3.56×, VAE decode 1.70×

It also has on par performance on auto regression LLM models comparing to llama.cpp. Here is details: https://github.com/zhongkaifu/TensorSharp/blob/main/docs/engine_comparison_report.md

TensorSharp is an open source local Unsloth (GGUF) LLM inference engine and applications. It supports many models from Unsloth, like Gemma4, DiffusionGemma, Qwen3.6 with multi-modal (image, vision, audio), Qwen Image Edit, reasoning and function tool. It can run on Windows/MacOS/Linux and fully leverage GPU's capability using Cuda, Metal and Vulkan. The API is completely compatible with OpenAI and Ollama interface. It has on par performance than llama.cpp

This project is not just a C# wrapper of llama.cpp. It implemented the entire LLM inference engine from bottom to top. If you use CPU backend, it's 100% pure C# code execution. Besides CPU backend, I also implmented CUDA, MLX and GGML backend including ggml_cuda, ggml_vulkan, ggml_metal and ggml_cpu. The GGML backend refer GGML project as external project, and I build a few fusion operation at higher level.

I learned a lot from other projects and apply them for TensorSharp, such as paged KV cache and continuous batching from vLLM, SSD based cache for MoE model from oMLX, GGUF quanztized from llama.cpp and other optimizations for prefill and decode.

Any feedback and comments are welcome. If you like it, it would be really appreciated if you can get this project a star in GitHub: https://github.com/zhongkaifu/TensorSharp . Thanks in advance.

Top comments (0)