Instructions to use diffusion-gif/any2ego with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use diffusion-gif/any2ego with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("fill-in-base-model", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("diffusion-gif/any2ego") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
Download code_support/project_paths.py from diffusion-gif/any2ego: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/diffusion-gif/any2ego/resolve/main/code_support/project_paths.py
- Command line
-
hf download hf://diffusion-gif/any2ego/code_support/project_paths.py
-
curl -L -o project_paths.py https://huggingface.co/diffusion-gif/any2ego/resolve/main/code_support/project_paths.py
1.03 kB
| """Resolve package-relative resources without machine-specific locations.""" | |
| import os | |
| import sys | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parent | |
| def env(name, default=""): | |
| return os.environ.get(name, default) | |
| def project_path(relative): | |
| path = Path(relative) | |
| return str(path if path.is_absolute() else ROOT / path) | |
| def initialize(entrypoint=False): | |
| for relative in ("eval", "diffusion", "data"): | |
| location = project_path(relative) | |
| if location not in sys.path: | |
| sys.path.insert(0, location) | |
| if entrypoint: | |
| os.chdir(ROOT) | |
| os.environ.setdefault("TORCH_HOME", project_path(".cache/torch")) | |
| def seg_mask_root(root=None): | |
| """External PhiSeg output root; no masks are distributed with the code.""" | |
| return project_path(root or os.environ.get("SEG_MASK_ROOT", "data/seg_masks")) | |
| def seg_mask_dir(clip_id, root=None): | |
| """Same layout as infer_phiseg: <root>/<clip_id>/ego/*.png.""" | |
| return str(Path(seg_mask_root(root)) / clip_id / "ego") | |