$npx skillfedfor your agent

tomesd

Token Merging for Stable Diffusion

With conditionsPyPI Artificial IntelligenceReleased May 2023224.0K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — tomesd-0.1.3-py3-none-any.whl
v0.1.3 · released 2023-05-14 · 1 runtime deps: torch

Yes, if you run Stable Diffusion and want faster inference with controllable quality trade-offs. Installation is trivial, the patch is non-invasive (reversible via `remove_patch`), and it works out-of-the-box on standard Stable Diffusion setups. The main caveat is dormant maintenance—no active development since mid-2023—so compatibility with very recent model releases is unverified. For established workflows, it's a low-risk, high-value optimization.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires pytorch >= 1.12.1 and an existing Stable Diffusion environment (Diffusers, SDv1, SDv2, or Latent Diffusion).
  • Low install friction; pure Python with torch as the only runtime dependency.
  • Dormant maintenance since May 2023 with last commit in November 2023—no active development, but the implementation is stable and self-contained.

License · maintenance · safety

MIT (permissive) — MIT license permits commercial and private use with minimal restrictions, making it safe to integrate into any Stable Diffusion workflow.

last release 2023-05-14 (1188 days) · last repo commit 2023-11-29 · 1,405 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 223,975 downloads/mo, #9,237 on PyPI

Verify before relying

pip install tomesd

import tomesd
import torch

tomesd.apply_patch(model, ratio=0.5)
  • Whether the package works with Stable Diffusion v3 or newer models released after the last update.
  • Compatibility with recent versions of downstream Stable Diffusion implementations and UIs.
  • Performance impact on consumer GPUs with less VRAM than the tested 4090.
Same gist for agents: .md · .json

What it is and what it does

ToMe for SD is a pure-Python patch that accelerates Stable Diffusion by identifying and merging redundant tokens during the diffusion process. It works by reducing the number of tokens the transformer must process, cutting both computation time and memory usage without requiring any model retraining. The patch applies directly to existing Stable Diffusion implementations and downstream UIs that use them.

The trade-off is intentional and controlled: merging tokens is lossy, so generated images will differ slightly from the unpatched baseline. The paper reports that at a 50% merge ratio, generation is 1.35x faster and uses 1.57x less memory with minimal quality loss. More aggressive merging (60%) achieves 2x speedup and 5.7x memory reduction, though quality degradation increases. You control this trade-off via the `ratio` parameter when calling `apply_patch()`.

Use it for

  • Generate images faster on consumer GPUs by trading minor quality loss for 1.5–2x speedup and reduced VRAM pressure.
  • Reduce memory footprint when running Stable Diffusion on hardware with limited VRAM, enabling larger batch sizes or higher resolutions.
  • Combine with other efficiency techniques to stack speedups without reimplementing transformer modules.
  • Patch existing Stable Diffusion workflows with a single function call and no model changes.
  • Experiment with token merging ratios to find the sweet spot between speed and quality for your specific use case.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you run Stable Diffusion and want faster inference with controllable quality trade-offs.

Installation is trivial, the patch is non-invasive (reversible via `remove_patch`), and it works out-of-the-box on standard Stable Diffusion setups. The main caveat is dormant maintenance—no active development since mid-2023—so compatibility with very recent model releases is unverified. For established workflows, it's a low-risk, high-value optimization.

Install

tomesd on PyPI

Before you install

Low install friction; pure Python with torch as the only runtime dependency. Dormant maintenance since May 2023 with last commit in November 2023—no active development, but the implementation is stable and self-contained.

Requires pytorch >= 1.12.1 and an existing Stable Diffusion environment (Diffusers, SDv1, SDv2, or Latent Diffusion).

License in practice

MIT license permits commercial and private use with minimal restrictions, making it safe to integrate into any Stable Diffusion workflow.

Quickstart

pip install tomesd

import tomesd
import torch

tomesd.apply_patch(model, ratio=0.5)

Verify before relying

  • Whether the package works with Stable Diffusion v3 or newer models released after the last update.
  • Compatibility with recent versions of downstream Stable Diffusion implementations and UIs.
  • Performance impact on consumer GPUs with less VRAM than the tested 4090.

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
torch
MaintenanceDormant 1,188 days since the last release
Last repo commit
First released
Downloads223,975 / month, #9,237 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14

Evidence: tomesd-0.1.3-py3-none-any.whl

Tags

Capabilities
stable diffusion optimizationtoken merging pytorchdiffusion model speeduptransformer token reductionstable diffusion memory efficientfast image generationdiffusion inference acceleration
Topics
diffusion-modelsinference-optimizationtransformer-acceleration

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “stable diffusion optimization”

  • tomesdSpeeds up Stable Diffusion image generation by merging redundant…
  • lycoris-loraImplements parameter-efficient fine-tuning algorithms (LoRA, LoHa,…
  • onnx-toolParse, analyze, optimize, and profile ONNX neural network models with…

Give your agent the search over MCP, or paste the wish link into any chat.

More Artificial Intelligence packages

litellm With conditions
PyPI · Artificial Intelligence · released Aug 2026

LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.

Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.

MITcompiled wheel
682.8Mdownloads / mo
huggingface-hub Worth it
PyPI · Artificial Intelligence · released Aug 2026

Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.

Install it if you work with Hugging Face Hub models or datasets.

Apache-2.0pure Python · 3.10.0+
442.4Mdownloads / mo
langchain Worth it
PyPI · Python Modules · released Aug 2026

LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.

MITpure Python
315.4Mdownloads / mo
hf-xet With conditions
PyPI · Artificial Intelligence · released Aug 2026

hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.

Apache-2.0compiled wheel · 3.8+
258.4Mdownloads / mo
tokenizers Worth it
PyPI · Artificial Intelligence · released Apr 2026

Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.

Apache-2.0compiled wheel · 3.10+
222.9Mdownloads / mo
transformers Worth it
PyPI · Artificial Intelligence · released Aug 2026

Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.

Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.

permissive licensepure Python · 3.10.0+
186.6Mdownloads / mo

See also cache-dit · diffusers · compel · k-diffusion · pytorch-fid · f5-tts · adam-atan2-pytorch · CoLT5-attention · lycoris-lora

Further reading