Spaces:
Sleeping
Sleeping
Huiran Yu commited on
Commit ·
ea8b7ec
1
Parent(s): eed6484
patch numpy
Browse files- Dockerfile +29 -18
- requirements.txt +0 -1
Dockerfile
CHANGED
|
@@ -23,28 +23,39 @@ RUN pip install --no-cache-dir --no-build-isolation madmom
|
|
| 23 |
|
| 24 |
# madmom patch
|
| 25 |
RUN python - <<'PY'
|
| 26 |
-
import site, pathlib
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
for p in paths:
|
| 32 |
-
cand = pathlib.Path(p) / "madmom" / "processors.py"
|
| 33 |
if cand.exists():
|
| 34 |
-
|
| 35 |
break
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
PY
|
| 49 |
|
| 50 |
|
|
|
|
| 23 |
|
| 24 |
# madmom patch
|
| 25 |
RUN python - <<'PY'
|
| 26 |
+
import site, pathlib, re
|
| 27 |
|
| 28 |
+
pkg_root = None
|
| 29 |
+
for p in site.getsitepackages():
|
| 30 |
+
cand = pathlib.Path(p) / "madmom"
|
|
|
|
|
|
|
| 31 |
if cand.exists():
|
| 32 |
+
pkg_root = cand
|
| 33 |
break
|
| 34 |
+
if pkg_root is None:
|
| 35 |
+
raise SystemExit("madmom package not found")
|
| 36 |
|
| 37 |
+
repls = [
|
| 38 |
+
("from collections import MutableSequence", "from collections.abc import MutableSequence"),
|
| 39 |
+
("np.float", "float"), # or "np.float64"
|
| 40 |
+
("np.int", "int"),
|
| 41 |
+
("np.bool", "bool"),
|
| 42 |
+
("np.object", "object"),
|
| 43 |
+
]
|
| 44 |
+
|
| 45 |
+
patched = 0
|
| 46 |
+
for f in pkg_root.rglob("*.py"):
|
| 47 |
+
try:
|
| 48 |
+
s = f.read_text(encoding="utf-8")
|
| 49 |
+
except Exception:
|
| 50 |
+
continue
|
| 51 |
+
s2 = s
|
| 52 |
+
for a, b in repls:
|
| 53 |
+
s2 = s2.replace(a, b)
|
| 54 |
+
if s2 != s:
|
| 55 |
+
f.write_text(s2, encoding="utf-8")
|
| 56 |
+
patched += 1
|
| 57 |
+
|
| 58 |
+
print(f"Patched {patched} madmom files under {pkg_root}")
|
| 59 |
PY
|
| 60 |
|
| 61 |
|
requirements.txt
CHANGED
|
@@ -2,7 +2,6 @@ pip>=23.1
|
|
| 2 |
setuptools<82
|
| 3 |
wheel
|
| 4 |
gradio==5.28.0
|
| 5 |
-
numpy==1.26.4
|
| 6 |
Cython
|
| 7 |
git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
|
| 8 |
librosa
|
|
|
|
| 2 |
setuptools<82
|
| 3 |
wheel
|
| 4 |
gradio==5.28.0
|
|
|
|
| 5 |
Cython
|
| 6 |
git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
|
| 7 |
librosa
|