georad commited on
Commit
1d8da39
·
verified ·
1 Parent(s): f1b1ddc

Update pages/type_text.py

Browse files
Files changed (1) hide show
  1. pages/type_text.py +7 -10
pages/type_text.py CHANGED
@@ -41,14 +41,14 @@ numMAPPINGS_input = 5
41
  @st.cache_resource
42
  def load_model():
43
  model = SentenceTransformer('all-MiniLM-L6-v2') # fastest
 
 
 
 
44
  return model
45
  model = load_model()
46
 
47
- #model = SentenceTransformer('all-MiniLM-L6-v2') # fastest
48
- #model = SentenceTransformer('all-mpnet-base-v2') # best performance
49
- #model = SentenceTransformers('all-distilroberta-v1')
50
- #model = SentenceTransformer('sentence-transformers/msmarco-bert-base-dot-v5')
51
- #model = SentenceTransformer('clips/mfaq')
52
 
53
  INTdesc_embedding = model.encode(INTdesc_input)
54
 
@@ -73,12 +73,11 @@ HF_model_results_displayed = HF_model_results_sorted[0:numMAPPINGS_input]
73
 
74
  @st.cache_resource
75
  def load_pipe():
76
- pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-1B-Instruct", device_map=device,) # device_map="auto", torch_dtype=torch.bfloat16
 
77
  return pipe
78
  pipe = load_pipe()
79
 
80
- #pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-1B-Instruct", device_map=device,) # device_map="auto", torch_dtype=torch.bfloat16
81
-
82
  dictA = {"Score": [], "SBS Code": [], "SBS Description V2.0": []}
83
  dfALL = pd.DataFrame.from_dict(dictA)
84
 
@@ -97,8 +96,6 @@ if INTdesc_input is not None and createSBScodes_clicked == True:
97
 
98
  st.dataframe(data=dfALL, hide_index=True)
99
 
100
- display_format = "ask REASONING MODEL: Which, if any, of the above SBS descriptions corresponds best to " + INTdesc_input +"? "
101
- #st.write(display_format)
102
  question = "Which one, if any, of the below Saudi Billing System descriptions A, B, C, D, or E corresponds best to " + INTdesc_input +"? "
103
  shortlist = [SBScorpus[result[0]["corpus_id"]], SBScorpus[result[1]["corpus_id"]], SBScorpus[result[2]["corpus_id"]], SBScorpus[result[3]["corpus_id"]], SBScorpus[result[4]["corpus_id"]]]
104
  prompt = question + " " +"A: "+ shortlist[0] + " " +"B: " + shortlist[1] + " " + "C: " + shortlist[2] + " " + "D: " + shortlist[3] + " " + "E: " + shortlist[4]
 
41
  @st.cache_resource
42
  def load_model():
43
  model = SentenceTransformer('all-MiniLM-L6-v2') # fastest
44
+ #model = SentenceTransformer('all-mpnet-base-v2') # best performance
45
+ #model = SentenceTransformers('all-distilroberta-v1')
46
+ #model = SentenceTransformer('sentence-transformers/msmarco-bert-base-dot-v5')
47
+ #model = SentenceTransformer('clips/mfaq')
48
  return model
49
  model = load_model()
50
 
51
+
 
 
 
 
52
 
53
  INTdesc_embedding = model.encode(INTdesc_input)
54
 
 
73
 
74
  @st.cache_resource
75
  def load_pipe():
76
+ #pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-1B-Instruct", device_map=device,) # device_map="auto", torch_dtype=torch.bfloat16
77
+ pipe = pipeline("text-generation", model="Qwen/Qwen2-1.5B-Instruct", device_map=device,) # device_map="auto", torch_dtype="auto"
78
  return pipe
79
  pipe = load_pipe()
80
 
 
 
81
  dictA = {"Score": [], "SBS Code": [], "SBS Description V2.0": []}
82
  dfALL = pd.DataFrame.from_dict(dictA)
83
 
 
96
 
97
  st.dataframe(data=dfALL, hide_index=True)
98
 
 
 
99
  question = "Which one, if any, of the below Saudi Billing System descriptions A, B, C, D, or E corresponds best to " + INTdesc_input +"? "
100
  shortlist = [SBScorpus[result[0]["corpus_id"]], SBScorpus[result[1]["corpus_id"]], SBScorpus[result[2]["corpus_id"]], SBScorpus[result[3]["corpus_id"]], SBScorpus[result[4]["corpus_id"]]]
101
  prompt = question + " " +"A: "+ shortlist[0] + " " +"B: " + shortlist[1] + " " + "C: " + shortlist[2] + " " + "D: " + shortlist[3] + " " + "E: " + shortlist[4]