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
File size: 1,030 Bytes
c28ffff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | """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")
|