Instructions to use yqi19/genie_envisioner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use yqi19/genie_envisioner with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("yqi19/genie_envisioner", 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
| import torch | |
| import torch.nn.functional as F | |
| from einops import rearrange | |
| def resize_traj_and_ray(traj_n_ray, mem_size, future_size, height, width): | |
| ''' | |
| traj_n_ray: bv c t h w | |
| ''' | |
| orig_t = traj_n_ray.shape[3] | |
| try: | |
| assert orig_t > (mem_size + future_size) | |
| except: | |
| breakpoint() | |
| n_view = traj_n_ray.shape[2] | |
| mem = traj_n_ray[:, :, :mem_size] | |
| mem = rearrange(mem, 'bv c t h w -> (bv t) c h w') | |
| mem = F.interpolate(mem, (height, width), mode='bilinear') | |
| mem = rearrange(mem, '(bv t) c h w -> bv c t h w', t=mem_size) | |
| future = traj_n_ray[:, :, mem_size:] # bv c t h w | |
| future = F.interpolate(future, (future_size, height, width), mode='trilinear') | |
| out = torch.cat([mem, future], dim=2) | |
| return out | |