Instructions to use cszhilu1998/LiveWorld with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use cszhilu1998/LiveWorld with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("cszhilu1998/LiveWorld", 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
Download LiveWorld-Code/scripts/train.py from cszhilu1998/LiveWorld: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/scripts/train.py
- Command line
-
hf download hf://cszhilu1998/LiveWorld/LiveWorld-Code/scripts/train.py
-
curl -L -o train.py https://huggingface.co/cszhilu1998/LiveWorld/resolve/main/LiveWorld-Code/scripts/train.py
1.09 kB
| import argparse | |
| import os | |
| import sys | |
| import warnings | |
| from omegaconf import OmegaConf | |
| import wandb | |
| warnings.filterwarnings("ignore") | |
| os.environ["PYTHONWARNINGS"] = "ignore" | |
| os.environ["TOKENIZERS_PARALLELISM"] = "false" | |
| from liveworld.trainer import Trainer | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--config_path", type=str, required=True) | |
| parser.add_argument("--disable_wandb", action="store_true") | |
| args = parser.parse_args() | |
| config = OmegaConf.load(args.config_path) | |
| # Merge default config if specified | |
| default_config_path = config.get("default_config_path", None) | |
| if default_config_path and os.path.exists(default_config_path): | |
| default_config = OmegaConf.load(default_config_path) | |
| config = OmegaConf.merge(default_config, config) | |
| config.config_name = os.path.basename(args.config_path).split(".")[0] | |
| config.config_path = args.config_path | |
| config.disable_wandb = args.disable_wandb | |
| trainer = Trainer(config) | |
| trainer.train() | |
| wandb.finish() | |
| if __name__ == "__main__": | |
| main() | |