niulx commited on
Commit
daaf697
1 Parent(s): e151738

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -13
app.py CHANGED
@@ -255,19 +255,22 @@ with gr.Blocks() as demo:
255
  train_batch_size,
256
  gradient_accumulation_steps,
257
  ):
258
- run_optimization = partial(
259
- run_main,
260
- num_tokens=int(num_tokens),
261
- embedding_learning_rate = float(embedding_learning_rate),
262
- max_emb_train_steps = int(max_emb_train_steps),
263
- diffusion_model_learning_rate= float(diffusion_model_learning_rate),
264
- max_diffusion_train_steps = int(max_diffusion_train_steps),
265
- train_batch_size=int(train_batch_size),
266
- gradient_accumulation_steps=int(gradient_accumulation_steps)
267
- )
268
- run_optimization()
269
- print('finish')
270
- return "Optimization finished!"
 
 
 
271
 
272
 
273
  def immediate_update():
 
255
  train_batch_size,
256
  gradient_accumulation_steps,
257
  ):
258
+ try:
259
+ run_optimization = partial(
260
+ run_main,
261
+ num_tokens=int(num_tokens),
262
+ embedding_learning_rate = float(embedding_learning_rate),
263
+ max_emb_train_steps = int(max_emb_train_steps),
264
+ diffusion_model_learning_rate= float(diffusion_model_learning_rate),
265
+ max_diffusion_train_steps = int(max_diffusion_train_steps),
266
+ train_batch_size=int(train_batch_size),
267
+ gradient_accumulation_steps=int(gradient_accumulation_steps)
268
+ )
269
+ run_optimization()
270
+ print('finish')
271
+ return "Optimization finished!"
272
+ except:
273
+ return "CUDA out of memory, try another picture."
274
 
275
 
276
  def immediate_update():