Dillon Pulliam
commited on
Commit
•
d3d6377
1
Parent(s):
e2d3977
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# DistilBERT-Base-Uncased for Duplicate Question Detection
|
2 |
+
This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) originally released in ["DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter"](https://arxiv.org/abs/1910.01108) and trained on the [Quora Question Pairs](https://quoradata.quora.com/First-Quora-Dataset-Release-Question-Pairs) dataset; part of the [General Language Understanding Evaluation (GLUE)](https://gluebenchmark.com) benchmark. This model was fine-tuned by the team at [AssemblyAI](https://www.assemblyai.com) and is released with the [corresponding blog post]().
|
3 |
+
|
4 |
+
## Usage
|
5 |
+
To download and utilize this model for sentiment analysis please execute the following:
|
6 |
+
```python
|
7 |
+
import torch.nn.functional as F
|
8 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
9 |
+
tokenizer = AutoTokenizer.from_pretrained("assemblyai/distilbert-base-uncased-qqp")
|
10 |
+
model = AutoModelForSequenceClassification.from_pretrained("assemblyai/distilbert-base-uncased-qqp")
|
11 |
+
|
12 |
+
tokenized_segments = tokenizer(["How many hours does it take to fly from California to New York?"], ["What is the flight time from New York to Seattle?"], return_tensors="pt", padding=True, truncation=True)
|
13 |
+
tokenized_segments_input_ids, tokenized_segments_attention_mask = tokenized_segments.input_ids, tokenized_segments.attention_mask
|
14 |
+
model_predictions = F.softmax(model(input_ids=tokenized_segments_input_ids, attention_mask=tokenized_segments_attention_mask)['logits'], dim=1)
|
15 |
+
|
16 |
+
print("Positive probability: "+str(model_predictions[0][1].item()*100)+"%")
|
17 |
+
print("Negative probability: "+str(model_predictions[0][0].item()*100)+"%")
|
18 |
+
```
|
19 |
+
|
20 |
+
For questions about how to use this model feel free to contact the team at [AssemblyAI](https://www.assemblyai.com)!
|