Update app.py
Browse files
app.py
CHANGED
@@ -6,11 +6,12 @@ os.environ["CUDA_VISIBLE_DEVICES"] = "" # Prevents CUDA initialization
|
|
6 |
import spaces
|
7 |
import gradio as gr
|
8 |
from huggingface_hub import InferenceClient, login
|
9 |
-
|
10 |
import time
|
11 |
|
12 |
|
13 |
-
|
|
|
|
|
14 |
|
15 |
# Base model (LLaMA 3.1 8B) from Meta
|
16 |
base_model_name = "meta-llama/Llama-3.1-8B"
|
@@ -35,9 +36,7 @@ def chatbot_response(user_input):
|
|
35 |
if torch.cuda.is_initialized():
|
36 |
print("CUDA was already initialized before Accelerator!")
|
37 |
|
38 |
-
|
39 |
-
def force_gpu_allocation():
|
40 |
-
pass # Dummy function to trigger GPU setup
|
41 |
|
42 |
accelerator = Accelerator()
|
43 |
|
|
|
6 |
import spaces
|
7 |
import gradio as gr
|
8 |
from huggingface_hub import InferenceClient, login
|
|
|
9 |
import time
|
10 |
|
11 |
|
12 |
+
@spaces.GPU # Forces GPU allocation before execution
|
13 |
+
def force_gpu_allocation():
|
14 |
+
pass # Dummy function to trigger GPU setup
|
15 |
|
16 |
# Base model (LLaMA 3.1 8B) from Meta
|
17 |
base_model_name = "meta-llama/Llama-3.1-8B"
|
|
|
36 |
if torch.cuda.is_initialized():
|
37 |
print("CUDA was already initialized before Accelerator!")
|
38 |
|
39 |
+
|
|
|
|
|
40 |
|
41 |
accelerator = Accelerator()
|
42 |
|