Instructions to use Kry4ta1/Effecteraser-VOR-Inference with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Kry4ta1/Effecteraser-VOR-Inference with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Kry4ta1/Effecteraser-VOR-Inference", 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 src/videox_fun/dist/__init__.py from Kry4ta1/Effecteraser-VOR-Inference: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/Kry4ta1/Effecteraser-VOR-Inference/resolve/main/src/videox_fun/dist/__init__.py
- Command line
-
hf download hf://Kry4ta1/Effecteraser-VOR-Inference/src/videox_fun/dist/__init__.py
-
curl -L -o __init__.py https://huggingface.co/Kry4ta1/Effecteraser-VOR-Inference/resolve/main/src/videox_fun/dist/__init__.py
1.91 kB
| import torch | |
| import torch.distributed as dist | |
| try: | |
| import xfuser | |
| from xfuser.core.distributed import (get_sequence_parallel_rank, | |
| get_sequence_parallel_world_size, | |
| get_sp_group, get_world_group, | |
| init_distributed_environment, | |
| initialize_model_parallel) | |
| from xfuser.core.long_ctx_attention import xFuserLongContextAttention | |
| except Exception as ex: | |
| get_sequence_parallel_world_size = None | |
| get_sequence_parallel_rank = None | |
| xFuserLongContextAttention = None | |
| get_sp_group = None | |
| get_world_group = None | |
| init_distributed_environment = None | |
| initialize_model_parallel = None | |
| def set_multi_gpus_devices(ulysses_degree, ring_degree): | |
| if ulysses_degree > 1 or ring_degree > 1: | |
| if get_sp_group is None: | |
| raise RuntimeError("xfuser is not installed.") | |
| dist.init_process_group("nccl") | |
| print('parallel inference enabled: ulysses_degree=%d ring_degree=%d rank=%d world_size=%d' % ( | |
| ulysses_degree, ring_degree, dist.get_rank(), | |
| dist.get_world_size())) | |
| assert dist.get_world_size() == ring_degree * ulysses_degree, \ | |
| "number of GPUs(%d) should be equal to ring_degree * ulysses_degree." % dist.get_world_size() | |
| init_distributed_environment(rank=dist.get_rank(), world_size=dist.get_world_size()) | |
| initialize_model_parallel(sequence_parallel_degree=dist.get_world_size(), | |
| ring_degree=ring_degree, | |
| ulysses_degree=ulysses_degree) | |
| # device = torch.device("cuda:%d" % dist.get_rank()) | |
| device = torch.device(f"cuda:{get_world_group().local_rank}") | |
| print('rank=%d device=%s' % (get_world_group().rank, str(device))) | |
| else: | |
| device = "cuda" | |
| return device |