| from huggingface_hub import notebook_login | |
| # Perform login | |
| notebook_login() | |
| # This script assumes that the environment variables and other setup have been done | |
| # as specified in the terminal commands. | |
| # The training command from the notebook is converted into a Python command | |
| # using the 'subprocess' module (for instance). | |
| import subprocess | |
| # Training command for the first model | |
| subprocess.run(["accelerate", "launch", "--mixed_precision=fp16", "train_text_to_image_lora.py", | |
| "--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5", | |
| "--dataset_name=lambdalabs/pokemon-blip-captions", | |
| "--dataloader_num_workers=8", | |
| "--resolution=512", "--center_crop", "--random_flip", | |
| "--train_batch_size=1", | |
| "--gradient_accumulation_steps=4", | |
| "--max_train_steps=15000", | |
| "--learning_rate=1e-04", | |
| "--max_grad_norm=1", | |
| "--lr_scheduler=cosine", "--lr_warmup_steps=0", | |
| "--output_dir=/content/gdrive/MyDrive/cs182/testing/", | |
| "--push_to_hub", | |
| "--hub_model_id=pokemon-lora", | |
| "--report_to=wandb", "--checkpointing_steps=500", | |
| subprocess.run(["accelerate", "launch", "--mixed_precision=fp16", "train_text_to_image_lora.py", | |
| "--pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5", | |
| "--dataset_name=pcuenq/oxford-pets", | |
| "--dataloader_num_workers=8", | |
| "--resolution=512", "--center_crop", "--random_flip", | |
| "--train_batch_size=1", | |
| "--gradient_accumulation_steps=4", | |
| "--max_train_steps=15000", | |
| "--learning_rate=1e-04", | |
| "--max_grad_norm=1", | |
| "--lr_scheduler=cosine", "--lr_warmup_steps=0", | |
| "--output_dir=/content/gdrive/MyDrive/cs182/testing_pets/", | |
| "--push_to_hub", | |
| "--hub_model_id=pets", | |
| "--checkpointing_steps=500", | |
| "--validation_prompt=Totoro", | |
| "--seed=1337", | |
| "--caption_column=label"]) | |