director: hold huggingface_hub below 2 (httpx renamed)
Browse files- kaggle/notebook_director.py +13 -7
kaggle/notebook_director.py
CHANGED
|
@@ -15,13 +15,19 @@ def sh(cmd: str) -> None:
|
|
| 15 |
|
| 16 |
|
| 17 |
def main() -> None:
|
| 18 |
-
#
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
from huggingface_hub import snapshot_download
|
| 27 |
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
def main() -> None:
|
| 18 |
+
# transformers 5 imports `httpx` from huggingface_hub.utils. huggingface_hub
|
| 19 |
+
# 2.x renamed that to httpx2 and the import fails, so hold hub below 2.
|
| 20 |
+
sh("pip install -q --upgrade 'transformers>=5' 'huggingface_hub>=1.31,<2' accelerate")
|
| 21 |
+
|
| 22 |
+
check = subprocess.run(
|
| 23 |
+
[sys.executable, "-c",
|
| 24 |
+
"import transformers, huggingface_hub as h;"
|
| 25 |
+
"print('transformers', transformers.__version__, 'hub', h.__version__);"
|
| 26 |
+
"from huggingface_hub.utils import httpx; print('httpx ok')"],
|
| 27 |
+
capture_output=True, text=True)
|
| 28 |
+
print(check.stdout.strip() or check.stderr[-600:], flush=True)
|
| 29 |
+
if check.returncode != 0:
|
| 30 |
+
raise SystemExit("director environment is broken")
|
| 31 |
|
| 32 |
from huggingface_hub import snapshot_download
|
| 33 |
|