ahmaddarkhalil Claude Opus 4.8 commited on
Commit
592e894
·
1 Parent(s): 1bb28ed

Add mmdet runtime deps + fix wheel cache path naming

Browse files

- ModuleNotFoundError: terminaltables — add terminaltables, six, tensorboard
(mmdet 2.25.3 runtime deps trimmed earlier).
- Cached wheel failed to install: encoding torch/cuda in the wheel filename
violated PEP 427 ("Invalid build number"). Keep a valid wheel filename and
put the torch/cuda/python cache key in the Hub path instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. app.py +9 -7
  2. requirements.txt +4 -0
app.py CHANGED
@@ -86,16 +86,18 @@ def _ensure_mmcv():
86
  tver = torch.__version__
87
  cuver = (torch.version.cuda or "none")
88
  pytag = f"cp{sys.version_info.major}{sys.version_info.minor}"
89
- wheel_name = (f"mmcv_full-1.7.2-torch{tver.replace('+', '_')}-"
90
- f"cu{cuver.replace('.', '')}-{pytag}-linux_x86_64.whl")
 
 
 
91
  token = os.environ.get("HF_TOKEN")
92
- print(f"[bootstrap] torch={tver} cuda={cuver}; cache wheel={wheel_name}",
93
- flush=True)
94
 
95
  # 1) Try a cached prebuilt wheel from the Hub.
96
  try:
97
  from huggingface_hub import hf_hub_download
98
- whl = hf_hub_download(repo_id=MMCV_CACHE_REPO, filename=wheel_name,
99
  token=token)
100
  run([sys.executable, "-m", "pip", "install", whl])
101
  if have_mmcv():
@@ -126,10 +128,10 @@ def _ensure_mmcv():
126
  try:
127
  if token:
128
  from huggingface_hub import upload_file
129
- upload_file(path_or_fileobj=built, path_in_repo=wheel_name,
130
  repo_id=MMCV_CACHE_REPO, token=token,
131
  commit_message="cache mmcv-full wheel")
132
- print(f"[bootstrap] cached wheel -> {MMCV_CACHE_REPO}/{wheel_name}",
133
  flush=True)
134
  except Exception as e:
135
  print(f"[bootstrap] wheel cache upload skipped ({e!r})", flush=True)
 
86
  tver = torch.__version__
87
  cuver = (torch.version.cuda or "none")
88
  pytag = f"cp{sys.version_info.major}{sys.version_info.minor}"
89
+ # The wheel FILENAME must stay PEP 427-valid for pip to install it; encode
90
+ # the torch/cuda/python cache key in the Hub PATH instead.
91
+ wheel_basename = f"mmcv_full-1.7.2-{pytag}-{pytag}-linux_x86_64.whl"
92
+ cache_key = f"torch{tver.replace('+', '_')}-cu{cuver.replace('.', '')}-{pytag}"
93
+ cache_path = f"mmcv_wheels/{cache_key}/{wheel_basename}"
94
  token = os.environ.get("HF_TOKEN")
95
+ print(f"[bootstrap] torch={tver} cuda={cuver}; cache={cache_path}", flush=True)
 
96
 
97
  # 1) Try a cached prebuilt wheel from the Hub.
98
  try:
99
  from huggingface_hub import hf_hub_download
100
+ whl = hf_hub_download(repo_id=MMCV_CACHE_REPO, filename=cache_path,
101
  token=token)
102
  run([sys.executable, "-m", "pip", "install", whl])
103
  if have_mmcv():
 
128
  try:
129
  if token:
130
  from huggingface_hub import upload_file
131
+ upload_file(path_or_fileobj=built, path_in_repo=cache_path,
132
  repo_id=MMCV_CACHE_REPO, token=token,
133
  commit_message="cache mmcv-full wheel")
134
+ print(f"[bootstrap] cached wheel -> {MMCV_CACHE_REPO}/{cache_path}",
135
  flush=True)
136
  except Exception as e:
137
  print(f"[bootstrap] wheel cache upload skipped ({e!r})", flush=True)
requirements.txt CHANGED
@@ -22,6 +22,10 @@ matplotlib
22
  pillow
23
  fvcore
24
  einops
 
 
 
 
25
 
26
  # Gradio / HF
27
  spaces
 
22
  pillow
23
  fvcore
24
  einops
25
+ # mmdet 2.25.3 runtime deps
26
+ terminaltables
27
+ six
28
+ tensorboard
29
 
30
  # Gradio / HF
31
  spaces