1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HuggingFace ZeroGPU のRuntimeError:ZeroGPU: Unknownが出たら

Last updated at Posted at 2024-08-05

こんにちはアッキーです。
Mixture-of-Agentsをgroq以外でも動くようにしたいと思って
https://huggingface.co/spaces/Akjava/llm-moa

今日から、ZeroGPUデビューしたところ、早速エラーの洗礼をうけました。

このエラーが出た場合は、運営に相談するしかない。(文章考えてる間に治ったので連絡はしてない)

raise RuntimeError("Error while initializing ZeroGPU: Unknown")
RuntimeError: Error while initializing ZeroGPU: Unknown

特徴としては、コードがアノテーション部分に到達した瞬間にエラーが出ます。
sleepとか対処法考えましたけど無駄でした。時間が解決するタイプの問題ですね。

@spaces.GPU
def generate_text(

悲しいかな、別のSpaceを作っても同様のエラーでした。次からは、@spaces.GPUのアノテーションを外して、CPUモードで見た目とかの検証に時間を当てたいと思いました。

Issue的には未解決だけどこれかも
https://github.com/hpcaitech/Open-Sora/issues/532

未確定ですが、Modelを再利用しようと試みるとこのエラーになったケースもあった。読み込み時間かかってしかたないけどモデルはGPUメソッド内で作り直すことにする。

もしかして

少しだけ謎が解けてた。@spaces.GPU以外のところでも、間違ってGPU取得できたりするけど、それしたら後でクラッシュが待ってると思うことにする。
@spaces.GPU以外のメソッドでGPUに触れないことだね。
面倒だけど、modelもpipelineも毎回初期化するしかないかな。(時間できたら人気アプリの構成を見てみよう)

その他のエラー

import spaces の位置を変えたら治った?

/usr/local/lib/python3.10/site-packages/torch/cuda/__init__.py:628: UserWarning: Can't initialize NVML
  warnings.warn("Can't initialize NVML")
Traceback (most recent call last):
  File "/home/user/app/app.py", line 4, in <module>
    import spaces
  File "/usr/local/lib/python3.10/site-packages/spaces/__init__.py", line 19, in <module>
    from .zero.decorator import GPU
  File "/usr/local/lib/python3.10/site-packages/spaces/zero/__init__.py", line 15, in <module>
    raise RuntimeError(
RuntimeError: CUDA has been initialized before importing the `spaces` package
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?