This commit is contained in:
2026-03-27 01:26:30 +08:00
parent 9115672bb8
commit 352ade021b
+20 -2
View File
@@ -149,28 +149,46 @@ def configure_and_launch(model_idx, gpu_count):
# 2) LOCAL_MODEL_DIR/<repo> # 2) LOCAL_MODEL_DIR/<repo>
# 3) case-insensitive match of <repo> in LOCAL_MODEL_DIR # 3) case-insensitive match of <repo> in LOCAL_MODEL_DIR
model_path = model_id model_path = model_id
print(f"DEBUG: Starting model path lookup...")
if LOCAL_MODEL_DIR: if LOCAL_MODEL_DIR:
print(f"DEBUG: LOCAL_MODEL_DIR is set to: {LOCAL_MODEL_DIR}")
print(f"DEBUG: LOCAL_MODEL_DIR exists: {os.path.exists(LOCAL_MODEL_DIR)}")
if os.path.exists(LOCAL_MODEL_DIR):
print(f"DEBUG: LOCAL_MODEL_DIR contents: {os.listdir(LOCAL_MODEL_DIR)}")
# Full repo path (owner/repo) # Full repo path (owner/repo)
candidate_full = os.path.join(LOCAL_MODEL_DIR, model_id) candidate_full = os.path.join(LOCAL_MODEL_DIR, model_id)
print(f"DEBUG: Checking candidate_full: {candidate_full}")
print(f"DEBUG: candidate_full exists: {os.path.isdir(candidate_full)}")
if os.path.isdir(candidate_full): if os.path.isdir(candidate_full):
model_path = candidate_full model_path = candidate_full
print(f"DEBUG: Found model at: {model_path}")
else: else:
# Repo-name only (last segment) # Repo-name only (last segment)
repo_name = model_id.split('/')[-1] repo_name = model_id.split('/')[-1]
candidate_repo = os.path.join(LOCAL_MODEL_DIR, repo_name) candidate_repo = os.path.join(LOCAL_MODEL_DIR, repo_name)
print(f"DEBUG: Checking candidate_repo: {candidate_repo}")
print(f"DEBUG: candidate_repo exists: {os.path.isdir(candidate_repo)}")
if os.path.isdir(candidate_repo): if os.path.isdir(candidate_repo):
model_path = candidate_repo model_path = candidate_repo
print(f"DEBUG: Found model at: {model_path}")
else: else:
# Fallback: try to find a directory in LOCAL_MODEL_DIR that matches repo_name case-insensitively # Fallback: try to find a directory in LOCAL_MODEL_DIR that matches repo_name case-insensitively
print(f"DEBUG: Trying case-insensitive match for: {repo_name}")
try: try:
for entry in os.listdir(LOCAL_MODEL_DIR): for entry in os.listdir(LOCAL_MODEL_DIR):
print(f"DEBUG: Checking entry: {entry}")
if entry.lower() == repo_name.lower(): if entry.lower() == repo_name.lower():
entry_path = os.path.join(LOCAL_MODEL_DIR, entry) entry_path = os.path.join(LOCAL_MODEL_DIR, entry)
if os.path.isdir(entry_path): if os.path.isdir(entry_path):
model_path = entry_path model_path = entry_path
print(f"DEBUG: Found model at: {model_path}")
break break
except Exception: except Exception as e:
pass print(f"DEBUG: Exception during case-insensitive lookup: {e}")
print(f"DEBUG: Final model_path: {model_path}")
print(f"DEBUG: model_path == model_id: {model_path == model_id}")
# if LOCAL_MODEL_DIR is specified, refuse to fall back to remote # if LOCAL_MODEL_DIR is specified, refuse to fall back to remote
if LOCAL_MODEL_DIR and model_path == model_id: if LOCAL_MODEL_DIR and model_path == model_id: