Update README.md
Browse files
README.md
CHANGED
|
@@ -12,7 +12,7 @@ license: mit
|
|
| 12 |
|
| 13 |
Using Covid-Twitter-BERT-v2 (https://huggingface.co/digitalepidemiologylab/covid-twitter-bert-v2) as the starting model, we continued domain-adaptive pre-training on a corpus of firm tweets between 2007 and 2020. The model was then fine-tuned on the downstream task to classify whether a given tweet is related to climate change topics.
|
| 14 |
|
| 15 |
-
The model provides a label and probability score, indicating whether a given tweet is related to climate change topics (label =
|
| 16 |
|
| 17 |
## Performance metrics:
|
| 18 |
|
|
@@ -30,17 +30,17 @@ Based on the test set, the model achieves the following results:
|
|
| 30 |
```python
|
| 31 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
| 32 |
|
| 33 |
-
task_name = '
|
| 34 |
-
model_name = Climate-TwitterBERT/ Climate-TwitterBERT-step1'
|
| 35 |
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 37 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 38 |
|
| 39 |
-
pipe = pipeline(task
|
| 40 |
|
| 41 |
tweet = "We are committed to significantly cutting our carbon emissions by 30% before 2030."
|
| 42 |
result = pipe(tweet)
|
| 43 |
-
# The 'result' variable will contain the classification output:
|
| 44 |
```
|
| 45 |
|
| 46 |
## Citation:
|
|
|
|
| 12 |
|
| 13 |
Using Covid-Twitter-BERT-v2 (https://huggingface.co/digitalepidemiologylab/covid-twitter-bert-v2) as the starting model, we continued domain-adaptive pre-training on a corpus of firm tweets between 2007 and 2020. The model was then fine-tuned on the downstream task to classify whether a given tweet is related to climate change topics.
|
| 14 |
|
| 15 |
+
The model provides a label and probability score, indicating whether a given tweet is related to climate change topics (label = 'Climate') or not (label = 'Non-climate').
|
| 16 |
|
| 17 |
## Performance metrics:
|
| 18 |
|
|
|
|
| 30 |
```python
|
| 31 |
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
|
| 32 |
|
| 33 |
+
task_name = 'text-classification'
|
| 34 |
+
model_name = 'Climate-TwitterBERT/ Climate-TwitterBERT-step1'
|
| 35 |
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 37 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 38 |
|
| 39 |
+
pipe = pipeline(task=task_name, model=model, tokenizer=tokenizer)
|
| 40 |
|
| 41 |
tweet = "We are committed to significantly cutting our carbon emissions by 30% before 2030."
|
| 42 |
result = pipe(tweet)
|
| 43 |
+
# The 'result' variable will contain the classification output: 'Climate' or 'Non-climate'.
|
| 44 |
```
|
| 45 |
|
| 46 |
## Citation:
|