File size: 2,194 Bytes
71ac1fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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"])