Spaces:
Sleeping
Sleeping
Initial swap to baseline bert-base-uncased
Browse files
app.py
CHANGED
@@ -14,8 +14,10 @@ categories = [
|
|
14 |
]
|
15 |
logging.debug("Categories to classify: " + repr(categories))
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
19 |
|
20 |
# sequence_to_classify = "one day I will see the world"
|
21 |
# candidate_labels = ['travel', 'cooking', 'dancing']
|
@@ -56,12 +58,13 @@ def clf_text(txt: str | list[str]):
|
|
56 |
|
57 |
from transformers import AutoModel
|
58 |
# comment out the flash_attention_2 line if you don't have a compatible GPU
|
59 |
-
model = AutoModel.from_pretrained(
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
|
66 |
def clf_jina(txt: str | list[str]):
|
67 |
# construct sentence pairs
|
@@ -81,9 +84,8 @@ def my_inference_function(name):
|
|
81 |
return "Hello " + name + "!"
|
82 |
|
83 |
gradio_interface = gradio.Interface(
|
84 |
-
|
85 |
-
#
|
86 |
-
clf_jina,
|
87 |
inputs = "text",
|
88 |
outputs = gradio.JSON()
|
89 |
)
|
|
|
14 |
]
|
15 |
logging.debug("Categories to classify: " + repr(categories))
|
16 |
|
17 |
+
classifier = pipeline("zero-shot-classification",
|
18 |
+
model="google-bert/bert-base-uncased")
|
19 |
+
# model="Xylor/bert-case-uncased-single-sampled")
|
20 |
+
# model="facebook/bart-large-mnli")
|
21 |
|
22 |
# sequence_to_classify = "one day I will see the world"
|
23 |
# candidate_labels = ['travel', 'cooking', 'dancing']
|
|
|
58 |
|
59 |
from transformers import AutoModel
|
60 |
# comment out the flash_attention_2 line if you don't have a compatible GPU
|
61 |
+
# model = AutoModel.from_pretrained(
|
62 |
+
# # 'jinaai/jina-reranker-m0',
|
63 |
+
# "Xylor/bert-case-uncased-single-sampled",
|
64 |
+
# torch_dtype="auto",
|
65 |
+
# trust_remote_code=True,
|
66 |
+
# # attn_implementation="flash_attention_2"
|
67 |
+
# )
|
68 |
|
69 |
def clf_jina(txt: str | list[str]):
|
70 |
# construct sentence pairs
|
|
|
84 |
return "Hello " + name + "!"
|
85 |
|
86 |
gradio_interface = gradio.Interface(
|
87 |
+
fn = clf_text,
|
88 |
+
# clf_jina,
|
|
|
89 |
inputs = "text",
|
90 |
outputs = gradio.JSON()
|
91 |
)
|