Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,13 @@ import re
|
|
9 |
from transformers import pipeline
|
10 |
from uuid import uuid4
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
#based on https://huggingface.co/spaces/Wauplin/space_to_dataset_saver/blob/main/app_json.py
|
13 |
#data is saved at https://huggingface.co/datasets/MR17u/tweeteval-irony-mcc/tree/main
|
14 |
|
@@ -33,7 +40,7 @@ Classify if the following tweet is ironic or not
|
|
33 |
# path_in_repo="data",
|
34 |
# )
|
35 |
|
36 |
-
classifier = pipeline("text-generation", model="meta-llama/Llama-2-7b-hf", low_cpu_mem_usage=True)
|
37 |
classifier.load_lora_weights("PierreEpron/llama7b-irony", weight_name="adapter_model.safetensors")
|
38 |
|
39 |
def clean_brackets(text):
|
|
|
9 |
from transformers import pipeline
|
10 |
from uuid import uuid4
|
11 |
|
12 |
+
import os
|
13 |
+
import tempfile
|
14 |
+
|
15 |
+
offload_dir='/content/offload'
|
16 |
+
os.makedirs(offload_dir) if not os.path.exists(offload_dir) else None
|
17 |
+
|
18 |
+
|
19 |
#based on https://huggingface.co/spaces/Wauplin/space_to_dataset_saver/blob/main/app_json.py
|
20 |
#data is saved at https://huggingface.co/datasets/MR17u/tweeteval-irony-mcc/tree/main
|
21 |
|
|
|
40 |
# path_in_repo="data",
|
41 |
# )
|
42 |
|
43 |
+
classifier = pipeline("text-generation", model="meta-llama/Llama-2-7b-hf", low_cpu_mem_usage=True, device_map="auto", offload_folder=offload_dir)
|
44 |
classifier.load_lora_weights("PierreEpron/llama7b-irony", weight_name="adapter_model.safetensors")
|
45 |
|
46 |
def clean_brackets(text):
|