Article
Introducing Trackio: A Lightweight Experiment Tracking Library from Hugging Face
By
and 4 others
•
•
122import torch
from diffusers import CogView4Pipeline
from diffusers.hooks import apply_first_block_cache, FirstBlockCacheConfig
pipe = CogView4Pipeline.from_pretrained("THUDM/CogView4-6B", torch_dtype=torch.bfloat16)
pipe.to("cuda")
apply_first_block_cache(pipe.transformer, FirstBlockCacheConfig(threshold=0.2))
prompt = "A photo of an astronaut riding a horse on mars"
image = pipe(prompt, generator=torch.Generator().manual_seed(42)).images[0]
image.save("output.png")
The script was already available since October 2024, just made a more detailed version :P
It's not merged yet ! https://github.com/huggingface/diffusers/pull/11743
We will merge it soon ;)