Xylor commited on
Commit
ca41d2e
·
verified ·
1 Parent(s): ae695f0

Initial swap to baseline bert-base-uncased

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -14,8 +14,10 @@ categories = [
14
  ]
15
  logging.debug("Categories to classify: " + repr(categories))
16
 
17
- # classifier = pipeline("zero-shot-classification",
18
- # model="facebook/bart-large-mnli")
 
 
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
- 'jinaai/jina-reranker-m0',
61
- torch_dtype="auto",
62
- trust_remote_code=True,
63
- # attn_implementation="flash_attention_2"
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
- # fn = my_inference_function,
85
- # fn = clf_text,
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
  )