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 numpy as np | |
| import torch | |
| import random | |
| def act_metric(preds, gts, prefix='val', start_stop_interval=[(0,1),(1,9),(9,25),(25,57)]): | |
| """ | |
| inputs: | |
| preds : b, t, nc_act | |
| gts : b, t, nc_act | |
| start_stop_interval: how to split action predictions along the temporal dimension, like [(0, t-1), (t-1, t)] | |
| outputs: | |
| MSE of actions | |
| """ | |
| assert preds.shape == gts.shape | |
| assert start_stop_interval[0][0] == 0 and start_stop_interval[-1][-1] == preds.shape[1] | |
| logs = {} | |
| for i in range(preds.shape[-1]): | |
| dim_delta = (preds[:,:,i] - gts[:,:,i]) ** 2 | |
| dim_mean = dim_delta.mean(axis=0) | |
| dim_std = dim_delta.std(axis=0) | |
| for h_start, h_stop in start_stop_interval: | |
| logs[f'{prefix}/{h_start}_{h_stop}_dim_{i}_diff'] = np.mean(dim_mean[h_start:h_stop]) | |
| logs[f'{prefix}/{h_start}_{h_stop}_dim_{i}_std'] = np.mean(dim_std[h_start:h_stop]) | |
| return logs |