Spaces:
Sleeping
Sleeping
fix: Import spaces before CUDA-related packages
Browse filesRuntimeError: CUDA has been initialized before importing the `spaces` package
🔧 Fix:
- Move 'import spaces' to the very first import
- Must be imported before torch, transformers, or any CUDA packages
- Critical for ZeroGPU to work properly
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -3,11 +3,11 @@ ZeroGPU version: Llama-2-Ko 7B with dynamic GPU allocation
|
|
| 3 |
Requires: PRO subscription + ZeroGPU hardware selection in Space settings
|
| 4 |
"""
|
| 5 |
|
|
|
|
| 6 |
import os
|
| 7 |
import gradio as gr
|
| 8 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 9 |
import torch
|
| 10 |
-
import spaces # ZeroGPU decorator
|
| 11 |
|
| 12 |
# Get HF token from environment
|
| 13 |
HF_TOKEN = os.getenv("HF_TOKEN", None)
|
|
|
|
| 3 |
Requires: PRO subscription + ZeroGPU hardware selection in Space settings
|
| 4 |
"""
|
| 5 |
|
| 6 |
+
import spaces # ZeroGPU decorator - MUST be imported first!
|
| 7 |
import os
|
| 8 |
import gradio as gr
|
| 9 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 10 |
import torch
|
|
|
|
| 11 |
|
| 12 |
# Get HF token from environment
|
| 13 |
HF_TOKEN = os.getenv("HF_TOKEN", None)
|