MogensR commited on
Commit
b4655c7
·
1 Parent(s): 711ba64
Files changed (1) hide show
  1. models/__init__.py +15 -3
models/__init__.py CHANGED
@@ -248,13 +248,21 @@ def _composite_frame_pro(
248
  # --------------------------------------------------------------------------------------
249
  def _resolve_sam2_cfg(cfg_str: str) -> str:
250
  """Make the SAM2 config path absolute (prefer inside TP_SAM2)."""
 
 
251
  cfg_path = Path(cfg_str)
252
  if not cfg_path.is_absolute():
253
  candidate = TP_SAM2 / cfg_path
 
 
254
  if candidate.exists():
255
- return str(candidate)
 
 
256
  if cfg_path.exists():
257
- return str(cfg_path)
 
 
258
  # Updated SAM2 config search paths to match actual repository structure
259
  for name in [
260
  "sam2/configs/sam2.1/sam2.1_hiera_l.yaml", # SAM 2.1 (preferred)
@@ -265,8 +273,12 @@ def _resolve_sam2_cfg(cfg_str: str) -> str:
265
  "sam2/configs/sam2/sam2_hiera_s.yaml"
266
  ]:
267
  p = TP_SAM2 / name
 
268
  if p.exists():
269
- return str(p)
 
 
 
270
  return str(cfg_str)
271
 
272
  def _find_hiera_config_if_hieradet(cfg_path: str) -> Optional[str]:
 
248
  # --------------------------------------------------------------------------------------
249
  def _resolve_sam2_cfg(cfg_str: str) -> str:
250
  """Make the SAM2 config path absolute (prefer inside TP_SAM2)."""
251
+ logger.info(f"_resolve_sam2_cfg called with cfg_str={cfg_str}")
252
+ logger.info(f"TP_SAM2 = {TP_SAM2}")
253
  cfg_path = Path(cfg_str)
254
  if not cfg_path.is_absolute():
255
  candidate = TP_SAM2 / cfg_path
256
+ logger.info(f"Candidate path: {candidate}")
257
+ logger.info(f"Candidate exists: {candidate.exists()}")
258
  if candidate.exists():
259
+ result = str(candidate)
260
+ logger.info(f"Returning candidate: {result}")
261
+ return result
262
  if cfg_path.exists():
263
+ result = str(cfg_path)
264
+ logger.info(f"Returning original path: {result}")
265
+ return result
266
  # Updated SAM2 config search paths to match actual repository structure
267
  for name in [
268
  "sam2/configs/sam2.1/sam2.1_hiera_l.yaml", # SAM 2.1 (preferred)
 
273
  "sam2/configs/sam2/sam2_hiera_s.yaml"
274
  ]:
275
  p = TP_SAM2 / name
276
+ logger.info(f"Checking fallback path: {p}, exists: {p.exists()}")
277
  if p.exists():
278
+ result = str(p)
279
+ logger.info(f"Returning fallback path: {result}")
280
+ return result
281
+ logger.info(f"No config found, returning original: {cfg_str}")
282
  return str(cfg_str)
283
 
284
  def _find_hiera_config_if_hieradet(cfg_path: str) -> Optional[str]: