PerryCheng614 commited on
Commit
2cc9e9f
·
verified ·
1 Parent(s): 06314dc

Update model card

Browse files
Files changed (1) hide show
  1. README.md +4 -10
README.md CHANGED
@@ -1,6 +1,3 @@
1
- ---
2
- {}
3
- ---
4
  # HP BERT Intent Classification Model
5
 
6
  This model is fine-tuned BERT for classifying different types of queries in the HP documentation context.
@@ -22,8 +19,7 @@ class BertInference:
22
  def __init__(self, model_path):
23
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
24
  self.model = AutoModelForSequenceClassification.from_pretrained(model_path).to(self.device)
25
- self.tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
26
- self.template = "Question: {} Response: "
27
  self.label_map = {
28
  0: "query_with_pdf",
29
  1: "summarize_pdf",
@@ -31,12 +27,10 @@ class BertInference:
31
  }
32
 
33
  def predict(self, text):
34
- # Format the input text
35
- formatted_text = self.template.format(text)
36
-
37
  # Tokenize
38
  inputs = self.tokenizer(
39
- formatted_text,
40
  truncation=True,
41
  max_length=512,
42
  padding='max_length',
@@ -61,7 +55,7 @@ class BertInference:
61
 
62
  def main():
63
  # Initialize the model
64
- model_path = "output_dir_decision" # Path to your saved model
65
  inferencer = BertInference(model_path)
66
 
67
  # Example usage
 
 
 
 
1
  # HP BERT Intent Classification Model
2
 
3
  This model is fine-tuned BERT for classifying different types of queries in the HP documentation context.
 
19
  def __init__(self, model_path):
20
  self.device = "cuda" if torch.cuda.is_available() else "cpu"
21
  self.model = AutoModelForSequenceClassification.from_pretrained(model_path).to(self.device)
22
+ self.tokenizer = AutoTokenizer.from_pretrained("FacebookAI/xlm-roberta-base")
 
23
  self.label_map = {
24
  0: "query_with_pdf",
25
  1: "summarize_pdf",
 
27
  }
28
 
29
  def predict(self, text):
30
+ # Format the input text
 
 
31
  # Tokenize
32
  inputs = self.tokenizer(
33
+ text,
34
  truncation=True,
35
  max_length=512,
36
  padding='max_length',
 
55
 
56
  def main():
57
  # Initialize the model
58
+ model_path = "nexaai2b/Octopus-xlm-roberta-BERT-intent-classification" # Path to your saved model
59
  inferencer = BertInference(model_path)
60
 
61
  # Example usage