alessandro trinca tornidor commited on
Commit
81e8410
·
1 Parent(s): 6d22b1d

[debug] add some logs

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -227,8 +227,8 @@ def get_inference_model_by_args(args_to_parse):
227
  url_schemes={"http", "https", "mailto"},
228
  link_rel=None,
229
  )
230
-
231
- print("input_str: ", input_str, "input_image: ", input_image)
232
 
233
  ## input valid check
234
  if not re.match(r"^[A-Za-z ,.!?\'\"]+$", input_str) or len(input_str) < 1:
@@ -265,6 +265,7 @@ def get_inference_model_by_args(args_to_parse):
265
  .unsqueeze(0)
266
  .cuda()
267
  )
 
268
  if args_to_parse.precision == "bf16":
269
  image_clip = image_clip.bfloat16()
270
  elif args_to_parse.precision == "fp16":
@@ -280,6 +281,7 @@ def get_inference_model_by_args(args_to_parse):
280
  .unsqueeze(0)
281
  .cuda()
282
  )
 
283
  if args_to_parse.precision == "bf16":
284
  image = image.bfloat16()
285
  elif args_to_parse.precision == "fp16":
@@ -305,7 +307,7 @@ def get_inference_model_by_args(args_to_parse):
305
  text_output = text_output.replace("\n", "").replace(" ", " ")
306
  text_output = text_output.split("ASSISTANT: ")[-1]
307
 
308
- print("text_output: ", text_output)
309
  save_img = None
310
  for i, pred_mask in enumerate(pred_masks):
311
  if pred_mask.shape[0] == 0:
 
227
  url_schemes={"http", "https", "mailto"},
228
  link_rel=None,
229
  )
230
+ logging.info(f"input_str type: {type(input_str)}, input_image type: {type(input_image)}.")
231
+ logging.info(f"input_str: {input_str}.")
232
 
233
  ## input valid check
234
  if not re.match(r"^[A-Za-z ,.!?\'\"]+$", input_str) or len(input_str) < 1:
 
265
  .unsqueeze(0)
266
  .cuda()
267
  )
268
+ logging.info(f"image_clip type: {type(image_clip)}.")
269
  if args_to_parse.precision == "bf16":
270
  image_clip = image_clip.bfloat16()
271
  elif args_to_parse.precision == "fp16":
 
281
  .unsqueeze(0)
282
  .cuda()
283
  )
284
+ logging.info(f"image_clip type: {type(image_clip)}.")
285
  if args_to_parse.precision == "bf16":
286
  image = image.bfloat16()
287
  elif args_to_parse.precision == "fp16":
 
307
  text_output = text_output.replace("\n", "").replace(" ", " ")
308
  text_output = text_output.split("ASSISTANT: ")[-1]
309
 
310
+ logging.info(f"text_output type: {type(text_output)}, text_output: {text_output}.")
311
  save_img = None
312
  for i, pred_mask in enumerate(pred_masks):
313
  if pred_mask.shape[0] == 0: