Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,12 +13,14 @@ DEFAULT_MAX_NEW_TOKENS = 512
|
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
|
14 |
|
15 |
if not torch.cuda.is_available():
|
16 |
-
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
@spaces.GPU(duration=30)
|
24 |
def generate(
|
@@ -121,4 +123,4 @@ with gr.Blocks(css="style.css") as demo:
|
|
121 |
chat_interface.render()
|
122 |
|
123 |
if __name__ == "__main__":
|
124 |
-
demo.queue(max_size=20).launch()
|
|
|
13 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "8192"))
|
14 |
|
15 |
if not torch.cuda.is_available():
|
16 |
+
print("❌ CUDA GPU not available. This demo requires a GPU to function properly.")
|
17 |
+
print("Please run this application on a system with CUDA-compatible GPU.")
|
18 |
+
exit(1)
|
19 |
|
20 |
+
# Load model and tokenizer
|
21 |
+
model_id = "utter-project/EuroLLM-9B-Instruct"
|
22 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
23 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
|
24 |
|
25 |
@spaces.GPU(duration=30)
|
26 |
def generate(
|
|
|
123 |
chat_interface.render()
|
124 |
|
125 |
if __name__ == "__main__":
|
126 |
+
demo.queue(max_size=20).launch()
|