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/distributed/communications.py from kylinfires/Joy-face_change_optimized: direct link, hf CLI and curl.
- Browser
- Download file 789 Bytes
-
https://huggingface.co/kylinfires/Joy-face_change_optimized/resolve/main/training/src/distributed/communications.py
- Command line
-
hf download hf://kylinfires/Joy-face_change_optimized/training/src/distributed/communications.py
-
curl -L -o communications.py https://huggingface.co/kylinfires/Joy-face_change_optimized/resolve/main/training/src/distributed/communications.py
789 Bytes
| # Adapted from https://github.com/hao-ai-lab/FastVideo/blob/main/fastvideo/distributed/communication_op.py | |
| import torch | |
| import torch.distributed as dist | |
| def broadcast_item(item, src: int = 0): | |
| if not dist.is_initialized(): | |
| return item | |
| item_list = [item] | |
| dist.broadcast_object_list(item_list, src=src) | |
| return item_list[0] | |
| def all_ranks_finite(value: torch.Tensor) -> bool: | |
| """Make the same finite-value decision on every rank before backward/step.""" | |
| from torch.distributed.tensor import DTensor | |
| if isinstance(value, DTensor): | |
| value = value.to_local() | |
| finite = torch.isfinite(value.detach()).all().to(dtype=torch.int32) | |
| if dist.is_initialized(): | |
| dist.all_reduce(finite, op=dist.ReduceOp.MIN) | |
| return bool(finite.item()) | |