Video-to-Video
Diffusers
English
Chinese
video-editing
streaming
quantization
int8
text-stream-stripping
Instructions to use kylinfires/Joy-face_change_optimized with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use kylinfires/Joy-face_change_optimized with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("kylinfires/Joy-face_change_optimized", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download training/src/utils/activation_checkpointing.py from kylinfires/Joy-face_change_optimized: direct link, hf CLI and curl.
- Browser
- Download file 902 Bytes
-
https://huggingface.co/kylinfires/Joy-face_change_optimized/resolve/main/training/src/utils/activation_checkpointing.py
- Command line
-
hf download hf://kylinfires/Joy-face_change_optimized/training/src/utils/activation_checkpointing.py
-
curl -L -o activation_checkpointing.py https://huggingface.co/kylinfires/Joy-face_change_optimized/resolve/main/training/src/utils/activation_checkpointing.py
902 Bytes
| import torch | |
| from torch.distributed.algorithms._checkpoint.checkpoint_wrapper import checkpoint_wrapper | |
| TRANSFORMER_BLOCK_NAMES = ["double_blocks", "single_blocks"] | |
| def apply_activation_checkpointing( | |
| module: torch.nn.Module, | |
| skip_interval: int = 1 | |
| ) -> torch.nn.Module: | |
| """Apply checkpointing to transformer blocks with specified skip interval.""" | |
| if skip_interval < 1: | |
| raise ValueError( | |
| f"skip_interval must be >= 1, but got {skip_interval}") | |
| for block_name in TRANSFORMER_BLOCK_NAMES: | |
| blocks = getattr(module, block_name, None) | |
| if blocks is None: | |
| continue | |
| for index, (layer_id, block) in enumerate(blocks.named_children()): | |
| if index % skip_interval == 0: | |
| checkpointed_block = checkpoint_wrapper(block) | |
| blocks.register_module(layer_id, checkpointed_block) | |
| return module | |