Th3r0 commited on
Commit
c84b4ae
1 Parent(s): 0af75b9

updated to new sts model

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from transformers import pipeline, AutoTokenizer, AutoModel, BertForSequenceClassification, AlbertForSequenceClassification, DebertaForSequenceClassification, AutoModelForSequenceClassification
3
  from peft.auto import AutoPeftModelForSequenceClassification
4
  from tensorboard.backend.event_processing import event_accumulator
5
  from peft import PeftModel
@@ -60,11 +60,11 @@ def AlbertUntrained_fn(text1, text2):
60
 
61
 
62
  # Handle calls to Deberta--------------------------------------------
63
- base_model2 = BertForSequenceClassification.from_pretrained("dslim/bert-base-NER")
64
- peft_model_id2 = "rajevan123/STS-Lora-Fine-Tuning-Capstone-bert-testing-42-with-lower-r-mid"
65
  model2 = PeftModel.from_pretrained(model=base_model2, model_id=peft_model_id2)
66
  sa_merged_model2 = model2.merge_and_unload()
67
- bbu_tokenizer2 = AutoTokenizer.from_pretrained("dslim/bert-base-NER")
68
 
69
  DebertaUntrained_pipe = pipeline("text-classification", model="microsoft/deberta-v3-xsmall")
70
  DebertanoLORA_pipe = pipeline(model="rajevan123/STS-Conventional-Fine-Tuning")
@@ -199,7 +199,7 @@ def displayMetricStatsTextNLILora():
199
 
200
  def displayMetricStatsTextSTSLora():
201
  #file_name = 'events.out.tfevents.STS-Lora.2'
202
- file_name = hf_hub_download(repo_id="rajevan123/STS-Lora-Fine-Tuning-Capstone-bert-testing-42-with-lower-r-mid", filename="runs/Mar25_00-56-35_e29d85799d45/events.out.tfevents.1711328197.e29d85799d45.483.4")
203
  event_acc = event_accumulator.EventAccumulator(file_name,
204
  size_guidance={
205
  event_accumulator.COMPRESSED_HISTOGRAMS: 500,
@@ -426,7 +426,7 @@ with gr.Blocks(
426
  sts_btn = gr.Button("Run")
427
  btnSTSStats = gr.Button("Display Training Metrics")
428
  btnTensorLinkSTSCon = gr.Button(value="View Conventional Training Graphs", link="https://huggingface.co/rajevan123/STS-Conventional-Fine-Tuning/tensorboard")
429
- btnTensorLinkSTSLora = gr.Button(value="View Lora Training Graphs", link="https://huggingface.co/rajevan123/STS-Lora-Fine-Tuning-Capstone-Deberta-old-model-pipe-test_augmentation/tensorboard")
430
  gr.Examples(
431
  [
432
  "the ball is green",
@@ -457,7 +457,7 @@ with gr.Blocks(
457
 
458
  with gr.Row(variant="panel"):
459
  sts_out2 = gr.Textbox(label= "LoRA Fine Tuned Model")
460
- STSLoraStats = gr.Textbox(label = "Training Informaiton - Active Training Time: 41.07 mins")
461
 
462
  sts_btn.click(fn=DebertaUntrained_fn, inputs=[sts_p1,sts_p2], outputs=sts_out)
463
  sts_btn.click(fn=DebertanoLORA_fn, inputs=[sts_p1,sts_p2], outputs=sts_out1)
 
1
  import gradio as gr
2
+ from transformers import pipeline, AutoTokenizer, AutoModel, BertForSequenceClassification, AlbertForSequenceClassification, DebertaForSequenceClassification, AutoModelForSequenceClassification, RobertaForSequenceClassification
3
  from peft.auto import AutoPeftModelForSequenceClassification
4
  from tensorboard.backend.event_processing import event_accumulator
5
  from peft import PeftModel
 
60
 
61
 
62
  # Handle calls to Deberta--------------------------------------------
63
+ base_model2 = RobertaForSequenceClassification.from_pretrained("FacebookAI/roberta-base", num_labels=3)
64
+ peft_model_id2 = "rajevan123/STS-Lora-Fine-Tuning-Capstone-roberta-base-filtered-137-with-higher-r-mid"
65
  model2 = PeftModel.from_pretrained(model=base_model2, model_id=peft_model_id2)
66
  sa_merged_model2 = model2.merge_and_unload()
67
+ bbu_tokenizer2 = AutoTokenizer.from_pretrained("FacebookAI/roberta-base")
68
 
69
  DebertaUntrained_pipe = pipeline("text-classification", model="microsoft/deberta-v3-xsmall")
70
  DebertanoLORA_pipe = pipeline(model="rajevan123/STS-Conventional-Fine-Tuning")
 
199
 
200
  def displayMetricStatsTextSTSLora():
201
  #file_name = 'events.out.tfevents.STS-Lora.2'
202
+ file_name = hf_hub_download(repo_id="rajevan123/STS-Lora-Fine-Tuning-Capstone-roberta-base-filtered-137-with-higher-r-mid", filename="runs/Mar28_19-51-13_fcdc58e67935/events.out.tfevents.1711655476.fcdc58e67935.625.0")
203
  event_acc = event_accumulator.EventAccumulator(file_name,
204
  size_guidance={
205
  event_accumulator.COMPRESSED_HISTOGRAMS: 500,
 
426
  sts_btn = gr.Button("Run")
427
  btnSTSStats = gr.Button("Display Training Metrics")
428
  btnTensorLinkSTSCon = gr.Button(value="View Conventional Training Graphs", link="https://huggingface.co/rajevan123/STS-Conventional-Fine-Tuning/tensorboard")
429
+ btnTensorLinkSTSLora = gr.Button(value="View Lora Training Graphs", link="https://huggingface.co/rajevan123/STS-Lora-Fine-Tuning-Capstone-roberta-base-filtered-137-with-higher-r-mid/tensorboard")
430
  gr.Examples(
431
  [
432
  "the ball is green",
 
457
 
458
  with gr.Row(variant="panel"):
459
  sts_out2 = gr.Textbox(label= "LoRA Fine Tuned Model")
460
+ STSLoraStats = gr.Textbox(label = "Training Informaiton - Active Training Time: 14.62 mins")
461
 
462
  sts_btn.click(fn=DebertaUntrained_fn, inputs=[sts_p1,sts_p2], outputs=sts_out)
463
  sts_btn.click(fn=DebertanoLORA_fn, inputs=[sts_p1,sts_p2], outputs=sts_out1)