Skip to content

⚡️Hybird Context Parallelism

Choose a tag to compare

@DefTruth DefTruth released this 20 Oct 10:44
· 638 commits to main since this release
fa3a6e8

cache-dit is compatible with context parallelism. Currently, we support the use of Hybrid Cache + Context Parallelism scheme (via NATIVE_DIFFUSER parallelism backend) in cache-dit. Users can use Context Parallelism to further accelerate the speed of inference! For more details, please refer to 📚examples/parallelism.

from cache_dit import ParallelismConfig

cache_dit.enable_cache(
    pipe_or_adapter, 
    cache_config=DBCacheConfig(...),
    # Set ulysses_size > 1 to enable ulysses style context parallelism.
    parallelism_config=ParallelismConfig(ulysses_size=2),
)
# Then, run with torchrun cmd:
# torchrun --nproc_per_node=2 parallel_cache.py