alessandro trinca tornidor commited on
Commit
f733740
·
1 Parent(s): b16d3cb

bug: fix wrong logging instances

Browse files
Files changed (1) hide show
  1. lisa_on_cuda/utils/app_helpers.py +8 -6
lisa_on_cuda/utils/app_helpers.py CHANGED
@@ -209,10 +209,12 @@ def get_model(args_to_parse):
209
 
210
 
211
  @session_logger.set_uuid_logging
212
- def get_inference_model_by_args(args_to_parse):
213
- logging.info(f"args_to_parse:{args_to_parse}, creating model...")
 
 
214
  model, clip_image_processor, tokenizer, transform = get_model(args_to_parse)
215
- logging.info("created model, preparing inference function")
216
  no_seg_out = placeholders["no_seg_out"]
217
 
218
  @session_logger.set_uuid_logging
@@ -264,7 +266,7 @@ def get_inference_model_by_args(args_to_parse):
264
  image_np = cv2.imread(input_image)
265
  image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
266
  original_size_list = [image_np.shape[:2]]
267
- app_logger.debug("start clip_image_processor.preprocess")
268
  image_clip = (
269
  clip_image_processor.preprocess(image_np, return_tensors="pt")[
270
  "pixel_values"
@@ -272,7 +274,7 @@ def get_inference_model_by_args(args_to_parse):
272
  .unsqueeze(0)
273
  .cuda()
274
  )
275
- app_logger.debug("done clip_image_processor.preprocess")
276
  internal_logger.info(f"image_clip type: {type(image_clip)}.")
277
  image_clip = set_image_precision_by_args(image_clip, args_to_parse.precision)
278
 
@@ -334,7 +336,7 @@ def get_inference_model_by_args(args_to_parse):
334
  internal_logger.info(f"output_image type: {type(output_mask)}.")
335
  return output_image, output_mask, output_str
336
 
337
- app_logger.info("prepared inference function!")
338
  return inference
339
 
340
 
 
209
 
210
 
211
  @session_logger.set_uuid_logging
212
+ def get_inference_model_by_args(args_to_parse, internal_logger0: logging = None):
213
+ if internal_logger0 is None:
214
+ internal_logger0 = app_logger
215
+ internal_logger0.info(f"args_to_parse:{args_to_parse}, creating model...")
216
  model, clip_image_processor, tokenizer, transform = get_model(args_to_parse)
217
+ internal_logger0.info("created model, preparing inference function")
218
  no_seg_out = placeholders["no_seg_out"]
219
 
220
  @session_logger.set_uuid_logging
 
266
  image_np = cv2.imread(input_image)
267
  image_np = cv2.cvtColor(image_np, cv2.COLOR_BGR2RGB)
268
  original_size_list = [image_np.shape[:2]]
269
+ internal_logger.debug("start clip_image_processor.preprocess")
270
  image_clip = (
271
  clip_image_processor.preprocess(image_np, return_tensors="pt")[
272
  "pixel_values"
 
274
  .unsqueeze(0)
275
  .cuda()
276
  )
277
+ internal_logger.debug("done clip_image_processor.preprocess")
278
  internal_logger.info(f"image_clip type: {type(image_clip)}.")
279
  image_clip = set_image_precision_by_args(image_clip, args_to_parse.precision)
280
 
 
336
  internal_logger.info(f"output_image type: {type(output_mask)}.")
337
  return output_image, output_mask, output_str
338
 
339
+ internal_logger0.info("prepared inference function!")
340
  return inference
341
 
342