multimodalart HF staff commited on
Commit
42ce6d2
·
1 Parent(s): 5293f10

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -315,7 +315,7 @@ def start_training(
315
  requirements='''peft==0.7.1
316
  -huggingface_hub
317
  torch
318
- git+https://github.com/huggingface/diffusers@1622265e131f9fa5154d429de065573605dc2476
319
  transformers==4.36.2
320
  accelerate==0.25.0
321
  safetensors==0.4.1
@@ -338,13 +338,16 @@ git+https://github.com/huggingface/huggingface_hub.git@8d052492fe0059c606c1a48d7
338
  else:
339
  raise gr.Error("Something went wrong. Make sure the name of your LoRA is unique and try again")
340
 
341
- def calculate_price(iterations):
342
- seconds_per_iteration = 3.50
 
 
 
343
  total_seconds = (iterations * seconds_per_iteration) + 210
344
  cost_per_second = 1.05/60/60
345
  cost = round(cost_per_second * total_seconds, 2)
346
  return f'''To train this LoRA, we will duplicate the space and hook an A10G GPU under the hood.
347
- ## Estimated to cost <b>< US$ {str(cost)}</b> for {round(int(total_seconds)/60, 2)} minutes with your current train settings <small>({int(iterations)} iterations at 3.50s/it)</small>
348
  #### ↓ to continue, grab you <b>write</b> token [here](https://huggingface.co/settings/tokens) and enter it below ↓'''
349
 
350
  def start_training_og(
@@ -950,7 +953,7 @@ with gr.Blocks(css=css, theme=theme) as demo:
950
  )
951
  max_train_steps.change(
952
  calculate_price,
953
- inputs=[max_train_steps],
954
  outputs=[training_cost_estimate],
955
  queue=False
956
  )
 
315
  requirements='''peft==0.7.1
316
  -huggingface_hub
317
  torch
318
+ git+https://github.com/huggingface/diffusers@9e1b2710e527fe5e8ed68027315922e3e3ef64af
319
  transformers==4.36.2
320
  accelerate==0.25.0
321
  safetensors==0.4.1
 
338
  else:
339
  raise gr.Error("Something went wrong. Make sure the name of your LoRA is unique and try again")
340
 
341
+ def calculate_price(iterations, with_prior_preservation):
342
+ if(with_prior_preservation):
343
+ seconds_per_iteration = 3.50
344
+ else:
345
+ seconds_per_iteration = 1.10
346
  total_seconds = (iterations * seconds_per_iteration) + 210
347
  cost_per_second = 1.05/60/60
348
  cost = round(cost_per_second * total_seconds, 2)
349
  return f'''To train this LoRA, we will duplicate the space and hook an A10G GPU under the hood.
350
+ ## Estimated to cost <b>< US$ {str(cost)}</b> for {round(int(total_seconds)/60, 2)} minutes with your current train settings <small>({int(iterations)} iterations at {seconds_per_iteration}s/it)</small>
351
  #### ↓ to continue, grab you <b>write</b> token [here](https://huggingface.co/settings/tokens) and enter it below ↓'''
352
 
353
  def start_training_og(
 
953
  )
954
  max_train_steps.change(
955
  calculate_price,
956
+ inputs=[max_train_steps, with_prior_preservation],
957
  outputs=[training_cost_estimate],
958
  queue=False
959
  )