Instructions to use zeyuren2002/EvalMDE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use zeyuren2002/EvalMDE with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("zeyuren2002/EvalMDE", 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
| from pathlib import Path | |
| from datetime import datetime | |
| import shortuuid | |
| from omegaconf import DictConfig | |
| def flatten_dict_cfg(cfg): # [dict | DictConfig]) -> DictConfig: | |
| ret = {} | |
| if isinstance(cfg, dict): | |
| cfg = DictConfig(cfg) | |
| for k, v in cfg.items(): | |
| if isinstance(v, DictConfig): | |
| ret_v = flatten_dict_cfg(v) | |
| for _k, _v in ret_v.items(): | |
| ret[f'{k}_{_k}'] = _v | |
| else: | |
| ret[k] = v | |
| return DictConfig(ret) | |
| def current_time(): | |
| current_time = datetime.now() | |
| readable_time = current_time.strftime("%Y-%m-%d-%H:%M:%S") | |
| return readable_time | |
| def uuid(length=8): | |
| """ | |
| https://github.com/wandb/client/blob/master/wandb/util.py#L677 | |
| """ | |
| # ~3t run ids (36**8) | |
| run_gen = shortuuid.ShortUUID(alphabet=list("0123456789abcdefghijklmnopqrstuvwxyz")) | |
| return run_gen.random(length) | |
| def pathlib_file(file_name): | |
| if isinstance(file_name, str): | |
| file_name = Path(file_name) | |
| elif not isinstance(file_name, Path): | |
| raise TypeError(f'Please check the type of the filename:{file_name}') | |
| return file_name | |
| def assign_item_to_dict(d: dict, ks: list, v): | |
| ''' | |
| run d[ks[0]][ks[1]]...[ks[-1]] = v with filling empty keys | |
| :param d: | |
| :param ks: | |
| :param v: | |
| :return: | |
| ''' | |
| k = ks[0] | |
| if len(ks) == 1: | |
| d[k] = v | |
| else: | |
| if k not in d: | |
| d[k] = dict() | |
| assign_item_to_dict(d[k], ks[1:], v) | |