multimodalart HF staff commited on
Commit
26ee92f
1 Parent(s): ad94fb3

Update app_training.py

Browse files
Files changed (1) hide show
  1. app_training.py +59 -58
app_training.py CHANGED
@@ -37,65 +37,66 @@ def create_training_demo(trainer: Trainer,
37
  visible=False)
38
  validation_prompt = gr.Text(label='Validation Prompt')
39
 
40
- with gr.Box():
41
- gr.Markdown('Training Parameters')
42
- with gr.Row():
43
- base_model = gr.Text(label='Base Model',
44
- value='CompVis/stable-diffusion-v1-4',
45
- max_lines=1)
46
- resolution = gr.Dropdown(choices=['512', '768'],
47
- value='512',
48
- label='Resolution',
49
- visible=False)
50
-
51
- token = gr.Text(label="Hugging Face Write Token", placeholder="", visible=False if hf_token else True)
52
- with gr.Accordion("Advanced settings", open=False):
53
- num_training_steps = gr.Number(
54
- label='Number of Training Steps', value=300, precision=0)
55
- learning_rate = gr.Number(label='Learning Rate',
56
- value=0.000035)
57
- gradient_accumulation = gr.Number(
58
- label='Number of Gradient Accumulation',
59
- value=1,
60
- precision=0)
61
- seed = gr.Slider(label='Seed',
62
- minimum=0,
63
- maximum=100000,
64
- step=1,
65
- randomize=True,
66
- value=0)
67
- fp16 = gr.Checkbox(label='FP16', value=True)
68
- use_8bit_adam = gr.Checkbox(label='Use 8bit Adam', value=False)
69
- checkpointing_steps = gr.Number(label='Checkpointing Steps',
70
- value=1000,
71
- precision=0)
72
- validation_epochs = gr.Number(label='Validation Epochs',
73
- value=100,
74
- precision=0)
75
- gr.Markdown('''
76
- - The base model must be a model that is compatible with [diffusers](https://github.com/huggingface/diffusers) library.
77
- - Expected time to train a model for 300 steps: ~20 minutes with T4
78
- - You can check the training status by pressing the "Open logs" button if you are running this on your Space.
79
- ''')
80
-
81
- with gr.Box():
82
- gr.Markdown('Upload Settings')
83
  with gr.Row():
84
- upload_to_hub = gr.Checkbox(
85
- label='Upload model to Hub', value=True)
86
- use_private_repo = gr.Checkbox(label='Private',
87
- value=True)
88
- delete_existing_repo = gr.Checkbox(
89
- label='Delete existing repo of the same name',
90
- value=False)
91
- upload_to = gr.Radio(
92
- label='Upload to',
93
- choices=[_.value for _ in UploadTarget],
94
- value=UploadTarget.MODEL_LIBRARY.value)
95
- gr.Markdown(f'''
96
- - By default, trained models will be uploaded to [Tune-A-Video Library](https://huggingface.co/{MODEL_LIBRARY_ORG_NAME}) (see [this example model](https://huggingface.co/{SAMPLE_MODEL_REPO})).
97
- - You can also choose "Personal Profile", in which case, the model will be uploaded to https://huggingface.co/{{your_username}}/{{model_name}}.
98
- ''')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  remove_gpu_after_training = gr.Checkbox(
100
  label='Remove GPU after training',
101
  value=False,
 
37
  visible=False)
38
  validation_prompt = gr.Text(label='Validation Prompt')
39
 
40
+ with gr.Column():
41
+ with gr.Box():
42
+ gr.Markdown('Training Parameters')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  with gr.Row():
44
+ base_model = gr.Text(label='Base Model',
45
+ value='CompVis/stable-diffusion-v1-4',
46
+ max_lines=1)
47
+ resolution = gr.Dropdown(choices=['512', '768'],
48
+ value='512',
49
+ label='Resolution',
50
+ visible=False)
51
+
52
+ token = gr.Text(label="Hugging Face Write Token", placeholder="", visible=False if hf_token else True)
53
+ with gr.Accordion("Advanced settings", open=False):
54
+ num_training_steps = gr.Number(
55
+ label='Number of Training Steps', value=300, precision=0)
56
+ learning_rate = gr.Number(label='Learning Rate',
57
+ value=0.000035)
58
+ gradient_accumulation = gr.Number(
59
+ label='Number of Gradient Accumulation',
60
+ value=1,
61
+ precision=0)
62
+ seed = gr.Slider(label='Seed',
63
+ minimum=0,
64
+ maximum=100000,
65
+ step=1,
66
+ randomize=True,
67
+ value=0)
68
+ fp16 = gr.Checkbox(label='FP16', value=True)
69
+ use_8bit_adam = gr.Checkbox(label='Use 8bit Adam', value=False)
70
+ checkpointing_steps = gr.Number(label='Checkpointing Steps',
71
+ value=1000,
72
+ precision=0)
73
+ validation_epochs = gr.Number(label='Validation Epochs',
74
+ value=100,
75
+ precision=0)
76
+ gr.Markdown('''
77
+ - The base model must be a model that is compatible with [diffusers](https://github.com/huggingface/diffusers) library.
78
+ - Expected time to train a model for 300 steps: ~20 minutes with T4
79
+ - You can check the training status by pressing the "Open logs" button if you are running this on your Space.
80
+ ''')
81
+
82
+ with gr.Box():
83
+ gr.Markdown('Upload Settings')
84
+ with gr.Row():
85
+ upload_to_hub = gr.Checkbox(
86
+ label='Upload model to Hub', value=True)
87
+ use_private_repo = gr.Checkbox(label='Private',
88
+ value=True)
89
+ delete_existing_repo = gr.Checkbox(
90
+ label='Delete existing repo of the same name',
91
+ value=False)
92
+ upload_to = gr.Radio(
93
+ label='Upload to',
94
+ choices=[_.value for _ in UploadTarget],
95
+ value=UploadTarget.MODEL_LIBRARY.value)
96
+ gr.Markdown(f'''
97
+ - By default, trained models will be uploaded to [Tune-A-Video Library](https://huggingface.co/{MODEL_LIBRARY_ORG_NAME}) (see [this example model](https://huggingface.co/{SAMPLE_MODEL_REPO})).
98
+ - You can also choose "Personal Profile", in which case, the model will be uploaded to https://huggingface.co/{{your_username}}/{{model_name}}.
99
+ ''')
100
  remove_gpu_after_training = gr.Checkbox(
101
  label='Remove GPU after training',
102
  value=False,