Spaces:
Sleeping
Sleeping
Trying to empty cache and load the model once
Browse files
app.py
CHANGED
|
@@ -7,13 +7,15 @@ import torch
|
|
| 7 |
# Use a pipeline as a high-level helper
|
| 8 |
from transformers import pipeline
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
@spaces.GPU(duration=120)
|
| 13 |
def llama3_1_8B(question):
|
| 14 |
-
|
| 15 |
-
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B", max_new_tokens=200, device=0)
|
| 16 |
-
print("PIPE DONE")
|
| 17 |
|
| 18 |
messages = [
|
| 19 |
{"role": "user", "content": question},
|
|
|
|
| 7 |
# Use a pipeline as a high-level helper
|
| 8 |
from transformers import pipeline
|
| 9 |
|
| 10 |
+
torch.cuda.empty_cache()
|
| 11 |
|
| 12 |
+
print("RUNNING PIPE")
|
| 13 |
+
pipe = pipeline("text-generation", model="NousResearch/Hermes-3-Llama-3.1-8B", max_new_tokens=200, device=0)
|
| 14 |
+
print("PIPE DONE")
|
| 15 |
|
| 16 |
@spaces.GPU(duration=120)
|
| 17 |
def llama3_1_8B(question):
|
| 18 |
+
|
|
|
|
|
|
|
| 19 |
|
| 20 |
messages = [
|
| 21 |
{"role": "user", "content": question},
|