ysharma HF staff commited on
Commit
7722e4b
·
1 Parent(s): 5ecdabf
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -51,7 +51,7 @@ def accelerate_train_lora(steps):
51
  --learning_rate=1e-4 \
52
  --lr_scheduler="constant" \
53
  --lr_warmup_steps=0 \
54
- --max_train_steps={steps}') #,shell=True) #30000
55
  print("***********inside accelerate_train_lora 22222***********")
56
  return
57
 
@@ -61,11 +61,13 @@ with gr.Blocks() as demo:
61
  #in_prompt = gr.Textbox(label="Enter a ")
62
  in_steps = gr.Number(label="Enter number of steps")
63
  in_alpha = gr.Slider(0.1,1.0, step=0.01, label="Set Alpha level - higher value has more chances to overfit")
 
64
  b1 = gr.Button(value="Train LORA model")
65
  b2 = gr.Button(value="Inference using LORA model")
66
  with gr.Row():
67
  out_image = gr.Image(label="Image generated by LORA model")
68
- b1.click(fn = accelerate_train_lora, inputs=in_steps)
 
69
  b2.click(fn = monkeypatching, inputs=in_alpha, outputs=out_image)
70
 
71
  demo.launch(debug=True, show_error=True)
 
51
  --learning_rate=1e-4 \
52
  --lr_scheduler="constant" \
53
  --lr_warmup_steps=0 \
54
+ --max_train_steps={int(steps)}') #,shell=True) #30000
55
  print("***********inside accelerate_train_lora 22222***********")
56
  return
57
 
 
61
  #in_prompt = gr.Textbox(label="Enter a ")
62
  in_steps = gr.Number(label="Enter number of steps")
63
  in_alpha = gr.Slider(0.1,1.0, step=0.01, label="Set Alpha level - higher value has more chances to overfit")
64
+ with gr.Row():
65
  b1 = gr.Button(value="Train LORA model")
66
  b2 = gr.Button(value="Inference using LORA model")
67
  with gr.Row():
68
  out_image = gr.Image(label="Image generated by LORA model")
69
+ out_file = gr.File(label="Lora trained model weights")
70
+ b1.click(fn = accelerate_train_lora, inputs=in_steps, outputs=out_file)
71
  b2.click(fn = monkeypatching, inputs=in_alpha, outputs=out_image)
72
 
73
  demo.launch(debug=True, show_error=True)