重現錯誤
這個錯誤是在 安裝 StreamDiffusion 開發環境 時發生的,當時的系統環境是這樣:
| 軟體名稱 | 版本 |
|---|---|
| Windows 11 | 23H2 |
| Python | 3.10 |
| CUDA | 12.4 |
| PyTorch | 2.6.0 |
在安裝 StreamDiffusion 需要的 TensorRT 時會出現「ImportError: cannot import name ‘cached_download’ from ‘huggingface_hub’」錯誤。

解決方法
點一下錯誤說明中最後列出的 dynamic_modules_utils.py 路徑,再點「在編輯器中開啟檔案」。

刪除第 28 行中的 cached_download:

往下滑到 285 行,將 cached_download 改成 hf_hub_download,最後長這樣:

存檔,重新執行之前的指令,問題應已解決!